예제 #1
0
        public FileSelectorViewModel(FileSelectorControl view)
        {
            _view = view;

            _recentlyUsedFiles  = new List <NovelFileModel>();
            _semiautoSavedFiles = new List <NovelFileModel>();
            _novelsBoxFiles     = new List <NovelFileModel>();
        }
예제 #2
0
        /// <summary>
        /// ファイルを開く
        /// </summary>
        /// <param name="editor">テキストを展開するためのIEditorインターフェース</param>
        /// <returns>正否</returns>
        public bool OpenFile(IEditor editor)
        {
            FileSelectorControl control = new FileSelectorControl();

            control.Owner = Application.Current.MainWindow;
            var viewModel = new FileSelectorViewModel(control);

            viewModel.Initialize(NovelsCollectorGenerator.GetRecentlyNovelsCollector(),
                                 NovelsCollectorGenerator.GetSemiAutoBackupNovelsCollector(),
                                 NovelsCollectorGenerator.GetNovelsBoxCollector());

            control.SetViewModel(viewModel);
            //ダイアログを表示する
            if (ShowDialogManager.ShowDialog(control) == true)
            {
                OpenFile(editor, control.FilePath);
                return(true);
            }

            return(false);
        }