public void AddCommandToChain(AbilityCommandInfo slaveCommand) { if (CommandSequence == 0) { if (NextCommand == null) { NextCommand = slaveCommand; slaveCommand.LastCommand = this; } else { NextCommand.AddCommandToChain(slaveCommand); } } else { if (slaveCommand.CommandSequence < CommandSequence) { LastCommand.NextCommand = slaveCommand; slaveCommand.LastCommand = LastCommand; LastCommand = slaveCommand; slaveCommand.NextCommand = this; } else if (NextCommand == null) { NextCommand = slaveCommand; slaveCommand.LastCommand = this; } else { NextCommand.AddCommandToChain(slaveCommand); } } }
/// <summary> /// Initialize the view model. /// </summary> public ZeroPressureSensorViewModel() : base("Zero Pressure Sensor") { // Initialize values _events = IoC.Get <IEventAggregator>(); _pm = IoC.Get <PulseManager>(); _adcpConnection = IoC.Get <AdcpConnection>(); // Next command NextCommand = ReactiveCommand.Create(); NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.DeployAdcpView))); // Back coommand BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back))); // Exit coommand ExitCommand = ReactiveCommand.Create(); ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); // Zero Pressure sensor command ZeroPressureSensorCommand = ReactiveCommand.Create(); ZeroPressureSensorCommand.Subscribe(_ => ZeroPressureSensor()); InitializeValue(); }
private void NextAction(object o) { TransitionerIndex++; PreviousCommand.RaiseCanExecuteChanged(); NextCommand.RaiseCanExecuteChanged(); CreateCommand.RaiseCanExecuteChanged(); }
/// <summary> /// Initialize the view model. /// </summary> public BottomTrackOnViewModel() : base("Bottom Track On") { // Initialize values _events = IoC.Get <IEventAggregator>(); _pm = IoC.Get <PulseManager>(); ConfigKey = ""; // Create the list CreateList(); // Next command NextCommand = ReactiveCommand.Create(); NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.BinsView, ConfigKey))); // Back coommand BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back))); // Exit coommand ExitCommand = ReactiveCommand.Create(); ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); MovingCommand = ReactiveCommand.Create(); MovingCommand.Subscribe(_ => MovingBoat()); MovingCommand = ReactiveCommand.Create(); MovingCommand.Subscribe(_ => MonitoringAdcp()); }
/// <summary> /// Create a base view for all the Averaging Views. /// </summary> public AveragingBaseViewModel() : base("AvergingBaseViewModel") { // Project Manager _pm = IoC.Get <PulseManager>(); _pm.RegisterDisplayVM(this); _events = IoC.Get <IEventAggregator>(); _events.Subscribe(this); // Initialize the dict _averagingVMDict = new ConcurrentDictionary <SubsystemDataConfig, AveragingViewModel>(); // Create the ViewModels based off the AdcpConfiguration AddConfigurations(); // Next command NextCommand = ReactiveCommand.Create(); NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SimpleCompassCalWizardView))); // Back coommand BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back))); // Exit coommand ExitCommand = ReactiveCommand.Create(); ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); }
// コンストラクタ public ConfigureApiKeyViewModel(DialogService dialogService, AddAccountService addAccountModel) { // DI _dialogService = dialogService; _addAccountService = addAccountModel; // バリデーションを有効化する ConsumerKey.SetValidateAttribute(() => ConsumerKey); ConsumerSecret.SetValidateAttribute(() => ConsumerSecret); // ConsumerKeyとConsumerKeyが正しく入力されているときのみ「次へ」を押せるようにする NextCommand = new[] { ConsumerKey.ObserveHasErrors, ConsumerSecret.ObserveHasErrors } .CombineLatestValuesAreAllFalse() .ToReactiveCommand() .AddTo(Disposables); // 「次へ」が押されたらPinコード設定画面を開く NextCommand .Subscribe(() => { _addAccountService.OpenAuthorizeUrl(ConsumerKey.Value, ConsumerSecret.Value); _dialogService.OpenConfigurePincodeView(); }) .AddTo(Disposables); }
/// <summary> /// Initialize the view model. /// </summary> public TemperatureViewModel() : base("Salinity") { // Initialize values _events = IoC.Get <IEventAggregator>(); _pm = IoC.Get <PulseManager>(); // Next command NextCommand = ReactiveCommand.Create(); NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.TimeView))); // Back coommand BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back))); // Exit coommand ExitCommand = ReactiveCommand.Create(); ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); // Salinity coommand SalinityCommand = ReactiveCommand.Create(); SalinityCommand.Subscribe(param => OnSalinityCommand(param)); InitializeValue(); }
/// <summary> /// Initialize the view model. /// </summary> public TimeViewModel() : base("ADCP Time") { // Initialize values _events = IoC.Get <IEventAggregator>(); _pm = IoC.Get <PulseManager>(); // Initialize the list TimeZoneList = new ReactiveList <AdcpTimeZoneOptions>(); TimeZoneList.Add(new AdcpTimeZoneOptions(RTI.Commands.AdcpTimeZone.LOCAL, "Local", true)); TimeZoneList.Add(new AdcpTimeZoneOptions(RTI.Commands.AdcpTimeZone.GMT, "GMT", false)); // Next command NextCommand = ReactiveCommand.Create(); NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.EnsembleIntervalView))); // Back coommand BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back))); // Exit coommand ExitCommand = ReactiveCommand.Create(); ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); // Local Date Time Command SetLocalDateTimeCommand = ReactiveCommand.Create(); SetLocalDateTimeCommand.Subscribe(_ => SetLocalDateTime()); // GMT Date Time Command SetGmtDateTimeCommand = ReactiveCommand.Create(); SetGmtDateTimeCommand.Subscribe(_ => SetGmtDateTime()); InitializeValue(); }
/// <summary> /// Initialize the view model. /// </summary> public FrequencyViewModel() : base("Frequency ViewModel") { // Initialize values _events = IoC.Get <IEventAggregator>(); _pm = IoC.Get <PulseManager>(); // Next command NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.SelectedSubsystem, x => x.Value != null)); NextCommand.Subscribe(_ => OnNextCommand()); // Back coommand BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back))); // Exit coommand ExitCommand = ReactiveCommand.Create(); ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); FreqCommand = ReactiveCommand.Create(); FreqCommand.Subscribe(param => AddConfig(param)); // Set the possible subsystems SetSubsystems(); }
// コンストラクタ public ConfigurePincodeViewModel(DialogService dialogService, AddAccountService addAccountModel) { // DI _dialogService = dialogService; _addAccountService = addAccountModel; // バリデーションを有効化する Pincode.SetValidateAttribute(() => Pincode); // Pincodeが入力されているときのみ「次へ」を押せるようにする NextCommand = Pincode .ObserveHasErrors .Select(x => !x) .ToReactiveCommand() .AddTo(Disposables); // 「次へ」が押されたらPinコードの認証を開始する NextCommand.Subscribe(() => { _addAccountService.ConfigureAccessTokens(Pincode.Value); _dialogService.CloseConfigurePincodeView(); _dialogService.CloseConfigureApiKeyView(); }) .AddTo(Disposables); }
public ConfirmRecoveryWordsViewModel(List <RecoveryWordViewModel> mnemonicWords, KeyManager keyManager) { var confirmationWordsSourceList = new SourceList <RecoveryWordViewModel>(); _isSkipEnable = Services.WalletManager.Network != Network.Main || System.Diagnostics.Debugger.IsAttached; var nextCommandCanExecute = confirmationWordsSourceList .Connect() .ObserveOn(RxApp.MainThreadScheduler) .WhenValueChanged(x => x.IsConfirmed) .Select(_ => confirmationWordsSourceList.Items.All(x => x.IsConfirmed)); EnableBack = true; NextCommand = ReactiveCommand.Create(() => OnNext(keyManager), nextCommandCanExecute); if (_isSkipEnable) { SkipCommand = ReactiveCommand.Create(() => NextCommand.Execute(null)); } CancelCommand = ReactiveCommand.Create(OnCancel); confirmationWordsSourceList .Connect() .ObserveOn(RxApp.MainThreadScheduler) .OnItemAdded(x => x.Reset()) .Sort(SortExpressionComparer <RecoveryWordViewModel> .Ascending(x => x.Index)) .Bind(out _confirmationWords) .Subscribe(); // Select random words to confirm. confirmationWordsSourceList.AddRange(mnemonicWords.OrderBy(_ => new Random().NextDouble()).Take(3)); }
/// <summary> /// Initialize the view model. /// </summary> public VesselMountViewModel() : base("Vessel Mount ViewModel") { // Initialize values _events = IoC.Get <IEventAggregator>(); _events.Subscribe(this); _pm = IoC.Get <PulseManager>(); // Get the singleton ADCP connection _adcpConnection = IoC.Get <AdcpConnection>(); // Get Options GetOptions(); // Set the list CommPortList = SerialOptions.PortOptions; BaudRateList = SerialOptions.BaudRateOptions; // Next command NextCommand = ReactiveCommand.Create(); NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.AveragingView))); // Back coommand BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back))); // Exit coommand ExitCommand = ReactiveCommand.Create(); ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); // Set the lists InitLists(); InitValues(); }
internal INextResult Next(int threadId) { var cmd = new NextCommand(threadId); Session.Next(cmd); return(cmd.Result); }
/// <summary> /// Select whether to playback a file or a project. /// </summary> public SelectPlaybackViewModel() : base("Select Playback") { // Initialize values _pm = IoC.Get <PulseManager>(); _events = IoC.Get <IEventAggregator>(); // Initialize values IsLoading = false; // Next command NextCommand = ReactiveCommand.Create(); NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ViewDataView))); // Back coommand BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back))); // Exit coommand ExitCommand = ReactiveCommand.Create(); ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); // Select a file to playback FilePlaybackCommand = ReactiveCommand.Create(); FilePlaybackCommand.Subscribe(_ => PlaybackFile()); // Project coommand ProjectPlaybackCommand = ReactiveCommand.Create(); ProjectPlaybackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.LoadProjectsView))); }
public void When(NextCommand cmd) { var agg = _repository.GetById <SampleAggregate, Sample>(cmd.Id); agg.Next(cmd.SomeDate); _repository.Save(agg); }
/// <summary> /// Intialize the view model. /// </summary> public CommunicationViewModel() : base("Communications") { // Set Event Aggregator _events = IoC.Get <IEventAggregator>(); _pm = IoC.Get <PulseManager>(); // Get the singleton ADCP connection _adcpConnection = IoC.Get <AdcpConnection>(); // Initialize the values InitValues(); // Set the list CommPortList = SerialOptions.PortOptions; BaudRateList = SerialOptions.BaudRateOptions; // Next command NextCommand = ReactiveCommand.Create(); NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ScanAdcpView))); // Back coommand BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back))); // Exit coommand ExitCommand = ReactiveCommand.Create(); ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); // Scan for ADCP command ScanAdcpCommand = ReactiveCommand.Create(); ScanAdcpCommand.Subscribe(_ => ScanForAdcp()); }
public void StepOver() { NextCommand nextCommand = new NextCommand(); nextCommand.InBackground = true; ExecuteCommand(nextCommand); }
/// <summary> /// Initialize the view model. /// </summary> public ScanAdcpViewModel() : base("Scan ADCP") { // Initialize values _events = IoC.Get <IEventAggregator>(); _pm = IoC.Get <PulseManager>(); _adcpConnection = IoC.Get <AdcpConnection>(); // Serial Number Generator view model SerialNumberGeneratorVM = IoC.Get <SerialNumberGeneratorViewModel>(); SerialNumberGeneratorVM.UpdateEvent += SerialNumberGeneratorVM_UpdateEvent; // Next command NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsScanning, x => !x.Value)); NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ModeView))); // Back coommand BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back))); // Exit coommand ExitCommand = ReactiveCommand.Create(); ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); // Scan ADCP command ScanAdcpCommand = ReactiveCommand.CreateAsyncTask(_ => ScanAdcp()); InitializeValue(); }
public override void FinishParsingGetCommand() { ParseName(); if (ObjData.Name.Equals("all", StringComparison.OrdinalIgnoreCase)) { NextCommand.Cast <IGetCommand>().GetAll = true; } else if ((ActorRoom.Uid == 4 || ActorRoom.Uid == 20 || ActorRoom.Uid == 22) && ObjData.Name.IndexOf("torch", StringComparison.OrdinalIgnoreCase) >= 0) { gOut.Print("All torches are bolted to the wall and cannot be removed."); NextState = Globals.CreateInstance <IMonsterStartState>(); } else { ObjData.RecordWhereClauseList = new List <Func <IGameBase, bool> >() { r => r is IArtifact a && a.IsInRoom(ActorRoom), r => r is IArtifact a && a.IsEmbeddedInRoom(ActorRoom), r => r is IArtifact a && (a.IsCarriedByContainerContainerTypeExposedToCharacter(gEngine.ExposeContainersRecursively) || a.IsCarriedByContainerContainerTypeExposedToRoom(ActorRoom, gEngine.ExposeContainersRecursively)) }; ObjData.RecordNotFoundFunc = NextCommand.PrintCantVerbThat; ResolveRecord(false); } } }
public void Done() { _connectedUasManager.Active.Transport.SendMessage(UasCommands.PreflightCalibration(_connectedUasManager.Active.Uas.SystemId, _connectedUasManager.Active.Uas.ComponentId, 0, 0, 0, 0, 2, 0, 0)); BeginCommand.RaiseCanExecuteChanged(); CancelCommand.RaiseCanExecuteChanged(); DoneCommand.RaiseCanExecuteChanged(); NextCommand.RaiseCanExecuteChanged(); }
public BuffCommandInfo GetSubcommand(byte commandSeq) { if (CommandSequence == commandSeq) { return(this); } return(NextCommand?.GetSubcommand(commandSeq)); }
public void Run_ShouldDontThrowExceptions() { var command = new NextCommand(); _nextHandler.Run(command); _taskRepository.Verify(_ => _.GetAll(), Times.Once); }
private void RaiseCommandCanExecuteChanged() { PlayCommand.RaiseCanExecuteChanged(); PauseCommand.RaiseCanExecuteChanged(); StopCommand.RaiseCanExecuteChanged(); NextCommand.RaiseCanExecuteChanged(); PreviousCommand.RaiseCanExecuteChanged(); RaisePropertyChanged(nameof(CurrentMedia)); }
public LoginViewModel() { IsLoading = Visibility.Collapsed; Messenger.Default.Register <GenericMessage <string> >(this, MessengerTokens.PressEnterToLoginToken, act => { NextCommand.Execute(null); }); }
protected override void OnModelChanged() { NextCommand.RaiseCanExecuteChanged(); PreviousCommand.RaiseCanExecuteChanged(); FirstCommand.RaiseCanExecuteChanged(); LastCommand.RaiseCanExecuteChanged(); RaisePropertyChanged(nameof(TotalPages)); }
/// <summary> /// Adds a command to the command sequence, linking the previous command's damage information. /// </summary> public void AddCommandToChainWithDamage(AbilityCommandInfo slaveCommand) { if (CommandSequence == 0) { if (NextCommand == null || slaveCommand.CommandSequence == CommandSequence) { NextCommand = slaveCommand; slaveCommand.LastCommand = this; if (DamageInfo != null) { slaveCommand.DamageInfo = DamageInfo.Clone(); } else { slaveCommand.DamageInfo = LastCommand.DamageInfo.Clone(); } } else { NextCommand.AddCommandToChainWithDamage(slaveCommand); } } else { if (slaveCommand.CommandSequence < CommandSequence) { LastCommand.NextCommand = slaveCommand; slaveCommand.LastCommand = LastCommand; LastCommand = slaveCommand; slaveCommand.NextCommand = this; if (slaveCommand.LastCommand.DamageInfo != null) { slaveCommand.DamageInfo = slaveCommand.LastCommand.DamageInfo.Clone(); } } else if (NextCommand == null) { NextCommand = slaveCommand; slaveCommand.LastCommand = this; if (DamageInfo != null) { slaveCommand.DamageInfo = DamageInfo.Clone(); } else { slaveCommand.DamageInfo = LastCommand.DamageInfo.Clone(); } } else { NextCommand.AddCommandToChainWithDamage(slaveCommand); } } }
private void StartExecute(object o) { HockeyClient.Current.TrackEvent("Start"); History.Clear(); Next(); NextCommand.OnCanExecuteChanged(); StopCommand.OnCanExecuteChanged(); ((Button)o)?.Focus(FocusState.Programmatic); }
private void NotifyCanExecuteCommands() { if (NextCommand == null || SaveCommand == null) { return; } NextCommand.NotifyCanExecuteChanged(); SaveCommand.NotifyCanExecuteChanged(); }
private void SetFrameContent() { var item = this.PrevViewStack.Pop(); this.FrameContent = item; this.NextViewStack.Push(item); CompleteCommand.RaiseCanExecuteChanged(); PreviousCommand.RaiseCanExecuteChanged(); NextCommand.RaiseCanExecuteChanged(); }
public ValidationViewModel() { // null is success(have no error), string is error message ValidationData = new ReactiveProperty <string>() .SetValidateNotifyError((string s) => !string.IsNullOrEmpty(s) && s.Cast <char>().All(Char.IsUpper) ? null : "not all uppercase"); // async validation // first argument is self observable sequence // null is success(have no error), IEnumerable is error messages ValidationNotify = new ReactiveProperty <string>("foo!", ReactivePropertyMode.RaiseLatestValueOnSubscribe) .SetValidateNotifyError(self => self .Delay(TimeSpan.FromSeconds(3)) // asynchronous validation... .Select(s => string.IsNullOrEmpty(s) ? null : "not empty string")); // both validation ValidationBoth = new ReactiveProperty <string>() .SetValidateNotifyError(s => !string.IsNullOrEmpty(s) && s.Cast <char>().All(Char.IsLower) ? null : "not all lowercase") .SetValidateNotifyError(self => self .Delay(TimeSpan.FromSeconds(1)) // asynchronous validation... .Select(s => string.IsNullOrEmpty(s) || s.Length <= 5 ? null : (IEnumerable) new[] { "length 5" })); // Validation result is pushed to ObserveErrors var errors = new[] { ValidationData.ObserveErrorChanged, ValidationBoth.ObserveErrorChanged, ValidationNotify.ObserveErrorChanged } .CombineLatest(); // Use OfType, choose error source ErrorInfo = errors .SelectMany(x => x) .Where(x => x != null) .Select(x => x.OfType <string>()) .Select(x => x.FirstOrDefault()) .ToReactiveProperty(); // Validation is view initialized not run in default. // If want to validate on view initialize, // use ReactivePropertyMode.RaiseLatestValueOnSubscribe to ReactiveProperty // that mode is validate values on initialize. NextCommand = new[] { ValidationData.ObserveHasErrors, ValidationBoth.ObserveHasErrors, ValidationNotify.ObserveHasErrors } .CombineLatestValuesAreAllFalse() .ToReactiveCommand(); this.AlertMessage = NextCommand.Select(_ => "Can go to next!").ToReactiveProperty( initialValue: "Can go to next!", mode: ReactivePropertyMode.None); }