예제 #1
0
        /// <summary>コンストラクタ。</summary>
        /// <param name="regMan">Prismのリージョンマネージャを表すIRegionManager。</param>
        public MainWindowViewModel(IRegionManager regMan, IImaZipCoreProto01Settings imaZipSettings) : base(regMan)
        {
            this.appSettings = imaZipSettings;

            this.Title = new ReactivePropertySlim <string>(this.getApplicationTitle())
                         .AddTo(this.disposable);

            this.MenuSelectButtonEnabled = new ReactivePropertySlim <bool>(true)
                                           .AddTo(this.disposable);

            this.LoadSettingViews = this.MenuSelectButtonEnabled
                                    .ToReactiveCommand <string>()
                                    .WithSubscribe(p => this.onLoadSettingViews(p))
                                    .AddTo(this.disposable);
        }
예제 #2
0
        /// <summary>
        /// zipファイルの作成を開始します。
        /// </summary>
        /// <param name="settings">zipファイル設定を表すZipFileSettings。</param>
        /// <param name="appSettings">アプリの設定を表すIImaZipCoreProto01Settings。</param>
        /// <returns>zipファイルの作成開始Task。</returns>
        public Task StartCreateZipAsync(ZipFileSettings settings, IImaZipCoreProto01Settings appSettings)
        {
            var zipId = this.saveZipSettings(settings);

            if (!zipId.HasValue)
            {
                return(Task.CompletedTask);
            }

            // ZipBookCreator起動
            Process.Start(new ProcessStartInfo()
            {
                UseShellExecute = true,
                FileName        = Path.Combine(AssemblyUtility.GetExecutingPath(), appSettings.CreatorExeFileName),
                Arguments       = zipId.Value.ToString()
            });

            return(Task.CompletedTask);
        }
        /// <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);
        }