PropertyChanged event on deleted and re-added track

Post Reply
User avatar
UNZ
Posts: 742
Joined: Mon Nov 21, 2011 9:42 pm
Contact:

PropertyChanged event on deleted and re-added track

Post by UNZ »

i have a question about track handling.

in the normal parameter window, you can observe the following:
-add a new track
-set one of the parameters to a value
-delete the track
-add the track again: the parameter has the old value (not default value)

so this means that in my gui, i never receive a propertychange event (for the parameters) when i re-add already deleted tracks. this would be ok, but when i try to set things like canvas.top on some elements in my AddTrack function, it doesn't work. it works when its called from imachine set, but not when trackcount is increased and i react to that.
i already tried a Dispatcher.BeginInvoke(new Action(() but it also doesn't update the gui.

any idea ?

Code: Select all


        void AddTrack(int track)
        {
            machine.AllNonInputParameters().First(p => p.Name == "Gain").SubscribeEvents(track, Gain_ValueChanged, null);

            UserControl ch = new Channel(machine, track);
            Channels.Add(ch);
            MainCanvas.Children.Add(ch);

            Dispatcher.BeginInvoke(new Action(() =>
            {
                //PROBLEM: THIS ONLY WORKS ON STARTUP WHEN CALLED FROM IMACHINE SET, NOT WHEN ADDTRACK IS CALLED FROM INCREASING TRACKCOUNT
                Gain_ValueChanged(machine.AllNonInputParameters().First(p => p.Name == "Gain"), track);

            })); 
        }

Post Reply