Example #1
0
        public String Statistic(String cmdType, String arg1, String arg2)
        {
            ICommand cmd;

            if (cmdType == "Sum")
            {
                ISum sum = SumFactory.GetCommand(arg1, arg2);
                cmd = new SumCommand(sum);
            }
            else if (cmdType == "Average")
            {
                IAverage average = AverageFactory.GetCommand(arg1, arg2);
                cmd = new AverageCommand(average);
            }
            else if (cmdType == "Max")
            {
                IMax max = MaxFactory.GetCommand(arg1, arg2);
                cmd = new MaxCommand(max);
            }
            else
            {
                IMin min = MinFactory.GetCommand(arg1, arg2);
                cmd = new MinCommand(min);
            }

            String res = CommandInvoker.DoCommand(cmd);

            return(res);
        }
Example #2
0
 protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
 {
     if (MaxButtonVisibility == Visibility.Visible)
     {
         MaxCommand.Execute(null);
     }
     base.OnMouseDoubleClick(e);
 }
        public CountNotifierViewModel()
        {
            CountNotifierStatus = CountNotifier.Select(item => Enum.GetName(typeof(CountChangedStatus), item)).ToReactiveProperty().AddTo(DisposeCollection);
            CountNotifierCount  = CountNotifier.Select(item => CountNotifier.Count).ToReactiveProperty().AddTo(DisposeCollection);

            CountNotifier
            .ObserveOnUIDispatcher()
            .Where(item => CountChangedStatus.Max.Equals(item))
            .Where(_ => MessageBoxResult.Yes.Equals(MessageBox.Show("Maxになりましたが元に戻しますか?", "確認", MessageBoxButton.YesNo)))
            .Subscribe(_ => beforeOperation.Dispose())
            .AddTo(DisposeCollection);

            Decrement1Command.ObserveOnUIDispatcher().Subscribe(_ => CountNotifier.Decrement(1)).AddTo(DisposeCollection);
            Decrement10Command.ObserveOnUIDispatcher().Subscribe(_ => CountNotifier.Decrement(10)).AddTo(DisposeCollection);
            DecrementNCommand.ObserveOnUIDispatcher().Subscribe(_ => CountNotifier.Decrement(DecrementN.Value)).AddTo(DisposeCollection);
            Increment1Command.ObserveOnUIDispatcher().Subscribe(_ => beforeOperation  = CountNotifier.Increment(1)).AddTo(DisposeCollection);
            Increment10Command.ObserveOnUIDispatcher().Subscribe(_ => beforeOperation = CountNotifier.Increment(10)).AddTo(DisposeCollection);
            IncrementNCommand.ObserveOnUIDispatcher().Subscribe(_ => beforeOperation  = CountNotifier.Increment(IncrementN.Value)).AddTo(DisposeCollection);
            MaxCommand.ObserveOnUIDispatcher().Subscribe(_ => beforeOperation         = CountNotifier.Increment(CountNotifier.Max)).AddTo(DisposeCollection);
            EmptyCommand.ObserveOnUIDispatcher().Subscribe(_ => CountNotifier.Decrement(CountNotifier.Max)).AddTo(DisposeCollection);
        }