Пример #1
0
		public static void OnUserChanged(UserChangedEventArgs userChangedEventArgs)
		{
			if (userChangedEventArgs.IsReconnect)
			{
				FiresecManager.FiresecService.GKAddMessage(EventName.Смена_пользователя, userChangedEventArgs.OldName + " вышел. " + userChangedEventArgs.NewName + " вошел");
			}
			else
			{
				FiresecManager.FiresecService.GKAddMessage(EventName.Вход_пользователя_в_систему, "");
			}
		}
Пример #2
0
		void OnChangeUser()
		{
			var oldUserName = UserName;
			var result = ServiceFactory.LoginService.ExecuteReconnect();
			if (result)
			{
				var userChangedEventArgs = new UserChangedEventArgs()
				{
					IsReconnect = true,
					OldName = oldUserName,
					NewName = UserName
				};
				ServiceFactory.Events.GetEvent<UserChangedEvent>().Publish(userChangedEventArgs);
			}
		}
Пример #3
0
		public bool Initialize()
		{
			var result = true;
			LoadingErrorManager.Clear();
			AppConfigHelper.InitializeAppSettings();
			ServiceFactory.Initialize(new LayoutService(), new SecurityService());
			ServiceFactory.ResourceService.AddResource(new ResourceDescription(typeof(Bootstrapper).Assembly, "DataTemplates/Dictionary.xaml"));

			if (ServiceFactory.LoginService.ExecuteConnect(App.Login, App.Password))
			{
				var userChangedEventArgs = new UserChangedEventArgs
				{
					IsReconnect = false
				};
				ServiceFactory.Events.GetEvent<UserChangedEvent>().Publish(userChangedEventArgs);
				App.Login = ServiceFactory.LoginService.Login;
				App.Password = ServiceFactory.LoginService.Password;
				try
				{
					CreateModules();

					LoadingService.ShowLoading("Чтение конфигурации", 15);
					LoadingService.AddCount(GetModuleCount());

					LoadingService.DoStep("Синхронизация файлов");
					FiresecManager.UpdateFiles();

					LoadingService.DoStep("Загрузка конфигурации с сервера");
					FiresecManager.GetConfiguration("Monitor/Configuration");

					GKDriversCreator.Create();
					BeforeInitialize(true);

					LoadingService.DoStep("Старт полинга сервера");
					FiresecManager.StartPoll(false);

					LoadingService.DoStep("Проверка прав пользователя");
					if (FiresecManager.CheckPermission(PermissionType.Oper_Login))
					{
						LoadingService.DoStep("Загрузка клиентских настроек");
						ClientSettings.LoadSettings();
						Notifier.Initialize();

						result = Run();
						SafeFiresecService.ConfigurationChangedEvent += () => { ApplicationService.Invoke(OnConfigurationChanged); };
					}
					else
					{
						MessageBoxService.Show("Нет прав на работу с программой");
						FiresecManager.Disconnect();
					}
					LoadingService.Close();

					if (result)
						AterInitialize();

					//MutexHelper.KeepAlive();
					ProgressWatcher.Run();
					if (Process.GetCurrentProcess().ProcessName != "FireMonitor.vshost")
					{
						RegistrySettingsHelper.SetBool("isException", true);
					}
				}
				catch (Exception e)
				{
					Logger.Error(e, "Bootstrapper.InitializeFs");
					MessageBoxService.ShowException(e);
					if (Application.Current != null)
						Application.Current.Shutdown();
					return false;
				}
			}
			else
			{
				if (Application.Current != null)
					Application.Current.Shutdown();
				return false;
			}
			return result;
		}
Пример #4
0
		void OnUserChanged(UserChangedEventArgs userChangedEventArgs)
		{
			OnPropertyChanged("HasPermission");
		}
Пример #5
0
		void OnUserChanged(UserChangedEventArgs userChangedEventArgs)
		{
			OnPropertyChanged("UserName");
		}
        private async void OnUserRemoved(UserWatcher sender, UserChangedEventArgs e)
        {
            User user = e.User;

            // UI work must happen on the UI thread.
            await rootPage.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
            {
                // Look for the user in our collection and remove it.
                UserViewModel model = FindModelByUserId(user.NonRoamableId);
                if (model != null)
                {
                    Users.Remove(model);
                }
            });
        }
        private async void OnUserUpdated(UserWatcher sender, UserChangedEventArgs e)
        {
            User user = e.User;

            // UI work must happen on the UI thread.
            await rootPage.Dispatcher.RunAsync(CoreDispatcherPriority.Low, async () =>
            {
                // Look for the user in our collection and update the display name.
                UserViewModel model = FindModelByUserId(user.NonRoamableId);
                if (model != null)
                {
                    model.DisplayName = await GetDisplayNameOrGenericNameAsync(user);
                }
            });
        }
        private async void OnUserAdded(UserWatcher sender, UserChangedEventArgs e)
        {
            User user = e.User;

            // UI work must happen on the UI thread.
            await rootPage.Dispatcher.RunAsync(CoreDispatcherPriority.Low, async () =>
            {
                // Create the user with "..." as the temporary display name.
                // Add it right away, because it might get removed while the
                // "await GetDisplayNameOrGenericNameAsync()" is running.
                var model = new UserViewModel(user.NonRoamableId, "\u2026");
                Users.Add(model);

                // Try to get the display name.
                model.DisplayName = await GetDisplayNameOrGenericNameAsync(user);
            });
        }
 private void OnSelectedUserChanged(object sender, UserChangedEventArgs userChangedEventArgs)
 {
     User = userChangedEventArgs.User;
 }