SetViewModel() публичный Метод

public SetViewModel ( FileSelectorViewModel viewModel ) : void
viewModel FileSelector.Model.FileSelectorViewModel
Результат void
Пример #1
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;
        }