Ejemplo n.º 1
0
		public static void Run(bool loadConfiguation = true)
		{
			try
			{
				if (loadConfiguation)
				{
					ConfigurationManager.Load();
				}
				var resourceService = new ResourceService();
				resourceService.AddResource(new ResourceDescription(typeof(Bootstrapper).Assembly, "DataTemplates/Dictionary.xaml"));
				resourceService.AddResource(new ResourceDescription(typeof(ApplicationService).Assembly, "Windows/DataTemplates/Dictionary.xaml"));

				WindowThread = new Thread(new ThreadStart(OnWorkThread));
				WindowThread.Priority = ThreadPriority.Highest;
				WindowThread.SetApartmentState(ApartmentState.STA);
				WindowThread.IsBackground = true;
				WindowThread.Start();

				UILogger.Log("Открытие хоста");
				FS2ServiceHost.Start();
				UILogger.Log("Запуск мониторинга");
				MainManager.StartMonitoring();

				UILogger.Log("Готово");
				FSAgentLoadHelper.SetStatus(FSAgentState.Opened);
			}
			catch (Exception e)
			{
				Logger.Error(e, "Исключение при вызове Bootstrapper.Run");
				UILogger.Log("Ошибка при запуске сервера");
				Close();
			}
		}
Ejemplo n.º 2
0
		public override void RegisterResource()
		{
			base.RegisterResource();
			var resourceService = new ResourceService();
			resourceService.AddResource(new ResourceDescription(GetType().Assembly, "DataTemplates/Dictionary.xaml"));
			resourceService.AddResource(new ResourceDescription(GetType().Assembly, "Journal/DataTemplates/Dictionary.xaml"));
		}
Ejemplo n.º 3
0
		public static void Run()
		{
			try
			{
				Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
				FiresecDB.DatabaseHelper.ConnectionString = @"Data Source=" + AppDataFolderHelper.GetDBFile("Firesec.sdf") + ";Password=adm;Max Database Size=4000";
				Logger.Trace(SystemInfo.GetString());
				var resourceService = new ResourceService();
				resourceService.AddResource(new ResourceDescription(typeof(Bootstrapper).Assembly, "DataTemplates/Dictionary.xaml"));
				resourceService.AddResource(new ResourceDescription(typeof(ApplicationService).Assembly, "Windows/DataTemplates/Dictionary.xaml"));
				WindowThread = new Thread(new ThreadStart(OnWorkThread));
				WindowThread.Name = "Main window";
				WindowThread.Priority = ThreadPriority.Highest;
				WindowThread.SetApartmentState(ApartmentState.STA);
				WindowThread.IsBackground = true;
				WindowThread.Start();
				MainViewStartedEvent.WaitOne();

				UILogger.Log("Создание конфигурации ГК");
				GKProcessor.Create();
				UILogger.Log("Открытие хоста");
				FiresecServiceManager.Open();
				ServerLoadHelper.SetStatus(FSServerState.Opened);
				UILogger.Log("Запуск ГК");
				GKProcessor.Start();
				UILogger.Log("Готово");
			}
			catch (Exception e)
			{
				Logger.Error(e, "Исключение при вызове Bootstrapper.Run");
				UILogger.Log("Ошибка при запуске сервера");
				BalloonHelper.ShowFromServer("Ошибка во время загрузки");
				Close();
			}
		}
Ejemplo n.º 4
0
		public static void Run()
		{
			var resourceService = new ResourceService();
			resourceService.AddResource(new ResourceDescription(typeof(Bootstrapper).Assembly, "DataTemplates/Dictionary.xaml"));
			resourceService.AddResource(new ResourceDescription(typeof(ApplicationService).Assembly, "Windows/DataTemplates/Dictionary.xaml"));

			WindowThread = new Thread(new ThreadStart(OnWorkThread));
			WindowThread.Name = "GK OPC Main Window";
			WindowThread.Priority = ThreadPriority.Highest;
			WindowThread.SetApartmentState(ApartmentState.STA);
			WindowThread.IsBackground = true;
			WindowThread.Start();
			MainViewStartedEvent.WaitOne();

			UILogger.Log("Соединение с сервером");
			for (int i = 1; i <= 10; i++)
			{
				var message = FiresecManager.Connect(ClientType.OPC, ConnectionSettingsManager.ServerAddress, GlobalSettingsHelper.GlobalSettings.Login, GlobalSettingsHelper.GlobalSettings.Password);
				if (message == null)
					break;
				Thread.Sleep(5000);
				if (i == 10)
				{
					UILogger.Log("Ошибка соединения с сервером: " + message);
					return;
				}
			}

			InitializeGK();
			GKOPCManager.Start();
			UILogger.Log("Готово");
		}
Ejemplo n.º 5
0
		protected virtual void RegisterResource()
		{
			ResourceService resourceService = new ResourceService();
			resourceService.AddResource(new ResourceDescription(typeof(ApplicationService).Assembly, "Windows/DataTemplates/Dictionary.xaml"));
			resourceService.AddResource(new ResourceDescription(typeof(BaseBootstrapper).Assembly, "Login/DataTemplates/Dictionary.xaml"));
			resourceService.AddResource(new ResourceDescription(typeof(AboutViewModel).Assembly, "About/DataTemplates/Dictionary.xaml"));
			resourceService.AddResource(new ResourceDescription(typeof(LoginViewModel).Assembly, "DataTemplates/Dictionary.xaml"));
		}
Ejemplo n.º 6
0
		static ImitatorService()
		{
			ResourceService resourceService = new ResourceService();
			resourceService.AddResource(new ResourceDescription(typeof(ApplicationService).Assembly, "Windows/DataTemplates/Dictionary.xaml"));
            //resourceService.AddResource(new ResourceDescription(typeof(Controls.Converters.StateTypeToColorConverter).Assembly, "Themes/Styles.xaml"));
            //resourceService.AddResource(new ResourceDescription(typeof(Controls.Converters.StateTypeToColorConverter).Assembly, "Themes/ScrollBarStyle.xaml"));
            resourceService.AddResource(new ResourceDescription(typeof(ImitatorService).Assembly, "Imitator/DataTemplates/Dictionary.xaml"));
		}
Ejemplo n.º 7
0
		public static void Initialize(ILayoutService ILayoutService, ISecurityService ISecurityService)
		{
			ServiceFactoryBase.Events = Events = new EventAggregator();
			ServiceFactoryBase.SecurityService = SecurityService = ISecurityService;
			ResourceService = new ResourceService();
			Layout = ILayoutService;
			LoginService = new LoginService(ClientType.Monitor, "Оперативная задача. Авторизация.");
			ContentService = new ContentService("Monitor");
		}
Ejemplo n.º 8
0
 public static void Initialize(ILayoutService ILayoutService, ISecurityService ISecurityService)
 {
     Events = new EventAggregator();
     ResourceService = new ResourceService();
     Layout = ILayoutService;
     SecurityService = ISecurityService;
     LoginService = new LoginService(ClientType.Monitor, "Оперативная задача. Авторизация.");
     SubscribeEvents();
 }
Ejemplo n.º 9
0
 public static void Initialize(ILayoutService ILayoutService, IProgressService IProgressService, IValidationService IValidationService)
 {
     SaveService = new SaveService();
     Events = new EventAggregator();
     ResourceService = new ResourceService();
     Layout = ILayoutService;
     ProgressService = IProgressService;
     ValidationService = IValidationService;
     LoginService = new LoginService(ClientType.Administrator, "Администратор. Авторизация");
 }
Ejemplo n.º 10
0
		public static void Run()
		{
			var resourceService = new ResourceService();
			resourceService.AddResource(new ResourceDescription(typeof(Bootstrapper).Assembly, "DataTemplates/Dictionary.xaml"));
			resourceService.AddResource(new ResourceDescription(typeof(ApplicationService).Assembly, "Windows/DataTemplates/Dictionary.xaml"));

			var mainViewModel = new MainViewModel();
			ApplicationService.Run(mainViewModel, false, false);
			//Application.Current.MainWindow.BringIntoView();
		}
Ejemplo n.º 11
0
		protected override void OnStartup(StartupEventArgs e)
		{
			var resourceService = new ResourceService();
			resourceService.AddResource(new ResourceDescription(typeof(App).Assembly, "DataTemplates/Dictionary.xaml"));
			resourceService.AddResource(new ResourceDescription(typeof(ApplicationService).Assembly, "Windows/DataTemplates/Dictionary.xaml"));

			var mainView = new MainView();
			var mainViewModel = new MainViewModel();
			mainView.DataContext = mainViewModel;
			mainView.Show();
		}
Ejemplo n.º 12
0
		protected override void OnStartup(StartupEventArgs e)
		{
			var resourceService = new ResourceService();
			resourceService.AddResource(new ResourceDescription(typeof(App).Assembly, "DataTemplates/Dictionary.xaml"));
			resourceService.AddResource(new ResourceDescription(typeof(ApplicationService).Assembly, "Windows/DataTemplates/Dictionary.xaml"));

			ConfigurationManager.Load();

			var mainView = new MainView();
			var mainViewModel = new MainViewModel();
			mainView.DataContext = mainViewModel;
			mainView.Show();

			using (new DoubleLaunchLocker(SignalId, WaitId, true))
			{
				ServerFS2.Bootstrapper.Run(false);
			}
		}
Ejemplo n.º 13
0
		public static void Run()
		{
			try
			{
				DatabaseHelper.ConnectionString = @"Data Source=" + AppDataFolderHelper.GetDBFile("Firesec.sdf") + ";Password=adm;Max Database Size=4000";
				var resourceService = new ResourceService();
				resourceService.AddResource(new ResourceDescription(typeof(Bootstrapper).Assembly, "DataTemplates/Dictionary.xaml"));
				resourceService.AddResource(new ResourceDescription(typeof(ApplicationService).Assembly, "Windows/DataTemplates/Dictionary.xaml"));

				WindowThread = new Thread(new ThreadStart(OnWorkThread));
				WindowThread.Name = "Main Window";
				WindowThread.Priority = ThreadPriority.Highest;
				WindowThread.SetApartmentState(ApartmentState.STA);
				WindowThread.IsBackground = true;
				WindowThread.Start();
				if (!BootstrapperLoadEvent.WaitOne(TimeSpan.FromMinutes(5)))
				{
					BalloonHelper.ShowFromAgent("Ошибка во время загрузки. Истекло время ожидания загрузки окна");
				}
				BootstrapperLoadEvent = new AutoResetEvent(false);

				UILogger.Log("Открытие хоста");
				FSAgentServiceHost.Start();
				UILogger.Log("Соединение с драйвером");
				WatcherManager = new WatcherManager();
				WatcherManager.Start();

				if (!BootstrapperLoadEvent.WaitOne(TimeSpan.FromMinutes(5)))
				{
					BalloonHelper.ShowFromAgent("Ошибка во время загрузки. Истекло время ожидания загрузки драйверов");
					UILogger.Log("Ошибка во время загрузки. Истекло время ожидания загрузки драйверов");
				}
				UILogger.Log("Готово");
				FSAgentLoadHelper.SetStatus(FSAgentState.Opened);
			}
			catch (Exception e)
			{
				Logger.Error(e, "Исключение при вызове Bootstrapper.Run");
				UILogger.Log("Ошибка при запуске сервера");
				Close();
			}
		}
Ejemplo n.º 14
0
		public static void Run()
		{
			var resourceService = new ResourceService();
			resourceService.AddResource(new ResourceDescription(typeof(Bootstrapper).Assembly, "DataTemplates/Dictionary.xaml"));
			resourceService.AddResource(new ResourceDescription(typeof(ApplicationService).Assembly, "Windows/DataTemplates/Dictionary.xaml"));
		}
Ejemplo n.º 15
0
		public virtual void RegisterResource()
		{
			ResourceService resourceService = new ResourceService();
			resourceService.AddResource(new ResourceDescription(GetType().Assembly, "DataTemplates/Dictionary.xaml"));
		}
Ejemplo n.º 16
0
		public static void Initialize()
		{
			Events = new EventAggregator();
			ResourceService = new ResourceService();
			ContentService = new ContentService("Monitor");
		}