Esempio n. 1
0
        public MasterViewModel(
            IComService comService,
            IGrblStatus grblStatus,
            ICommandSender commandSender,
            IGrblDispatcher grblDispatcher,
            IApplicationSettingsService applicationSettingsService,
            IGCodeFileService gCodeFileService)
        {
            _grblDispatcher             = grblDispatcher;
            _applicationSettingsService = applicationSettingsService;
            _applicationSettingsService.Upgrade();
            _applicationSettingsService.Load();

            ComConnectionViewModel = new COMConnectionViewModel(comService, applicationSettingsService);
            _comService            = comService;
            _grblStatus            = grblStatus;
            _commandSender         = commandSender;
            _gCodeFileService      = gCodeFileService;

            _grblStatus.GrblStatusModel.MachineStateChanged += GrblStatusModelMachineStateChanged;
            _grblStatus.GrblStatusModel.PropertyChanged     += GrblStatusModelPropertyChanged;
            _comService.ConnectionStateChanged       += ComServiceConnectionStateChanged;
            _commandSender.CommunicationLogUpdated   += CommandSenderCommunicationLogUpdated;
            _commandSender.CommandQueueLengthChanged += CommandSenderCommandQueueLengthChanged;

            _commandSender.FileCommands.CommandList.CollectionChanged += (sender, args) =>
            {
                NotifyOfPropertyChange(() => FileLinesProcessed);
            };

            StartNotifications();
        }
Esempio n. 2
0
 public GrblDispatcher(IComService comService, IGrblPrompt grblPrompt, IGrblStatus grblStatus)
 {
     _grblStatus = grblStatus;
     grblPrompt.PromptReceived         += GrblPromptPromptReceived;
     comService.ConnectionStateChanged += ComServiceConnectionStateChanged;
 }