Esempio n. 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="model">Model</param>
        /// <param name="commonDialogService">Common dialog service</param>
        public AddBrandViewModel(IAddBrandModel model, ICommonDialogService commonDialogService)
            : base(model)
        {
            this.model = model;
            this.commonDialogService = commonDialogService;

            // properties
            this.Name = this.model.ToReactivePropertyAsSynchronized(myModel => myModel.Name)
                        .AddTo(this.Disposable);
            this.IconPath = this.model.ToReactivePropertyAsSynchronized(myModel => myModel.IconPath)
                            .AddTo(this.Disposable);
            this.Icon = this.model.ObserveProperty(myModel => myModel.Icon).ToReadOnlyReactivePropertySlim()
                        .AddTo(this.Disposable);

            // commands
            this.SelectIconAsyncCommand = new[]
            {
                this.IsBusy.Select(isBusy => !isBusy),
            }.CombineLatest(combined => combined.All(condition => condition)).ToAsyncReactiveCommand()
            .AddTo(this.Disposable);
            this.SelectIconAsyncCommand.Subscribe(this.SelectIconAsync);
            this.AddBrandAsyncCommand = new[]
            {
                this.IsBusy.Select(isBusy => !isBusy),
                this.Name.Select(name => !string.IsNullOrWhiteSpace(name)),
            }.CombineLatest(combined => combined.All(condition => condition)).ToAsyncReactiveCommand()
            .AddTo(this.Disposable);
            this.AddBrandAsyncCommand.Subscribe(this.AddBrandAsync);
            this.CancelCommand = new[]
            {
                this.IsBusy.Select(isBusy => !isBusy),
            }.CombineLatest(combined => combined.All(condition => condition)).ToReactiveCommand()
            .AddTo(this.Disposable);
            this.CancelCommand.Subscribe(this.Cancel);
        }
Esempio n. 2
0
        public static MessageBoxResult ShowMessage(this ICommonDialogService DialogService, string Message, string Title, MessageBoxButton Button = default, MessageBoxImage Icon = default, MessageBoxResult DefaultResult = default, MessageBoxOptions Options = default)

        => DialogService.ShowMessage(new MessageBoxSettings
        {
            Title         = Title,
            Message       = Message,
            Button        = Button,
            Icon          = Icon,
            DefaultResult = DefaultResult,
            Options       = Options,
        });
Esempio n. 3
0
        public MainWindowViewModel(IDialogService dialogSrv, ICommonDialogService comDlgService)
        {
            this.dialogService = dialogSrv;
            this.DialogRequest = this.dialogService.DialogRequest;

            this.commonDialogService   = comDlgService;
            this.OpenFileDialogRequest = this.commonDialogService.CommonDialogRequest;

            this.ItemCode = this.chara.Code
                            .ToReactiveProperty()
                            .AddTo(this.disposables);

            this.CharacterName = this.chara.Name
                                 .ToReadOnlyReactivePropertySlim()
                                 .AddTo(this.disposables);

            this.SelectedFilePath = new ReactivePropertySlim <string>(string.Empty)
                                    .AddTo(this.disposables);

            this.SelectedFolderPath = new ReactivePropertySlim <string>(string.Empty)
                                      .AddTo(this.disposables);

            this.ItemCodeKeyDown = new ReactiveCommand <KeyEventArgs>()
                                   .AddTo(this.disposables);
            this.ItemCodeKeyDown.Subscribe(e => this.itemCode_keyDown(e));

            this.SearchCommand = new ReactiveCommand()
                                 .AddTo(this.disposables);
            this.SearchCommand.Subscribe(() => this.searchRefButton_Click());

            this.ShowDialogCommand = new ReactiveCommand()
                                     .AddTo(this.disposables);
            this.ShowDialogCommand.Subscribe(() => this.showDialogButton_Click());

            this.OpenFileDialogCommand = new ReactiveCommand()
                                         .AddTo(this.disposables);
            this.OpenFileDialogCommand.Subscribe(() => this.showOpenFileDialog());

            this.OokiiDialogCommand = new ReactiveCommand()
                                      .AddTo(this.disposables);
        }
        /// <summary>コンストラクタ。</summary>
        /// <param name="dialogService">Prismのダイアログサービスを表すIDialogService。</param>
        public MainWindowViewModel(IDialogService dialogService, ICommonDialogService comDlgService)
        {
            this.dlgService          = dialogService;
            this.commonDialogService = comDlgService;
            this.character           = new BleachCharacter();

            this.ShowMessageButtonCommand = new ReactiveCommand()
                                            .WithSubscribe(this.onShowMessageButtonCommand)
                                            .AddTo(this.disposables);

            this.DialogMessage = new ReactivePropertySlim <string>(string.Empty)
                                 .AddTo(this.disposables);

            this.ShowBleachDialogCommand = new ReactiveCommand()
                                           .WithSubscribe(() => this.showBleachDialog())
                                           .AddTo(this.disposables);

            this.ShowOpenFileDialogCommand = new ReactiveCommand()
                                             .WithSubscribe(() => this.onShowOpenFileDialog())
                                             .AddTo(this.disposables);

            this.ShowFolderBrowsDialogCommand = new ReactiveCommand()
                                                .WithSubscribe(() => this.onShowFolderBrowsDialog())
                                                .AddTo(this.disposables);

            this.BlearchCharacterCode = this.character.Code
                                        .AddTo(this.disposables);
            this.BlearchCharacterCode.Where(v => v.Length == 0 || v.Length == 3)
            .Subscribe(_ => this.agent.SetCharacterValues(this.character));

            this.BleachCharacterName = this.character.Name
                                       .ToReadOnlyReactivePropertySlim()
                                       .AddTo(this.disposables);

            this.OpenFileName = new ReactivePropertySlim <string>(string.Empty)
                                .AddTo(this.disposables);

            this.FolderPath = new ReactivePropertySlim <string>(string.Empty)
                              .AddTo(this.disposables);
        }
Esempio n. 5
0
 public static MessageBoxResult ShowMessage(this ICommonDialogService DialogService, string Message)
 => DialogService.ShowMessage(Message, string.Empty);
Esempio n. 6
0
 public static MessageBoxResult ShowMessage(this ICommonDialogService DialogService, IMessageBoxSettings Settings)
 {
     DialogService.ShowDialog(Settings);
     return(Settings.Result);
 }
        /// <summary>コンストラクタ。</summary>
        /// <param name="comDlgService">コモンダイアログサービスを表すICommonDialogService。</param>
        /// <param name="imaZipSettings">アプリケーション設定を表すIImaZipCoreProto01Settings。</param>
        public ZipFileListPanelViewModel(ICommonDialogService comDlgService,
                                         IImaZipCoreProto01Settings imaZipSettings,
                                         IDialogService dlgService)
        {
            this.commonDialogService = comDlgService;
            this.appSettings         = imaZipSettings;
            this.dialogService       = dlgService;

            this.ImageSources = this.zipSettings.ImageSources
                                .ToReadOnlyReactiveCollection(i => new ImageSourceViewModel(i))
                                .AddTo(this.disposable);
            this.ImageFilesExtractedFolderPath = this.zipSettings.ImageFilesExtractedFolder
                                                 .AddTo(this.disposable);

            this.deleteEnabled = new ReactivePropertySlim <bool>(false)
                                 .AddTo(this.disposable);
            this.moveUpEnabled = new ReactivePropertySlim <bool>(false)
                                 .AddTo(this.disposable);
            this.moveDownEnabled = new ReactivePropertySlim <bool>(false)
                                   .AddTo(this.disposable);

            this.SelectionChanged = new ReactiveCommand <SelectionChangedEventArgs>()
                                    .WithSubscribe(e => this.onSelectionChanged(e))
                                    .AddTo(this.disposable);

            this.AddImageSource = new ReactiveCommand <string>()
                                  .WithSubscribe(p => this.onAddImageSource(p))
                                  .AddTo(this.disposable);

            this.DeleteSource = this.deleteEnabled
                                .ToReactiveCommand()
                                .WithSubscribe(() => this.onDeleteSource())
                                .AddTo(this.disposable);
            this.MoveUp = this.moveUpEnabled
                          .ToReactiveCommand()
                          .WithSubscribe(() => this.onMoveUp())
                          .AddTo(this.disposable);
            this.MoveDown = this.moveDownEnabled
                            .ToReactiveCommand()
                            .WithSubscribe(() => this.onMoveDown())
                            .AddTo(this.disposable);

            this.SelectExtractFolder = new ReactiveCommand()
                                       .WithSubscribe(() => this.onSelectExtractFolder())
                                       .AddTo(this.disposable);

            this.CreateZip = this.zipSettings.IsComplete
                             .ToAsyncReactiveCommand()
                             .WithSubscribe(() => this.onCreateZip())
                             .AddTo(this.disposable);

            var folderSequences = new ObservableCollection <int>(Enumerable.Range(1, 4));

            this.FolderNameSequenceDigits = folderSequences
                                            .ToReadOnlyReactiveCollection(i => i)
                                            .AddTo(this.disposable);
            this.FolderNameSequenceDigit = this.zipSettings.FolderNameSequenceDigit
                                           .ToReactiveProperty()
                                           .AddTo(this.disposable);
            this.FolderNameTemplate = this.zipSettings.FolderNameTemplate
                                      .ToReactiveProperty()
                                      .AddTo(this.disposable);
            this.FileNameTemplate = this.zipSettings.FileNameTemplate
                                    .ToReactiveProperty()
                                    .AddTo(this.disposable);
        }