Пример #1
0
        public FormMain()
        {
            InitializeComponent();

            _svcMonitor = new ServiceMonitor("TsManager");
            _svcMonitor.AppendEnabledWhenStarted(tsmiStop, false);
            _svcMonitor.AppendEnabledWhenStarted(tsbStop, false);
            _svcMonitor.AppendEnabledWhenStarted(tsmiRestart, true);
            _svcMonitor.AppendEnabledWhenStopped(tsmiStart);
            _svcMonitor.AppendEnabledWhenStopped(tsbStart);
            _svcMonitor.AppendStatus(tsslServiceStatus);
            _svcMonitor.StartMonitor();

            _logicLoader = new AMCSLogicLoader(TsGlobalConst.GetACMSLogicDirectory());

            LoadGUISettings();
            LoadSettings();
            BuildTreeFromSettings();

            _eventsViewLink = new ListedEventsViewLink(lvLog, _appSettings.FilterSettings,
                                                       _appSettings.LogColumns, true);

            _eventsViewLink.AddCommandItem(tsmiReloadEvents, EventsViewCommand.Update);
            _eventsViewLink.AddCommandItem(toolStripButton1, EventsViewCommand.Update);
            _eventsViewLink.AddCommandItem(tsmiDetails, EventsViewCommand.Details);
            _eventsViewLink.AddCommandItem(tsmiViewFilter, EventsViewCommand.Filter);
            _eventsViewLink.SourceConnector = new LogConnector(tsslUpdateProgress);
            _eventsViewLink.Update();
        }
Пример #2
0
 private void LoadSettings()
 {
     _settings = GenericSerializer.Deserialize <TsManagerSettings>(
         TsGlobalConst.GetSettingsFile(), false, _logicLoader.GetLogicSettingsTypes());
     _modified = false;
     SettingsControlsEnabled();
 }
Пример #3
0
 private void SaveSettings()
 {
     GenericSerializer.Serialize <TsManagerSettings>(_settings,
                                                     TsGlobalConst.GetSettingsFile(), _logicLoader.GetLogicSettingsTypes());
     _modified = false;
     SettingsControlsEnabled();
 }
Пример #4
0
        protected override void OnStart(string[] args)
        {
            // создаем журнал событий
            _eventLink = new EventLink(TsGlobalConst.GetLogDirectory());
            try
            {
                _eventLink.Post(TsGlobalConst.EventSource, string.Format(
                                    "Сервис менеджера турникетов, версия {0}",
                                    VersionInfoHelper.GetVersion(Assembly.GetExecutingAssembly())));

                // создаем менеджер турникетов
                _manager = new global::TsManager.TsManager(_eventLink);

                // запуск менеджера
                _eventLink.Post(TsGlobalConst.EventSource, "Запуск менеджера турникетов");
                _manager.Start();

                _eventLink.Post(TsGlobalConst.EventSource, "Сервис запущен");
            }
            catch (Exception e)
            {
                _eventLink.Post(TsGlobalConst.EventSource, "Старт сервиса", e);
                Stop();
            }
        }
Пример #5
0
 private void LoadGUISettings()
 {
     _appSettings = GenericSerializer.Deserialize <TsManagerConfiguratorSettings>(
         TsGlobalConst.GetAppSettingsFile());
     Left   = _appSettings.Left;
     Top    = _appSettings.Top;
     Width  = _appSettings.Width;
     Height = _appSettings.Height;
     splitContainer3.SplitterDistance = _appSettings.Splitter1;
     splitContainer2.SplitterDistance = _appSettings.Splitter2;
 }
Пример #6
0
        private void SaveGUISettings()
        {
            if (WindowState != FormWindowState.Minimized)
            {
                _appSettings.Left   = Left;
                _appSettings.Top    = Top;
                _appSettings.Width  = Width;
                _appSettings.Height = Height;
            }
            _appSettings.Splitter1 = splitContainer3.SplitterDistance;
            _appSettings.Splitter2 = splitContainer2.SplitterDistance;

            GenericSerializer.Serialize <TsManagerConfiguratorSettings>(_appSettings,
                                                                        TsGlobalConst.GetAppSettingsFile());
        }
Пример #7
0
 public void OpenConnector()
 {
     Dispose();
     _log = new EventLink(TsGlobalConst.GetLogDirectory(), true);
 }