public MainWindowViewModel() { EdgeLocalStateFilePath.SetValidateNotifyError(IsExitisFile); EdgeCookiesFilePath.SetValidateNotifyError(IsExitisFile); ChromeLocalStateFilePath.SetValidateNotifyError(IsExitisFile); ChromeCookiesFilePath.SetValidateNotifyError(IsExitisFile); ObsCookiesFilePath.SetValidateNotifyError(IsExitisFile); EdgeCommand = new[] { EdgeLocalStateFilePath.ObserveHasErrors, EdgeCookiesFilePath.ObserveHasErrors, ObsCookiesFilePath.ObserveHasErrors }.CombineLatestValuesAreAllFalse().ToReactiveCommand <Models.CommandParameter>(); ChromeCommand = new[] { ChromeLocalStateFilePath.ObserveHasErrors, ChromeCookiesFilePath.ObserveHasErrors, ObsCookiesFilePath.ObserveHasErrors }.CombineLatestValuesAreAllFalse().ToReactiveCommand <Models.CommandParameter>(); LocalStateFilePath.SetValidateNotifyError(IsExitisFile); SrcCookieFilePath.SetValidateNotifyError(IsExitisFile); DestCookieFilePath.SetValidateNotifyError(IsExitisFile); HostKey.SetValidateNotifyError(host => { if (String.IsNullOrWhiteSpace(host)) { return("Empty"); } return(null); }); ParamCommand = new[] { LocalStateFilePath.ObserveHasErrors, SrcCookieFilePath.ObserveHasErrors, HostKey.ObserveHasErrors, DestCookieFilePath.ObserveHasErrors }.CombineLatestValuesAreAllFalse().ToReactiveCommand <Models.CommandParameter>(); EdgeCommand.Subscribe(ExecuteCommand.Execute); ChromeCommand.Subscribe(ExecuteCommand.Execute); ParamCommand.Subscribe(ExecuteCommand.Execute); OkCommand.Subscribe(async _ => { Executing.Value = true; try { await System.Threading.Tasks.Task.Run(() => { CookieManager.Converter.Convert(Environment.ExpandEnvironmentVariables(Param.LocalStateFilePath), Environment.ExpandEnvironmentVariables(Param.SrcCookieFilePath), Param.HostKey, Environment.ExpandEnvironmentVariables(Param.DestCookieFilePath)); }); } catch { IsErrorDialogOpen.Value = true; } Executing.Value = false; IsDialogOpen.Value = false; } ); ExecuteCommand.Subscribe(param => { IsDialogOpen.Value = true; Param = param; }); CancelCommand.Subscribe(_ => IsDialogOpen.Value = false); ErrorOkCommand.Subscribe(_ => IsErrorDialogOpen.Value = false); }
public BaseEvent() { Actions = new ObservableCollection <BaseAction>(); //Commands AddActionToEvent = new ParamCommand(AddAction, null); RemoveActionFromEvent = new ParamCommand(RemoveAction, null); }
private void AddCommands() { AddObject = new ParamCommand(addObjectEntity, null); AddSprite = new ParamCommand(addSprite, null); AddScreen = new ParamCommand(addScreen, null); DoubleClickedOnEntity = new ParamCommand(openEntity, null); }
public InspectorViewModel() { noSelectedNode = new EntityDummy(); SetEntityNameOnEnter = new ActionCommand(SetEntityName, CanSetEntityName); AddEventToObject = new ParamCommand(AddEvent, CanAddEvent); //Register message Messenger.Default.Register <SelectedItemChangeMessage>(this, ChangedSelectedProjectTreeItem); }
public void addParameter(ParameterDef paramDef, ParamCommand paramCmd) { OgrePINVOKE.ParamDictionary_addParameter(swigCPtr, ParameterDef.getCPtr(paramDef), ParamCommand.getCPtr(paramCmd)); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public MainSplitted_ViewModel() { cmdCloseFlyOut = new NoParamCommand(CloseFlyOut); cmdSaveToGallery = new NoParamCommandAsync(SaveToGallery); cmdDismissEntry = new ParamCommand <Data.Data1>(DismissEntryAsync); cmdEnlargePicture = new NoParamCommand(EnlargePicture); Reddit_Entries = Task.Run(() => _model.LoadEntriesAsync(Services.SuspensionManager.PointerTo_ListOfEntries)).Result; //FF: Cant and doesnt need to be awaited as the UI will be notified when the IObservableCollection is filled SelectedEntry = Services.SuspensionManager.PointerTo_SelectedEntry; }
public void GivenSimpleCommandParams_WhenInvokingCommand3Times_ThenItExecute3Action() { TEST_OUTPUT = String.Empty; paramsCommandRelayerSubject = new RelayCommand <object>(s => TEST_OUTPUT += s as string); ; for (int i = 0; i < 3; i++) { ParamCommand.Execute("5"); } Assert.Equal("555", TEST_OUTPUT); }
public MainViewModel() { LoadCommand = new AsyncCommand(LoadAsync); SaveCommand = new DefaultCommand(Save); DeploayCommand = new AsyncCommand(DeployAsync); BuildSolutionCommand = new AsyncCommand(BuildSolutionAsync); DirCommand = new ParamCommand <string>(SetDeployPath); Configuration = new ConfigData(); Data = new ObservableCollection <ProjectData>(); service = ApplicationProvider.GetInstance <DTE>(); tfsServer = ApplicationProvider.GetInstance <ITeamFoundationServerService>(); service.Events.SolutionEvents.Opened += _Opened; service.Events.SolutionEvents.BeforeClosing += _BeforeClosing; }
public void GivenSimpleCommandParamsAndCanExec_WhenInvokingCommand_ThenItExecuteBasedOnOutsideState() { string expected = "MODIFIED"; TEST_OUTPUT = "NOT_MODIFIED"; bool canExecute = false; paramsCommandRelayerSubject = new RelayCommand <object>(s => TEST_OUTPUT = s as string, s => { return(canExecute); }); if (ParamCommand.CanExecute(null)) { ParamCommand.Execute(expected); } Assert.NotEqual(expected, TEST_OUTPUT); canExecute = true; if (ParamCommand.CanExecute(null)) { ParamCommand.Execute(expected); } Assert.Equal(expected, TEST_OUTPUT); }
public void GivenParamCommand_WhenCheckingForCanExec_ThenItReturnsTrue() { paramsCommandRelayerSubject = new RelayCommand <object>(o => TEST_OUTPUT += "1"); Assert.True(ParamCommand.CanExecute(null)); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ParamCommand obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }