Exemplo n.º 1
0
        public TA2007ViewModel()
        {
            Messenger.Default.Register <TA2007ChannelsSettings>(this, (o) =>
            {
                _selectedChannelsList = o.SelectedChannales.ToList();
                ResetNumberColor();
                PaintSelectedChannels();
                RaisePropertyChanged(nameof(IsFunctionCheckTestChecked));
                RaisePropertyChanged(nameof(IsErrorCalculationTestChecked));
            });
            Messenger.Default.Register <Brush[]>(this, (o) =>
            {
                PhasingColor = o[0];
                SyncColor    = o[1];
                RaisePropertyChanged(nameof(PhasingColor));
                RaisePropertyChanged(nameof(SyncColor));
            });
            Messenger.Default.Register <TA2007ResultText>(this, (o) =>
            {
                _lastResult = o.Text;
                ResultText.AppendLine(_lastResult);
                RaisePropertyChanged(nameof(ResultText));
            });
            Messenger.Default.Register <DebugSettings>(this, (o) =>
            {
                _timerValue = o.TA2007TimerValue;
                _timerStep  = (float)(100.0 / _timerValue);
            });

            _ta2007Model               = new TA2007Model();
            _log                       = Log.GetInstance();
            _canStart                  = true;
            _selectedChannelsList      = new List <int>();
            IsFunctionCheckTestChecked = true;
            IsResistanceTestChecked    = true;
            IsPhasing                  = false;
            ResultText                 = new StringBuilder();

            _timer          = new DispatcherTimer();
            _timer.Tick    += new EventHandler(timer_Tick);
            _timer.Interval = new TimeSpan(0, 0, 1);
            _timerValue     = Properties.Settings.Default.TA2007TimerValue;
            _timerStep      = (float)(100.0 / _timerValue);

            ListAddressesCount = Constants.LIST_ADDRESSES_COUNT;

            ProgressBarVisibility = Visibility.Hidden;
            IsControlsEnabled     = true;
            SelectedAddress       = Properties.Settings.Default.TA2007Address;
            IsPhasing             = false;
        }