public void OnCraftEdit() { // Store the prior craft folder to change the job filepaths string folderBeforeEdit = SelectedCraft.Folder; // Process craft editing Windows.DialogWindow dlg = new Windows.DialogWindow(); dlg.DataContext = new CraftViewModel(this, SelectedCraft, true, dlg); dlg.ShowDialog(); Globals.ChangesMade = true; // Update folders if the folder was changed if (SelectedCraft.Folder != folderBeforeEdit) { foreach (Craft c in Crafts) { foreach (Job j in c.Jobs) { for (int i = 0; i < j.DocumentsIncluded.Count; i++) { j.DocumentsIncluded[i] = j.DocumentsIncluded[i].Replace(folderBeforeEdit, SelectedCraft.Folder); } } } ImportDocuments(); // Clear filter to copy Documents into FilteredDocuments DocFilterText = ""; } }
public void OnJobEdit() { Windows.DialogWindow dlg = new Windows.DialogWindow(); dlg.DataContext = new JobViewModel(this, SelectedJob, SelectedCraft, true, dlg); dlg.ShowDialog(); JobFilterChanged(); Globals.ChangesMade = true; }
/// <summary> /// Helper function for common code. Creates the window and returns result. /// </summary> /// <param name="vm">View model.</param> /// <param name="windowTitle">Title of window.</param> /// <param name="message">Message to show in window.</param> /// <returns>Result.</returns> private static DialogResult DialogCommon(DialogWindowViewModelBase vm, string windowTitle, string message) { vm.WindowTitle = windowTitle; vm.BodyMessage = message; var d = new Windows.DialogWindow(vm); d.ShowDialog(); return(vm.UserDialogResult); }
public void OnCraftAdd() { Windows.DialogWindow dlg = new Windows.DialogWindow(); dlg.DataContext = new CraftViewModel(this, new Craft(), false, dlg); dlg.ShowDialog(); Globals.ChangesMade = true; // Load documents from new folder ImportDocuments(); }
/// <summary> /// Creates a new dialog with "ok" and "cancel" buttons. The user can also /// enter text in a textbox. /// </summary> /// <param name="windowTitle">Title of window.</param> /// <param name="message">Message to show in window.</param> /// <param name="defaultValue">Initialize the textbox with this value.</param> /// <returns>Result.</returns> public static DialogResult OpenOkCancelStringDialog(string windowTitle, string message, string defaultValue = null) { var vm = new OkCancelStringDialogWindowViewModel() { WindowTitle = windowTitle, BodyMessage = message, UserInput = defaultValue ?? string.Empty, }; var d = new Windows.DialogWindow(vm); d.ShowDialog(); return(vm.UserDialogResult); }