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);
        }
Esempio n. 2
0
 public BaseEvent()
 {
     Actions = new ObservableCollection <BaseAction>();
     //Commands
     AddActionToEvent      = new ParamCommand(AddAction, null);
     RemoveActionFromEvent = new ParamCommand(RemoveAction, null);
 }
Esempio n. 3
0
 private void AddCommands()
 {
     AddObject             = new ParamCommand(addObjectEntity, null);
     AddSprite             = new ParamCommand(addSprite, null);
     AddScreen             = new ParamCommand(addScreen, null);
     DoubleClickedOnEntity = new ParamCommand(openEntity, null);
 }
Esempio n. 4
0
 public InspectorViewModel()
 {
     noSelectedNode       = new EntityDummy();
     SetEntityNameOnEnter = new ActionCommand(SetEntityName, CanSetEntityName);
     AddEventToObject     = new ParamCommand(AddEvent, CanAddEvent);
     //Register message
     Messenger.Default.Register <SelectedItemChangeMessage>(this, ChangedSelectedProjectTreeItem);
 }
Esempio n. 5
0
 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;
        }
Esempio n. 7
0
        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;
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        public void GivenParamCommand_WhenCheckingForCanExec_ThenItReturnsTrue()
        {
            paramsCommandRelayerSubject = new RelayCommand <object>(o => TEST_OUTPUT += "1");

            Assert.True(ParamCommand.CanExecute(null));
        }
Esempio n. 11
0
 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);
 }