Пример #1
0
 private static void RegisterState(string StateName, State StateClass)
 {
     if (StateName == "")
         Debug.LogError("StateName has to be a valid string.");
     else if (StateClass == null)
         Debug.LogError("StateFactory.RegisterState - StateClass must not be null.");
     else
     {
         if (m_States.ContainsKey(StateName))
             Debug.LogWarning("State" + StateName + "already exists");
         else
             m_States.Add(StateName, StateClass);
     }
 }
        /// <summary>
        /// Creates an instance of the REPL engine ViewModel.
        /// </summary>
        /// <param name="replState">Reactive extensions stream of the REPL engine state.</param>
        /// <param name="replOutput">Reactive extensions stream of the REPL engine output.</param>
        /// <param name="replError">Reactive extensions stream of the REPL engine errors.</param>
        /// <param name="workingDirectory">Reactive extensions stream of the REPL engine working directory.</param>
        /// <param name="processService">Handles starting windows processes.</param>
        public ReplEngineViewModel(IObservable<State> replState,
            IObservable<ReplLineViewModel> replOutput,
            IObservable<ReplLineViewModel> replError,
            string workingDirectory,
            IProcessService processService)
        {
            _workingDirectory = workingDirectory;
            _processService = processService;
            _state = Core.State.Unknown;
            _output = new ObservableCollection<ReplLineViewModel>();

            _reset = new Subject<Unit>();
            _execute = new Subject<string>();

            ClearCommand = new ReplRelayCommand(Clear, CanClear);
            ResetCommand = new ReplRelayCommand(ResetImpl, CanReset);
            ExecuteCommand = new ReplRelayCommand<string>(ExecuteImpl, CanExecute);
            OpenWorkingFolderCommand = new ReplRelayCommand(OpenWorkingFolder);

            _disposable = new CompositeDisposable
            {
                Disposable.Create(() =>
                                  {
                                        ClearCommand = null;
                                        ResetCommand = null;
                                        ExecuteCommand = null;
                                  }),
                _reset,
                _execute,
                replState.Subscribe(UpdateState),
                replOutput.Where(x => x.Value != Prompt)
                    .Subscribe(x =>
                    {
                        _output.Add(x);
                        CommandManager.InvalidateRequerySuggested();
                    }),
                replError.Where(x => x.Value != Prompt)
                    .Subscribe(x =>
                    {
                        _output.Add(x);
                        CommandManager.InvalidateRequerySuggested();
                    })
            };
        }
        private void UpdateState(State state)
        {
            if (_state != state)
            {
                Debug.WriteLine("state = " + state);

                _state = state;
                OnPropertyChanged("State");
                OnPropertyChanged("Prompt");
                OnPropertyChanged("IsReadOnly");
            }
        }
Пример #4
0
 private bool hasProductWithUser(State S, Product P, User U)
 {
     foreach (Product pr in S.Products)
     {
         if (pr.Equals(P))
         {
             foreach (User usr in pr.Users)
             {
                 if (usr.Equals(U))
                     return true;
             }
         }
     }
     return false;
 }
Пример #5
0
 protected override void OnStart(string[] args)
 {
     eventLog1.WriteEntry("Work began");
     State stt = new State("\\\\venera\\autodesk_lic_status\\status_venera.txt");
 }