Ejemplo n.º 1
0
		protected override bool Save()
		{
			if (UserName == "debug")
			{
				ServiceFactoryBase.Events.GetEvent<ShowGKDebugEvent>().Publish(null);
				return false;
			}
			if (UserName == "Integrate")
			{
				ShellIntegrationHelper.Integrate();
				return false;
			}
			if (UserName == "Desintegrate")
			{
				ShellIntegrationHelper.Desintegrate();
				Process.Start("explorer.exe");
				return false;
			}
			Close(true);
			IsCanceled = false;
			switch (_passwordViewType)
			{
				case PasswordViewType.Connect:
					var preLoadWindow = new ConnectionViewModel();
					DialogService.ShowWindow(preLoadWindow);
					Message = ClientManager.Connect(ClientType, ConnectionSettingsManager.ServerAddress, UserName, Password);
					preLoadWindow.ForceClose();
					break;
				case PasswordViewType.Validate:
					Message = HashHelper.CheckPass(Password, ClientManager.CurrentUser.PasswordHash) ? null : "Неверный пароль";
					break;
			}
			IsConnected = string.IsNullOrEmpty(Message);
			if (CanSavePassword && IsConnected)
			{
				Settings.Default.UserName = UserName;
				Settings.Default.Password = SavePassword ? Password : string.Empty;
				Settings.Default.SavePassword = SavePassword;
				Settings.Default.Save();
			}
			return true;
		}
Ejemplo n.º 2
0
 private void DoConnect()
 {
     ConnectionViewModel preLoadWindow = new ConnectionViewModel() { Title = "Соединение с сервером..." };
     DialogService.ShowWindow(preLoadWindow);
     Message = FiresecManager.Connect(ClientType, GetServerAddress(), UserName, Password);
     preLoadWindow.ForceClose();
 }