コード例 #1
0
        public PrintExecuteViewModel(GCodeManagerViewModel GCodeManagerViewModel,
                                     RealTimeStatusDataModel RealTimeStatusDataModel, CalibrationViewModel CalibrationViewModel,
                                     SerialCommunicationViewModel SerialCommunicationViewModel, SerialCommunicationOutgoingMessagesModel SerialCommunicationOutgoingMessagesModel,
                                     SerialMessageDisplayViewModel SerialMessageDisplayViewModel, PrintViewModel PrintViewModel)
        {
            _gCodeManagerViewModel                    = GCodeManagerViewModel;
            _realTimeStatusDataModel                  = RealTimeStatusDataModel;
            _calibrationViewModel                     = CalibrationViewModel;
            _serialCommunicationViewModel             = SerialCommunicationViewModel;
            _serialCommunicationOutgoingMessagesModel = SerialCommunicationOutgoingMessagesModel;
            _serialMessageDisplayViewModel            = SerialMessageDisplayViewModel;
            _printViewModel = PrintViewModel;

            _gCodeManagerViewModel.GCodeFileUploaded      += new GCodeFileUploadedEventHandler(UpdateUploadedGCode);
            _printViewModel.PrintViewModelRepRapIDChanged += new PrintViewModelRepRapIDChanged(UpdateRepRapIDSet);

            _serialCommunicationViewModel.SerialCommunicationMainModel.SerialConnectionChanged                   += new SerialConnectionChangedEventHandler(UpdateSerialConnection);
            _serialCommunicationViewModel.SerialCommunicationMainModel.SerialCommunicationCompleted              += new SerialCommunicationCompletedEventHandler(UpdatePrintFinished);
            _serialCommunicationViewModel.SerialCommunicationMainModel.SerialCommunicationPrintSequencePaused    += new SerialCommunicationPrintSequencePausedEventHandler(UpdatePrintSequencePaused);
            _serialCommunicationViewModel.SerialCommunicationMainModel.SerialCommunicationMicrocontrollerResumed += new SerialCommunicationMicrocontrollerResumedEventHandler(UpdateMicrocontrollerResumed);

            _realTimeStatusDataModel.RecordSetMotorizedPrintheadExecuted += new RecordSetMotorizedPrintheadExecutedEventHandler(UpdateActivePrintheadType);
            _realTimeStatusDataModel.RecordSetValvePrintheadExecuted     += new RecordSetValvePrintheadExecutedEventHandler(UpdateActivePrintheadType);
            _realTimeStatusDataModel.RecordLimitExecuted += new RecordLimitExecutedEventHandler(UpdateLimitHit);

            _calibrationViewModel.CalibrationModel.CalibrationBegun += new CalibrationBegunEventHandler(UpdateCalibrationBegun);
        }
コード例 #2
0
        public MVCalibrationView(IMachine machine)
        {
            InitializeComponent();
            var designTime = System.ComponentModel.DesignerProperties.GetIsInDesignMode(new DependencyObject());

            if (!designTime)
            {
                ViewModel = new CalibrationViewModel(machine);

                this.Closing += MachineVision_Closing;
                this.Loaded  += MachineVision_Loaded;
            }
        }
コード例 #3
0
        public MainViewModel()
        {
            //Error Handling.
            _errorListViewModel = new ErrorListViewModel();

            //Printer Model.
            _printerModel = new PrinterModel();

            //Print Model.
            _printModel = new PrintModel(_printerModel);

            //Serial Communication Incoming and Outgoing Message Interpreter.
            _realTimeStatusDataModel = new RealTimeStatusDataModel(_printerModel);

            //Serial Communication.
            _serialCommunicationOutgoingMessagesModel = new SerialCommunicationOutgoingMessagesModel();
            _serialCommunicationMainModel             = new SerialCommunicationMainModel(_serialCommunicationOutgoingMessagesModel, _printerModel, _printModel, _realTimeStatusDataModel, _errorListViewModel);
            _serialMessageDisplayViewModel            = new SerialMessageDisplayViewModel();
            _serialCommunicationViewModel             = new SerialCommunicationViewModel(_serialCommunicationMainModel, _serialCommunicationOutgoingMessagesModel, _serialMessageDisplayViewModel);

            //Printer View Model.
            _printerViewModel = new PrinterViewModel(_printerModel, _serialCommunicationMainModel.SerialCommunicationCommandSetsModel);

            //Print View Model.
            _printViewModel = new PrintViewModel(_printModel, _serialMessageDisplayViewModel);

            //Real Time Status.
            _realTimeStatusSerialInterpreterModel = new RealTimeStatusSerialInterpreterModel(_serialCommunicationMainModel, _printerModel, _printerViewModel, _realTimeStatusDataModel, _errorListViewModel);
            _realTimeStatusDataViewModel          = new RealTimeStatusDataViewModel(_realTimeStatusDataModel, _printerViewModel, _serialCommunicationMainModel.SerialCommunicationCommandSetsModel, _errorListViewModel);

            //Manual Commmands and Calibration.
            _manualControlModel     = new ManualControlModel(_printerModel, _serialCommunicationOutgoingMessagesModel, _realTimeStatusDataModel, _errorListViewModel);
            _calibrationModel       = new CalibrationModel(_realTimeStatusDataModel, _printerModel, _serialCommunicationOutgoingMessagesModel, _errorListViewModel);
            _manualControlViewModel = new ManualControlViewModel(_manualControlModel, _realTimeStatusDataViewModel, _printerViewModel);
            _calibrationViewModel   = new CalibrationViewModel(_calibrationModel, _manualControlViewModel, _realTimeStatusDataViewModel, _printerViewModel);

            //GCode.
            _uploadedGCodeModel    = new GCodeModel();
            _gCodeFileManagerModel = new GCodeFileManagerModel(_uploadedGCodeModel, _errorListViewModel);
            _gCodeConverterModel   = new GCodeConverterModel(_printerModel, _printModel, _realTimeStatusDataModel, _errorListViewModel);
            _gcodeManagerViewModel = new GCodeManagerViewModel(_gCodeFileManagerModel, _gCodeConverterModel, _printViewModel);

            //Printing.
            _printExecuteViewModel = new PrintExecuteViewModel(_gcodeManagerViewModel, _realTimeStatusDataModel, _calibrationViewModel, _serialCommunicationViewModel, _serialCommunicationOutgoingMessagesModel, _serialMessageDisplayViewModel, _printViewModel);

            //Settings.
            _saveLoadViewModel = new SaveLoadViewModel(_gcodeManagerViewModel, _printerViewModel, _printViewModel, _errorListViewModel);

            //Unset Main Window.
            _unsetMainViewModel = new UnsetMainViewModel();
        }
コード例 #4
0
        private KinectManager()
        {
            EventIntervalInMilliseconds = 2000;
            _kinect = MyKinect.Instance;
            _kinect.SingleUserMode = true;
            _kinect.ChangeMaxSkeletonPositions(.5f, .5f);
            ConfigurationViewModel = new ConfigureKinectViewModel();
            _calibrationView       = new Calibration();
            _calibrationViewModel  = CalibrationViewModel.Current;

            if (_calibrationViewModel != null)
            {
                _calibrationViewModel.SaveCalibrationData += CalibrationView_SaveCalibrationData;
                _calibrationViewModel.CountDownFinished   += CalibrationView_CountDownFinished;
            }
        }
コード例 #5
0
        public CalibrationWindow(AdasController controller)
        {
            InitializeComponent();

            Controller = controller;

            _viewModel = Model.Calibrated
                ? new CalibrationViewModel(Model.CalibrationModel.CalibrationResult.Settings)
                : new CalibrationViewModel();
            _viewModel.CalibrationResult = Model.CalibrationModel.CalibrationResult;

            if (Model.Mode == SourceMode.Camera)
            {
                InitCameraMode();
            }
            else
            {
                InitImageMode();
            }

            DataContext = _viewModel;
        }
コード例 #6
0
ファイル: App.xaml.cs プロジェクト: TzeenchH/ExamProgram
        protected override void OnStartup(StartupEventArgs e)
        {
            Shell shell              = new Shell("АИК");
            var   LogWindow          = new LogginWindowView();
            var   LogWindowViewModel = new LoggingWindowViewModel(shell);
            var   InstrumentalView   = new InstrumentalView();
            var   SettingsView       = new SettingsView();
            var   MeasurementsView   = new MeasurementsView();
            var   DataBaseView       = new DataBaseView();
            var   LogsView           = new LogsView();
            var   CalibrationView    = new CalibrationView();
            var   WizardView         = new WizardView();
            var   ContextMediator    = new ContextMediator();

            LogWindow.DataContext = LogWindowViewModel;
            LogWindow.Show();
            //LogWindow



            var SubStep1 = new ExecutableWizardStepBuilder()
                           .SetName("SubStep1.1")
                           .SetDescription("description for substep 1.1")
                           .SetReadOnly(false)
                           .SetSelectable(true)
                           .AddAction((s, c, o) =>
            {
                try
                {
                }
                catch (System.Exception)
                {
                    throw;
                }
                finally
                {
                }
            })
                           .Build();

            var SubStep2 = new ExecutableWizardStepBuilder()
                           .SetName("SubStep1.2")
                           .SetDescription("description for substep 1.2")
                           .SetReadOnly(false)
                           .SetSelectable(true)
                           .AddAction((s, c, o) =>
            {
                try
                {
                }
                catch (System.Exception)
                {
                    throw;
                }
                finally
                {
                }
            })
                           .Build();

            var SubSubStep1 = new ExecutableWizardStepBuilder()
                              .SetName("SubSubStep1.3.1")
                              .SetDescription("description for subsubstep 1.3.1")
                              .SetReadOnly(false)
                              .SetSelectable(true)
                              .AddAction((s, c, o) =>
            {
                try
                {
                }
                catch (System.Exception)
                {
                    throw;
                }
                finally
                {
                }
            })
                              .Build();

            var SubSubStep2 = new ExecutableWizardStepBuilder()
                              .SetName("SubSubStep1.3.2")
                              .SetDescription("description for subsubstep 1.3.2")
                              .SetReadOnly(false)
                              .SetSelectable(true)
                              .AddAction((s, c, o) =>
            {
                try
                {
                }
                catch (System.Exception)
                {
                    throw;
                }
                finally
                {
                }
            })
                              .Build();

            var GrouppedStep1_3 = new WizardStepGroupBuilder()
                                  .SetName("SubGruop1.3")
                                  .SetDescription("description for subgroup 1.3")
                                  .AddChildren(SubSubStep1)
                                  .AddChildren(SubSubStep2)
                                  .Build();

            var GrouppedStep1 = new WizardStepGroupBuilder()
                                .SetName("Group1")
                                .SetDescription("description for subgroup 1")
                                .AddChildren(SubStep1)
                                .AddChildren(SubStep2)
                                .AddChildren(GrouppedStep1_3)
                                .Build();

            var Step2 = new ExecutableWizardStepBuilder()
                        .SetName("Step2")
                        .SetIconName("Settings")
                        .SetDescription("description for step 2")
                        .SetReadOnly(false)
                        .SetSelectable(true)
                        .AddBoundedStep(SubSubStep1)
                        .AddBoundedStep(GrouppedStep1)
                        .AddAction((s, c, o) =>
            {
                try
                {
                }
                catch (System.Exception)
                {
                    throw;
                }
                finally
                {
                }
            })
                        .Build();

            var SubStep3_1 = new ExecutableWizardStepBuilder()
                             .SetName("SubStep3.1")
                             .SetDescription("description for substep 3.1")
                             .SetReadOnly(false)
                             .SetSelectable(true)
                             .AddAction((s, c, o) =>
            {
                try
                {
                }
                catch (System.Exception)
                {
                    throw;
                }
                finally
                {
                }
            })
                             .Build();

            var GrouppedStep3 = new WizardStepGroupBuilder()
                                .SetName("Group3")
                                .SetDescription("description for group 3")
                                .AddChildren(SubStep3_1)
                                .Build();
            var Step4 = new ExecutableWizardStepBuilder()
                        .SetName("Step4")
                        .SetIconName("Settings")
                        .SetDescription("description for step 2")
                        .SetReadOnly(false)
                        .SetSelectable(true)
                        .AddAction((s, c, o) =>
            {
                try
                {
                }
                catch (System.Exception)
                {
                    throw;
                }
                finally
                {
                }
            })
                        .Last(true)
                        .Build();

            var TestData = new TestData();
            var SettingsGroupsContainer = new SettingsGroupsContainer(
                new SettingsGroup("Group 1",
                                  new DoubleSetting()
            {
                Name = "Setting1.1", Dimention = "Hz", Visible = true
            },
                                  new IntSetting()
            {
                Name = "Setting1.2", Dimention = "Ohm", Visible = true
            }),
                new SettingsGroup("Group 2",
                                  new DoubleSetting()
            {
                Name = "Setting2.1", Dimention = "dB", Visible = true
            },
                                  new IntSetting()
            {
                Name = "Setting2.2", Dimention = "Sec", Visible = true
            }),
                new SettingsGroup("Group 3",
                                  new DoubleSetting()
            {
                Name = "Setting3.1", Dimention = "mV", Visible = true
            },
                                  new IntSetting()
            {
                Name = "Setting3.2", Dimention = "Rad", Visible = true
            }));

            var InstrumentalViewModel = new InstrumentalViewModel("Модуль приборов", "appbar_power", ContextMediator, new SignalAnalyzer(), new SignalGenerator());
            var SettingsViewModel     = new SettingsViewModel("Модуль настроек", "appbar_settings", ContextMediator, SettingsGroupsContainer.SettingsGroups);
            var MeasurementsViewModel = new MeasurementsViewModel("Автоматический режим", "appbar_axis_x", ContextMediator, TestData)
            {
                SettingsList = SettingsGroupsContainer.SettingsGroups
            };
            var DataBaseViewModel = new DataBaseViewModel("База данных", "appbar_database", ContextMediator);
            var LogsViewModel     = new LogsViewModel("Лог", "appbar_disk", ContextMediator);

            var SetupWizard = new SetupWizardBuilder()
                              .AddStep(GrouppedStep1)
                              .AddStep(Step2)
                              .AddStep(GrouppedStep3)
                              .AddStep(Step4)
                              .ConfigureWizard()
                              .Build();

            LogWindow.DataContext        = LogWindowViewModel;
            InstrumentalView.DataContext = InstrumentalViewModel;
            SettingsView.DataContext     = SettingsViewModel;
            MeasurementsView.DataContext = MeasurementsViewModel;
            DataBaseView.DataContext     = DataBaseViewModel;
            LogsView.DataContext         = LogsViewModel;
            WizardView.DataContext       = SetupWizard;

            var CalibrationViewModel = new CalibrationViewModel("Модуль калибровки", "appbar_scale", ContextMediator, WizardView, SetupWizard);

            CalibrationView.DataContext = CalibrationViewModel;

            ContextMediator
            .AddModuleReference(InstrumentalViewModel)
            .AddModuleReference(SettingsViewModel)
            .AddModuleReference(CalibrationViewModel)
            .AddModuleReference(MeasurementsViewModel)
            .AddModuleReference(DataBaseViewModel)
            .AddModuleReference(LogsViewModel);

            shell
            .AddView(InstrumentalView)
            .AddView(SettingsView)
            .AddView(CalibrationView)
            .AddView(MeasurementsView)
            .AddView(DataBaseView)
            .AddView(LogsView);


            //var mainWindow = new MainWindow();
            //mainWindow.DataContext = shell;
        }
コード例 #7
0
 private void Control_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     _calibration = e.NewValue as CalibrationViewModel;
 }