Пример #1
0
        public ExperimentModel(ViewModel.ExpirementAddMasterModel ModelFrom)
        {
            start_time     = DateTime.Now;
            State          = "Ожидание";
            SelectedDevice = ModelFrom.selectedDeviceFactory;
            Environment    = ModelFrom.selecteEnvironmentModel;
            switch (ModelFrom.TerminateCause)
            {
            case TimeExpWatch.ByTime:
                TerminateSpan = ModelFrom.TerminateDateTime - DateTime.Now;
                break;

            case TimeExpWatch.ByInterval:
                TerminateSpan = ModelFrom.TerminateSpan;
                break;
            }
            FetchSpan          = ModelFrom.FetchSpan;
            Environment.IsBusy = true;

            imitator = Environment.Imitator.Build();
            device   = SelectedDevice.Build();

            //ExpirementData.Clear();

            FetchProgress.ProgressChanged += FetchProgress_ProgressChanged;
            DataProgress.ProgressChanged  += DataProgress_ProgressChanged;

            FetchData = new ViewModel.RelayCommand(o =>
            {
                CancelTestingSource = new CancellationTokenSource();
                CancelTesting       = CancelTestingSource.Token;
                fetchData(FetchProgress, DataProgress);
            }, o => true);

            updateTimer.Tick    += UpdateTimer_Tick;
            updateTimer.Interval = TimeSpan.FromMilliseconds(400);
            lastMeasurment       = DateTime.Now;
            updateTimer.Start();

            ExpirementChartModel.Axes.Add(new OxyPlot.Axes.DateTimeAxis()
            {
                Font                   = "Consolas",
                IsAxisVisible          = true,
                IsPanEnabled           = true,
                FontSize               = 10,
                Key                    = "Время",
                IsZoomEnabled          = true,
                MajorGridlineThickness = 1,
                MajorGridlineStyle     = LineStyle.Dot,
                MajorGridlineColor     = OxyColors.LightGray,
            });

            ExpirementChartModel.Axes.Add(new OxyPlot.Axes.LinearAxis()
            {
                Font                   = "Consolas",
                IsPanEnabled           = false,
                MaximumPadding         = 1,
                MinimumPadding         = 1,
                Angle                  = -45,
                FontSize               = 10,
                Key                    = "Значение",
                AbsoluteMaximum        = 200,
                AbsoluteMinimum        = -100,
                MajorStep              = 50,
                IsZoomEnabled          = false,
                MajorGridlineThickness = 1,
                MajorGridlineStyle     = LineStyle.Dot,
                MajorGridlineColor     = OxyColors.LightGray,
            });
        }
Пример #2
0
 public CheckinStateViewModel(Account accountModel, string name, Controls.CloudStateType type, Uri icon, Dispatcher uiDispatcher)
     : base(uiDispatcher)
 {
     _accountModel = accountModel;
     _weather = type;
     Name = name;
     Icon = icon;
     SelecteStatusCommand = new ViewModel.RelayCommand(SelectedStatus_Executed);
 }