Example #1
0
        private void InitaliseCommands()
        {
            StartGameCommand = ReactiveCommand.Create();
            StartGameCommand.Subscribe(arg => StartGameCommandHandler());

            ResetCommand = ReactiveCommand.Create();
            ResetCommand.Subscribe(arg => ResetCommandHandler());

            StopGameCommand = ReactiveCommand.Create();
            StopGameCommand.Subscribe(arg => StopGameWindowHandler());

            OpenNewGameWindow = ReactiveCommand.Create();
            OpenNewGameWindow.Subscribe(arg => OpenNewGameWindowHandler());

            FlipCommand = ReactiveCommand.Create();
            FlipCommand.Subscribe(arg => FlipCommandHandler());

            UndoCommand = ReactiveCommand.Create();
            UndoCommand.Subscribe(arg => UndoCommandHandler());

            AcceptScoreCommand = ReactiveCommand.Create();
            AcceptScoreCommand.Subscribe(arg => AcceptScoreCommandHandler());

            RejectScoreCommand = ReactiveCommand.Create();
            RejectScoreCommand.Subscribe(arg => RejectScoreCommandHandler());
        }
        protected AdvancedOptionSettingsViewModelBase(string name, string optionsCategory, SettingsController controller)
            : base(name, controller)
        {
            _advancedOptionsCategory = optionsCategory;

            ResetCommand.Subscribe(OnReset);
            ResetAllCommand.Subscribe(OnResetAll);
        }
Example #3
0
        public DcsOptionCategoryViewModel(string name, string categoryId, SettingsController controller)
            : base(name, controller)
        {
            _categoryId = categoryId;

            SelectedInstall.Subscribe(OnSelectedInstallChanged);
            ResetCommand.Subscribe(OnReset);
            ResetAllCommand.Subscribe(OnResetAll);
        }
Example #4
0
        public SelectManyDemoVm()
        {
            Items       = new ObservableCollection <ItemVm>().AllDisposedBy(this);
            SelectedIds = new ObservableCollection <string>  {
                "2", "5", "8", "1111", "11115", "22229", "StamItem"
            };
            Initialize();
            SelectionCommand  = MvvmRx.CreateCommand <IEnumerable <String> >(this);
            RandomFiveCommand = MvvmRx.CreateCommand(this);
            RemoveSelected    = MvvmRx.CreateCommand <IEnumerable>(this);
            ResetCommand      = MvvmRx.CreateCommand(this);
            ClearCommand      = MvvmRx.CreateCommand(this);

            SelectionCommand.Select(ienum => ienum.ToObservableCollection()).ApplyOnProperty(this, x => x.SelectedIds);
            RandomFiveCommand.Subscribe(_ =>
            {
                var rnd   = new Random();
                var items = Enumerable.Range(0, 5).Select(__ => Items[rnd.Next(Items.Count)].Uid);
                SelectedIds.AddRange(items);
            }).DisposedBy(this);

            RemoveSelected.Subscribe(x =>
            {
                foreach (var item in x.OfType <string>().ToArray())
                {
                    SelectedIds.Remove(item);
                }
            }).DisposedBy(this);

            ResetCommand.Subscribe(_ =>
            {
                var rnd     = new Random();
                var ids     = Items.Select(x => x.Uid).Where(x => rnd.Next(40) < 2).ToObservableCollection();
                SelectedIds = ids;
            }).DisposedBy(this);

            ClearCommand.Subscribe(_ =>
            {
                Items.Clear();
            }).DisposedBy(this);
        }