Exemple #1
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public MainWindowViewModel()
 {
     ConfirmationCommand.Subscribe(ConfirmationMethod).AddTo(Disposable);
     InformationCommand.Subscribe(_ => ShowInformationDialog("メッセージ", "タイトル", MessageBoxImage.Error)).AddTo(Disposable);
     OpenFileCommand.Subscribe(OpenFileMethod).AddTo(Disposable);
     SaveFileCommand.Subscribe(SaveFileMethod).AddTo(Disposable);
     ClosedCommand.Subscribe(Close).AddTo(Disposable);
 }
        public MainWindowViewModel()
        {
            Zero = settingModel.ToReactivePropertyAsSynchronized(x => x.Zero);

            One = settingModel.ToReactivePropertyAsSynchronized(x => x.One);

            Two = settingModel.ToReactivePropertyAsSynchronized(x => x.Two);

            Three = settingModel.ToReactivePropertyAsSynchronized(x => x.Three);

            Four = settingModel.ToReactivePropertyAsSynchronized(x => x.Four);

            Five = settingModel.ToReactivePropertyAsSynchronized(x => x.Five);

            Six = settingModel.ToReactivePropertyAsSynchronized(x => x.Six);

            Seven = settingModel.ToReactivePropertyAsSynchronized(x => x.Seven);

            Eight = settingModel.ToReactivePropertyAsSynchronized(x => x.Eight);

            Nine = settingModel.ToReactivePropertyAsSynchronized(x => x.Nine);

            Ten = settingModel.ToReactivePropertyAsSynchronized(x => x.Ten);

            Eleven = settingModel.ToReactivePropertyAsSynchronized(x => x.Eleven);

            Twelve = settingModel.ToReactivePropertyAsSynchronized(x => x.Twelve);

            Thirteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Thirteen);

            Fourteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Fourteen);

            Fifteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Fifteen);

            Sixteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Sixteen);

            Seventeen = settingModel.ToReactivePropertyAsSynchronized(x => x.Seventeen);

            Eighteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Eighteen);

            Nineteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Nineteen);

            Twenty = settingModel.ToReactivePropertyAsSynchronized(x => x.Twenty);

            Twentyone = settingModel.ToReactivePropertyAsSynchronized(x => x.Twentyone);

            Twentytwo = settingModel.ToReactivePropertyAsSynchronized(x => x.Twentytwo);

            Twentythree = settingModel.ToReactivePropertyAsSynchronized(x => x.Twentythree);

            OpenFileCommand.Subscribe(x => ButtonAction(x));

            PlayCommand.Subscribe(x => PlayAction(x));

            StartCommand.Subscribe(_ => StartAction());

            StopCommand.Subscribe(_ => StopAction());
        }
 public ExportCompletedViewModel(string title, FileInfo file)
 {
     Title             = title;
     File              = file;
     OpenFileCommand   = ReactiveCommand.Create(this.WhenAnyValue(me => me.File).Select(f => f?.Exists == true));
     OpenFolderCommand = ReactiveCommand.Create(this.WhenAnyValue(me => me.File).Select(f => f?.Directory?.Exists == true));
     OpenFileCommand.Subscribe(_ => Process.Start(File.FullName));
     OpenFolderCommand.Subscribe(_ => Process.Start(File.DirectoryName));
     Result = CloseCommand.Select(_ => (bool?)true);
 }
Exemple #4
0
        public MainViewModel(IOpenFileService openFileService)
        {
            this.openFileService = openFileService;
            OpenFileCommand      = ReactiveCommand.Create();
            OpenFileCommand.Subscribe(_ => OpenFromFile());


            var list       = new SourceList <string>();
            var listLoader = list.Connect()
                             .ObserveOnDispatcher()
                             .Bind(out linesCollection)
                             .Subscribe();

            var linesWriter = files
                              .Select(path =>
            {
                return(Observable.Using(() => new StreamReader(path, Encoding.Default), CreateObservableLines)
                       .Finally(() => list.Clear()));
            })
                              .Switch()
                              .Subscribe(line => list.Add(line));

            cleanUp = new CompositeDisposable(listLoader, linesWriter, list);
        }
Exemple #5
0
        public MainWindowViewModel()
        {
            Items = new List <TestItem>();

            for (int i = 0; i < 10; ++i)
            {
                Items.Add(new TestItem($"Item {i}", $"Item {i} Value"));
            }

            Nodes = new List <TestNode>
            {
                new TestNode
                {
                    Header     = "Root",
                    SubHeader  = "Root Item",
                    IsExpanded = true,
                    Children   = new[]
                    {
                        new TestNode
                        {
                            Header    = "Child 1",
                            SubHeader = "Child 1 Value",
                        },
                        new TestNode
                        {
                            Header     = "Child 2",
                            SubHeader  = "Child 2 Value",
                            IsExpanded = false,
                            Children   = new[]
                            {
                                new TestNode
                                {
                                    Header    = "Grandchild",
                                    SubHeader = "Grandchild Value",
                                },
                                new TestNode
                                {
                                    Header    = "Grandmaster Flash",
                                    SubHeader = "White Lines",
                                },
                            }
                        },
                    }
                }
            };



            CollapseNodesCommand = ReactiveCommand.Create();
            CollapseNodesCommand.Subscribe(_ => ExpandNodes(false));
            ExpandNodesCommand = ReactiveCommand.Create();
            ExpandNodesCommand.Subscribe(_ => ExpandNodes(true));

            OpenFileCommand = ReactiveCommand.Create();
            OpenFileCommand.Subscribe(_ =>
            {
                var ofd = new OpenFileDialog();

                ofd.ShowAsync();
            });

            OpenFolderCommand = ReactiveCommand.Create();
            OpenFolderCommand.Subscribe(_ =>
            {
                var ofd = new OpenFolderDialog();

                ofd.ShowAsync();
            });

            shell = ShellViewModel.Instance;
        }