diff --git a/SourceGenWPF/MainController.cs b/SourceGenWPF/MainController.cs
index 7c2b760..f169b58 100644
--- a/SourceGenWPF/MainController.cs
+++ b/SourceGenWPF/MainController.cs
@@ -772,7 +772,7 @@ namespace SourceGenWPF {
///
/// Handles opening an existing project by letting the user select the project file.
///
- private void DoOpen() {
+ public void OpenProject() {
if (!CloseProject()) {
return;
}
@@ -941,7 +941,11 @@ namespace SourceGenWPF {
return newPath;
}
- private bool DoSaveAs() {
+ ///
+ /// Saves the project, querying for the filename.
+ ///
+ /// True on success, false if the save attempt failed or was canceled.
+ public bool SaveProjectAs() {
SaveFileDialog fileDlg = new SaveFileDialog() {
Filter = ProjectFile.FILENAME_FILTER + "|" + Res.Strings.FILE_FILTER_ALL,
FilterIndex = 1,
@@ -949,30 +953,33 @@ namespace SourceGenWPF {
AddExtension = true,
FileName = Path.GetFileName(mDataPathName) + ProjectFile.FILENAME_EXT
};
- if (fileDlg.ShowDialog() == true) {
- string pathName = Path.GetFullPath(fileDlg.FileName);
- Debug.WriteLine("Project save path: " + pathName);
- if (DoSave(pathName)) {
- // Success, record the path name.
- mProjectPathName = mProject.ProjectPathName = pathName;
-
- // add it to the title bar
-#if false
- UpdateMenuItemsAndTitle();
-#endif
- return true;
- }
+ if (fileDlg.ShowDialog() != true) {
+ Debug.WriteLine("SaveAs canceled by user");
+ return false;
}
- return false;
+ string pathName = Path.GetFullPath(fileDlg.FileName);
+ Debug.WriteLine("Project save path: " + pathName);
+ if (!DoSave(pathName)) {
+ return false;
+ }
+
+ // Success, record the path name.
+ mProjectPathName = mProject.ProjectPathName = pathName;
+
+ // add it to the title bar
+#if false
+ UpdateMenuItemsAndTitle();
+#endif
+ return true;
}
///
- /// Save the project. If it hasn't been saved before, use save-as behavior instead.
+ /// Saves the project. If it hasn't been saved before, use save-as behavior instead.
///
/// True on success, false if the save attempt failed.
- private bool DoSave() {
+ public bool SaveProject() {
if (string.IsNullOrEmpty(mProjectPathName)) {
- return DoSaveAs();
+ return SaveProjectAs();
}
return DoSave(mProjectPathName);
}
@@ -1028,7 +1035,7 @@ namespace SourceGenWPF {
if (ok != true) {
return false;
} else if (dlg.UserChoice == DiscardChanges.Choice.SaveAndContinue) {
- if (!DoSave()) {
+ if (!SaveProject()) {
return false;
}
}
diff --git a/SourceGenWPF/Res/CommandIcons.xaml b/SourceGenWPF/Res/CommandIcons.xaml
index 6e877b1..5d5c424 100644
--- a/SourceGenWPF/Res/CommandIcons.xaml
+++ b/SourceGenWPF/Res/CommandIcons.xaml
@@ -13,10 +13,21 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SourceGenWPF.Res">
+
+
+
-
+
@@ -41,7 +52,8 @@
-
+
@@ -64,7 +76,8 @@
-
+
@@ -88,7 +101,8 @@
-
+
@@ -112,7 +126,8 @@
-
+
@@ -135,7 +150,8 @@
-
+
@@ -157,7 +173,8 @@
-
+
diff --git a/SourceGenWPF/WpfGui/DataFileLoadIssue.xaml b/SourceGenWPF/WpfGui/DataFileLoadIssue.xaml
index b03ed51..8183b43 100644
--- a/SourceGenWPF/WpfGui/DataFileLoadIssue.xaml
+++ b/SourceGenWPF/WpfGui/DataFileLoadIssue.xaml
@@ -24,21 +24,17 @@ limitations under the License.
Title="Data File Load Issue"
SizeToContent="WidthAndHeight" ResizeMode="NoResize"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner">
-
- There was an error while loading the data file:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ While loading the file:
+
+
+
+
+
+
+
+
+
diff --git a/SourceGenWPF/WpfGui/DataFileLoadIssue.xaml.cs b/SourceGenWPF/WpfGui/DataFileLoadIssue.xaml.cs
index b6625ff..d3650ad 100644
--- a/SourceGenWPF/WpfGui/DataFileLoadIssue.xaml.cs
+++ b/SourceGenWPF/WpfGui/DataFileLoadIssue.xaml.cs
@@ -24,25 +24,25 @@ namespace SourceGenWPF.WpfGui {
///
/// Path name of problematic file.
///
- private string mPathName;
+ public string PathName { get; set; }
///
/// Message to show in the dialog.
///
- private string mMessage;
+ public string Message { get; set; }
public DataFileLoadIssue(Window owner, string pathName, string message) {
+ PathName = pathName;
+ Message = message;
+
+ this.DataContext = this;
InitializeComponent();
Owner = owner;
-
- mPathName = pathName;
- mMessage = message;
}
- private void DataFileLoadIssue_Load(object sender, EventArgs e) {
- pathNameTextBox.Text = mPathName;
- problemLabel.Text = mMessage;
+ private void OkButton_Click(object sender, RoutedEventArgs e) {
+ DialogResult = true;
}
}
}
diff --git a/SourceGenWPF/WpfGui/MainWindow.xaml b/SourceGenWPF/WpfGui/MainWindow.xaml
index 30fefd5..9effcee 100644
--- a/SourceGenWPF/WpfGui/MainWindow.xaml
+++ b/SourceGenWPF/WpfGui/MainWindow.xaml
@@ -70,6 +70,7 @@ limitations under the License.
Ctrl+Shift+Minus
+
@@ -115,11 +116,18 @@ limitations under the License.
CanExecute="CanNavigateBackward" Executed="NavigateBackwardCmd_Executed"/>
+
-
+
+
+
@@ -131,7 +139,7 @@ limitations under the License.