示例#1
0
        public ZOffsetCalibrationModel(MigoProxyService migoProxyService)
        {
            Activator = new ViewModelActivator();

            _migoProxyService = migoProxyService;

            var modes = new ObservableCollection <BedLevelingCalibrationMode>();

            foreach (var value in Enum.GetValues <BedLevelingCalibrationMode>())
            {
                modes.Add(value);
            }

            CalibrationModes =
                new ReadOnlyObservableCollection <BedLevelingCalibrationMode>(modes);

            CalibrationMode = BedLevelingCalibrationMode.FivePoints;

            SetZOffsetCommand = ReactiveCommand.CreateFromTask(
                (Func <double, Task>)SetZOffset);

            MoveToZOffsetCommand = ReactiveCommand.CreateFromTask(MoveToZOffset);

            StopCalibrationCommand = ReactiveCommand.CreateFromTask(StopCalibration);

            this.WhenActivated(OnActivated);
        }
示例#2
0
        public ManualControlViewModel(MigoProxyService service)
        {
            _service  = service;
            Activator = new ViewModelActivator();

            StepSize = 5;
            BedT     = 110;
            NozzleT  = 235;

            this.WhenActivated(OnActivated);
        }
示例#3
0
        public MainWindowViewModel(MigoProxyService migoProxyService, ConfigProvider configProvider)
        {
            Activator = new ViewModelActivator();

            _cancellationTokenSource = new CancellationTokenSource();
            _migoProxyService        = migoProxyService;
            _configProvider          = configProvider;

            PreheatEnabled     = true;
            PreheatTemperature = 100;
            GcodeFileName      = string.Empty;
            State = "Idle";

            ManualControl      = new ManualControlViewModel(migoProxyService);
            ZOffsetCalibration = new ZOffsetCalibrationModel(migoProxyService);

            Endpoints     = new ObservableCollection <MigoEndpoint>();
            NozzleTValues = new ObservableCollection <TemperaturePoint>();
            BedTValues    = new ObservableCollection <TemperaturePoint>();

            ShowEndpointsDialog        = new Interaction <EndpointsDialogViewModel, EndpointsListModel>();
            ShowEndpointsDialogCommand = ReactiveCommand.CreateFromTask(OnShowEndpointsDialog);

            GCodeFileSelected = ReactiveCommand.CreateFromTask(
                (Func <string, Task>)OnGCodeFileSelected);

            var canStartPrint = this
                                .WhenAnyValue(model => model.GcodeFileName)
                                .Select(x => !string.IsNullOrEmpty(x))
                                .ObserveOn(RxApp.MainThreadScheduler);

            StartPrintCommand = ReactiveCommand.CreateFromTask(StartPrint, canStartPrint);
            StopPrintCommand  = ReactiveCommand.CreateFromTask(StopPrint);

            this.WhenActivated(OnActivated);
        }