Пример #1
0
        private void DLC_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName != "DLC")
            {
                return;
            }

            if (Payload.Count >= (int)DLC)
            {
                while (Payload.Count > (int)DLC)
                {
                    Application.Current.Dispatcher.Invoke((Action)(() => { Payload.RemoveAt(0); }));
                }
            }
            else
            {
                while (Payload.Count < (int)DLC)
                {
                    Application.Current.Dispatcher.Invoke((Action)(() => { Payload.Insert(0, 0); }));
                }
            }

            if (Increment.Count >= (int)DLC)
            {
                while (Increment.Count > (int)DLC)
                {
                    Application.Current.Dispatcher.Invoke((Action)(() => { Increment.RemoveAt(0); }));
                }
            }
            else
            {
                while (Increment.Count < (int)DLC)
                {
                    Application.Current.Dispatcher.Invoke((Action)(() => { Increment.Insert(0, 0); }));
                }
            }
        }