samedi 10 avril 2021

get access from static class by general name

I have a static class StaticDataValues. In this class I instantiate my value classes:

public static class StaticDataValues
{
    public static Floor Floor = new Floor ();
    public static Kitchen Kitchen = new Kitchen ();
}

In other classes (e.g. in a WPF UserControl) I want to use (e.g.) Kitchen.

private void InitializeEventNotifications()
{
    StaticDataValues.Kitchen.Raffstore.ElementAt(this.ID).Status.ValueChanged += (s, e) =>
    {
        var value = s as Home.Automation.Beckhoff.VarModel.VarItemBool;

        if (value != null)
        {
            Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background,
                new Action(() => this.ButtonAuto.Button.IsCheckedvalue.Value));
        }
    };
}

How can I change this Kitchen to Floor dynamically (over a property)? Is this possible?





Aucun commentaire:

Enregistrer un commentaire