private void InitGUI() { //Character Select List <ParamCharaController> controllers = DBControllerManager.GetAllController(); charaSelect = new CharaSelect(DBControllerManager._controllers, "No character loaded", 0, 25); //Enbale Checkbox controllEnable = new ToggleEnabled("Enable controller", false); //Coordinate Select ChaFileDefine.CoordinateType[] coordinateList = new ChaFileDefine.CoordinateType[] { ChaFileDefine.CoordinateType.School01, ChaFileDefine.CoordinateType.School02, ChaFileDefine.CoordinateType.Gym, ChaFileDefine.CoordinateType.Swim, ChaFileDefine.CoordinateType.Club, ChaFileDefine.CoordinateType.Plain, ChaFileDefine.CoordinateType.Pajamas, }; List <string> coordinateStringList = new List <string>(); for (int i = 0; i < coordinateList.Count(); i++) { coordinateStringList.Add(coordinateList[i].ToString()); } coordinateSelect = new CoordinateSelect(coordinateStringList.ToArray(), coordinateList, "", 175, 25); //State Select kindSelect = new SelectableButton <ParamCharaController.ParamsKind>(Color.cyan); //Parameter editors editorBust = new EditorBust(); editorHip = new EditorHip(); //Tools Window tools = new ToolsWindow(_toolsWindowId, _s_dialogID, this); //GUI Style styleMatchState = new GUIStyle(Skin.defaultSkin.button); styleMatchState.fixedHeight = 25; }
public AccountPanelViewModel() { SetNewPassword = ReactiveCommand.CreateFromObservable( () => SetNewPasswordImpl(_newPassword), this.WhenAnyValue(vm => vm.User, vm => vm.NewPassword, (user, password) => user != null && password.HasValue())); SetNewSimplePassword = ReactiveCommand.CreateFromObservable(SetNewSimplePasswordImpl); SetNewComplexPassword = ReactiveCommand.CreateFromObservable(SetNewComplexPasswordImpl); ExpirePassword = ReactiveCommand.CreateFromObservable(() => Messages.Handle(new MessageInfo(MessageType.Question, "Are you sure you want to expire the password?", "Expire password?", "Yes", "No")) .Where(result => result == 0) .SelectMany(_ => _adFacade.ExpirePassword(User.Principal.SamAccountName))); UnlockAccount = ReactiveCommand.CreateFromObservable(() => _adFacade.UnlockUser(User.Principal.SamAccountName)); RunLockoutStatus = ReactiveCommand.Create(() => ExecutionService.RunFileFromCache("LockoutStatus", "LockoutStatus.exe", $"-u:{_adFacade.CurrentDomain}\\{User.Principal.SamAccountName}")); OpenPermittedWorkstations = ReactiveCommand.CreateFromObservable(() => _dialogRequests.Handle(new DialogInfo(new PermittedWorkstationsDialog(), _user.Principal.SamAccountName))); ToggleEnabled = ReactiveCommand.CreateFromObservable(() => _adFacade.SetEnabled(User.Principal.SamAccountName, !User.Principal.Enabled ?? true)); OpenSplunk = ReactiveCommand.Create(() => { Process.Start(string.Format(Locator.Current.GetService <SettingsFacade>().SplunkUrl, _adFacade.CurrentDomainShortName, User.Principal.SamAccountName)); }); this.WhenActivated(disposables => { SetNewPassword .ObserveOnDispatcher() .Do(_ => NewPassword = "") .SelectMany(newPass => _messages.Handle(new MessageInfo(MessageType.Success, $"New password is: {newPass}", "Password set"))) .Subscribe() .DisposeWith(disposables); SetNewSimplePassword .ObserveOnDispatcher() .SelectMany(newPass => _messages.Handle(MessageInfo.PasswordSetMessageInfo(newPass))) .Subscribe() .DisposeWith(disposables); SetNewComplexPassword .ObserveOnDispatcher() .SelectMany(newPass => _messages.Handle(MessageInfo.PasswordSetMessageInfo(newPass))) .Subscribe() .DisposeWith(disposables); ExpirePassword .SelectMany(_ => _messages.Handle(new MessageInfo(MessageType.Success, "User must change password at next login", "Password expired"))) .Subscribe() .DisposeWith(disposables); UnlockAccount .SelectMany(_ => { MessageBus.Current.SendMessage(_user.CN, ApplicationActionRequest.Refresh); return(_messages.Handle(new MessageInfo(MessageType.Success, "Account unlocked"))); }) .Subscribe() .DisposeWith(disposables); ToggleEnabled .Subscribe(_ => MessageBus.Current.SendMessage(_user.CN, ApplicationActionRequest.Refresh)) .DisposeWith(disposables); Observable.Merge( SetNewPassword.ThrownExceptions, SetNewSimplePassword.ThrownExceptions, SetNewComplexPassword.ThrownExceptions) .SelectMany(ex => _messages.Handle(MessageInfo.PasswordSetErrorMessageInfo(ex.Message))) .Subscribe() .DisposeWith(disposables); Observable.Merge <(string Title, string Message)>( ExpirePassword.ThrownExceptions.Select(ex => ("Could not expire password", ex.Message)), UnlockAccount.ThrownExceptions.Select(ex => ("Could not unlock acount", ex.Message)), RunLockoutStatus.ThrownExceptions.Select(ex => ("Could not open LockOutStatus", ex.Message)), OpenPermittedWorkstations.ThrownExceptions.Select(ex => ("Could not open Permitted Workstations", ex.Message)), ToggleEnabled.ThrownExceptions.Select(ex => ("Could not toggle enabled status", ex.Message))) .SelectMany(dialogContent => _messages.Handle(new MessageInfo(MessageType.Error, dialogContent.Message, dialogContent.Title))) .Subscribe() .DisposeWith(disposables); }); }