public MessageBoxButtonViewModel(string text, MessageBoxResult result, Action<MessageBoxResult> returnAction, bool hasInitFocus = false) { m_text = text; m_result = result; m_hasInitFocus = hasInitFocus; m_command = new GenericManualCommand<MessageBoxResult>(returnAction); }
public TemplateDialogViewModel() { m_showCloseButton = false; m_runCommand = new ManualCommand(Run); m_browseForFileCommand = new GenericManualCommand<TemplateParameterViewModel>(BrowseForFile); m_canClose = CloseAutoComplete; }
public FileSwitchDialogViewModel(LayoutElementViewModel layoutElement) { m_layoutElement = layoutElement; m_files = m_layoutElement.FileUseOrder; m_switchFileCommand = new GenericManualCommand<int>(SwitchFile, null, Converter); m_showCloseButton = false; }
public FileSearchDialogViewModel(MainViewModel mainViewModel) { m_mainViewModel = mainViewModel; m_filteredFiles = new FilteredObservableCollection<FileViewModel>(null, n => n.Name.Contains(m_searchString)); m_showCloseButton = false; m_openCommand = new ManualCommand(OpenFile); m_changeIndexCommand = new GenericManualCommand<int>(ChangeIndex, null, n => int.Parse((string) n)); }
public LayoutManager(MainViewModel mainViewModel) { m_mainViewModel = mainViewModel; m_selectLayoutTypeCommand = new GenericManualCommand<LayoutType>(layoutType => SelectedLayoutType = layoutType); }
public MainViewModel() { m_window = new MainWindow {DataContext = this}; m_layoutManager = new LayoutManager(this); m_tabTrees = Enum.GetValues(typeof(TabTrees)).Cast<TabTrees>().ToList(); m_closeFileCommand = new GenericManualCommand<IFileViewModel>(CloseFile); m_saveFileCommand = new ManualCommand(Save, () => LayoutManager.ActiveLayoutElement != null && LayoutManager.ActiveLayoutElement.SelectedFile != null && LayoutManager.ActiveLayoutElement.SelectedFile.HasUnsavedChanges); m_saveAllFilesCommand = new ManualCommand(SaveAll, () => LayoutManager.LayoutElements.Any(layout => layout.OpenFiles.Any(n => n.HasUnsavedChanges))); m_openFileViewModelCommand = new GenericManualCommand<IFileViewModel>(file => OpenFile(file)); m_openFileCommand = new ManualCommand(OpenFile); m_openFolderCommand = new ManualCommand(OpenFolder); m_exitCommand = new ManualCommand(() => Environment.Exit(0)); m_newFileCommand = new ManualCommand(CreateNewFile); m_changeSettingsPathCommand = new ManualCommand(ChangeSettingsPath); m_renameSelectedNodeCommand = new ManualCommand(() => m_selectedNode.IsRenaming = true); m_renameSelectedNodeDoneCommand = new ManualCommand(() => m_selectedNode.IsRenaming = false); m_renameSelectedNodeCancelCommand = new ManualCommand(() => { m_selectedNode.RenameString = null; m_selectedNode.IsRenaming = false; }); m_createFileCommand = new GenericManualCommand<string>(s => CreateNewFileAtSelectedNode(s)); m_reloadFilesDialogViewModel = new ReloadFilesDialogViewModel(); m_createFolderCommand = new ManualCommand(() => CreateFolder("Newfolder")); m_deleteSelectedNodeCommand = new ManualCommand(DeleteSelectedNode); m_dialogHelper = new DialogHelper(this); ServiceProvider.Registre<IDialogHelper>(DialogHelper); if (string.IsNullOrEmpty(Properties.Settings.Default.SettingPath) || !Directory.Exists(Properties.Settings.Default.SettingPath)) { m_folderBrowserDialogViewModel = new FolderBrowserDialogViewModel(); m_folderBrowserDialogViewModel.PropertyChanged += StartFolderBrowserDialogViewModelOnPropertyChanged; m_folderBrowserDialogViewModel.Title = "Select settings path"; m_folderBrowserDialogViewModel.Path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\sharpE\\settings"; DialogHelper.ShowDialog(m_folderBrowserDialogViewModel); } else { Init(); } }
public DialogViewModel() { m_closeCommand = new GenericManualCommand<IDialogViewModel>(Close); }