コード例 #1
0
        // IRemoteControl remoteControl;

        public Stand()
        {
            Settings = new Settings();
            Settings.Load();
            progress = new Progress();
            progress.ProgressChanged += (obj, val) => ProgressEvent(this, val);
            SystemStatus              = new SystemStatus();
        }
コード例 #2
0
        public void Init(IDialogService dialogService)
        {
            try
            {
                this.dialogService = dialogService;
                if (!CheckMetrologicPart())
                {
                    this.dialogService.ErrorMessage("Внимание! Метрологически значимая часть была изменена. " +
                                                    "Для получения более подробной информации откройте меню \"О программе\"");
                }
                Exception = null;
                var psysCommands = new PsysCommandSimulator();
                // var psysCommands = new Commands(Settings.PsysSettings.IP, 49002);
                psys = new PressSystem(psysCommands, Settings.PsysSettings.MaxTimeSetPressure);
                SystemStatus.Init(Settings);
                psys.ExceptionEvent    += Exception_psys_event;
                psys.ConnectEvent      += SystemStatus.PressSysten_ConnectEvent;
                psys.DisconnectEvent   += SystemStatus.PressSystemDisconnectEvent;
                psys.BeginConnectEvent += SystemStatus.PressSystem_BeginConnectEvent;
                metrologicGroups        = new MetrologicGroups(Settings.JsonReportSettings.StandId);
                savingResults           = new SavingResults(Settings, SystemStatus);
                remoteControl?.Dispose();

                if (!Settings.UsedRemoteControl)
                {
                    processErrorHandler = new ErrorHandler(Settings, SystemStatus, dialogService);
                    ReadPsysInfo();
                }
                else
                {
                    processErrorHandler = new ErrorHandlerRemoteControlMode(Settings, SystemStatus);
                    if (Settings.RemoteControlVer == "v2.0")
                    {
                        remoteControl = new RemoteControl(this, Settings.RemoteControlIp, 49003, System.Text.Encoding.UTF8, metrologicGroups);
                    }
                    else
                    {
                        remoteControl = new RemoteControl(this, Settings.RemoteControlIp, 49003, System.Text.Encoding.Unicode, metrologicGroups);
                    }
                    remoteControl.StartListening();
                }
                // throw new Exception();
            }
            catch (PressSystemException ex)
            {
                Exception = ex;
                dialogService.ErrorMessage("Не удалось установить связь со стойкой давления по запросу. Проверьте состояние ее готовности  " +
                                           "и нажмите кнопку \"Установить связь со стойкой давления\". Или измените настройки в меню \"Система\"");
            }
            catch (Exception ex)
            {
                Exception = ex;
                dialogService.ErrorMessage(ex.Message);
            }
        }
コード例 #3
0
        public SavingResults(Settings settings, SystemStatus sysStatus)
        {
            this.settings  = settings;
            this.sysStatus = sysStatus;
            var jsonSettings = settings.JsonReportSettings;

            archiving = new ArchivingProcess(jsonSettings.ArchivingPath, jsonSettings.MaxCommunicationBreakWithArchive,
                                             jsonSettings.UsedFtp, jsonSettings.FtpLogin, jsonSettings.FtpPassword);
            archiving.SuccessfulCopyToServerEvent += Archiving_SuccessfulCopyToServerEvent;
            archiving.StartTracking();
            db = new ProductDb(settings.PathToDb, settings.DbPassword);
        }
コード例 #4
0
 public ErrorHandler(Settings settings, SystemStatus sysStatus, IDialogService dialogService)
 {
     this.settings      = settings;
     this.sysStatus     = sysStatus;
     this.dialogService = dialogService;
 }
コード例 #5
0
 public ErrorHandlerRemoteControlMode(Settings settings, SystemStatus sysStatus) :
     base(settings, sysStatus, null)
 {
 }