public BaseIOViewModel(SelectedSettings settings, string portName, ILoggerFacade logger)
 {
     this.logger = logger;
     this.settings = settings;
     this.portName = portName;
     StopCommand = new DelegateCommand(OnStop);
 }
 private void OnChangeSelectedSettings(SelectedSettings obj)
 {
     SettingsName = obj.SettingsInfo.Name;
     MemoryType = obj.MemoryType;
     Processor = obj.SettingsInfo.Processor.Name;
     hasError = false;
 }
Exemple #3
0
        public IOManager(ISettingsRepository settingsRepository, IEventAggregator eventAggregator, ILoggerFacade logger)
        {
            this.settingsRepository = settingsRepository;
            this.eventAggregator = eventAggregator;
            this.logger = logger;
            settings = null;
            port = null;
            files = null;

            Subscribe();
            RegisterCommand();
        }
Exemple #4
0
        public ResetViewModel(SelectedSettings settings, string portName, ILoggerFacade logger)
            : base(settings, portName, logger)
        {
            Text = Resources.TextReset;
            taskm = new TaskManager<bool>((taskManager) =>
            {
                return (new ResetWorkerMaster(portName, settings.SettingsInfo.SerialPortSettings, logger)).Run(taskManager);
            });

            taskm.Canceled += taskm_Canceled;
            taskm.Completed += taskm_Completed;
            taskm.Faulted += taskm_Faulted;
            taskm.Started += taskm_Started;

            taskm.Start();
        }
        public ConnectionViewModel(SelectedSettings settings, string portName, ILoggerFacade logger)
            : base(settings, portName, logger)
        {
            Text = Resources.TextConnection;
            taskm = new TaskManager<Tuple<int, DateTime>>((taskManager) =>
            {
                return (new ConnectionWorkerMaster(portName, settings.SettingsInfo.SerialPortSettings, logger)).Run(taskManager);
            });

            taskm.Canceled += taskm_Canceled;
            taskm.Completed += taskm_Completed;
            taskm.Faulted += taskm_Faulted;
            taskm.Started += taskm_Started;

            taskm.Start();
        }
Exemple #6
0
        public ReadViewModel(SelectedSettings settings, string portName, ILoggerFacade logger)
            : base(settings, portName, logger)
        {
            Text = string.Format(Resources.TextAnalysis, GetMemoryType());
            taskmIsEmptyPage = new TaskManager<List<int>, double>((taskManager) =>
            {
                return (new IsEmptyPageWorkerMaster(portName, settings.SettingsInfo.SerialPortSettings, logger,
                    settings.MemoryType, settings.SettingsInfo.Processor)).Run(taskManager);
            });

            taskmIsEmptyPage.Canceled += taskmIsEmptyPage_Canceled;
            taskmIsEmptyPage.Completed += taskmIsEmptyPage_Completed;
            taskmIsEmptyPage.Faulted += taskmIsEmptyPage_Faulted;
            taskmIsEmptyPage.Started += taskmIsEmptyPage_Started;
            taskmIsEmptyPage.Progressed += taskmIsEmptyPage_Progressed;

            taskmIsEmptyPage.Start();
        }
Exemple #7
0
        public WriteViewModel(SelectedSettings settings, string portName, ILoggerFacade logger, IMemory memory)
            : base(settings, portName, logger)
        {
            Text = string.Format(Resources.TextWrite, GetMemoryType());
            taskm = new TaskManager<bool, double>((taskManager) =>
            {
                return (new WritePageWorkerMaster(portName, settings.SettingsInfo.SerialPortSettings, logger,
                    settings.MemoryType, settings.SettingsInfo.Processor, memory)).Run(taskManager);
            });

            taskm.Canceled += taskm_Canceled;
            taskm.Completed += taskm_Completed;
            taskm.Faulted += taskm_Faulted;
            taskm.Started += taskm_Started;
            taskm.Progressed += taskm_Progressed;

            taskm.Start();
        }
Exemple #8
0
 private void OnChangeSelectedSettings(SelectedSettings obj)
 {
     settings = obj;
     RaiseCanExecuteChanged();
 }
        public void SettingsInfoToString()
        {
            SettingsInfo si = new SettingsInfo(0, "Name",
                new Processor(0, "Name", 0x1000, 0x40000, 0x3E000, 0x3FFFF),
                new SerialPortSettings(BaudRate.BR_57600, Parity.Even, StopBits.One, 0xA0, 0xA5));

            Console.WriteLine(si.ToString());
            Console.WriteLine(si.ToString("LOG", null));

            SelectedSettings ss = new SelectedSettings(MemoryType.FLASH, si);

            Console.WriteLine(ss.ToString());
            Console.WriteLine(ss.ToString("LOG", null));
        }
 private void OnChangeSelectedSettings(SelectedSettings obj)
 {
     MemoryType = obj.MemoryType == Service.Settings.Enums.MemoryType.FLASH;
 }
        private void OnChangeSelectedSettings(SelectedSettings obj)
        {
            settings = obj;

            if (!firstTimeSettings)
            {
                firstTimeSettings = true;

                openFileCommand = new DelegateCommand(OnOpenFile, OnCanOpenFile);

                GlobalCommands.OpenHexFileCommand.RegisterCommand(openFileCommand);

                saveFileCommand = new DelegateCommand(OnSaveFile, OnCanSaveFile);
                GlobalCommands.SaveHexFileCommand.RegisterCommand(saveFileCommand);

                saveAllFilesCommand = new DelegateCommand(OnSaveAllFiles, OnCanSaveAllFiles);
                GlobalCommands.SaveAllHexFilesCommand.RegisterCommand(saveAllFilesCommand);

                closeFileCommand = new DelegateCommand(OnCloseFile, OnCanCloseFile);
                GlobalCommands.CloseHexFileCommand.RegisterCommand(closeFileCommand);

                closeAllFilesCommand = new DelegateCommand(OnCloseAllFiles, OnCanCloseAllFiles);
                GlobalCommands.CloseAllHexFilesCommand.RegisterCommand(closeAllFilesCommand);

                compareFilesCommand = new DelegateCommand(OnCompareFiles, OnCanCompareFiles);
                GlobalCommands.CompareHexFilesCommand.RegisterCommand(compareFilesCommand);

                eventAggregator.GetEvent<AddNewFileEvent>().Subscribe(OnAddNewFile);
            }
            else
            {
                while (Files.Count != 0)
                {
                    Close(ActiveDocument);
                }
            }
        }