Implemented Save and Save As

This commit is contained in:
Joshua Askharoun
2021-04-04 02:28:56 -05:00
parent d4cc2ab22e
commit f4829de6cb
2 changed files with 27 additions and 4 deletions
+5 -3
View File
@@ -18,10 +18,12 @@
<Ribbon Title="Microsoft Iris IDE">
<Ribbon.ApplicationMenu>
<RibbonApplicationMenu SmallImageSource="Images/ZuneShell.ico" Background="Black" BorderBrush="Black">
<RibbonApplicationMenuItem Header="Open" ImageSource="Images/OpenProject_16x.png"
<RibbonApplicationMenuItem Header="Open..." ImageSource="Images/OpenProject_16x.png"
KeyTip="O" Click="Open_Click" />
<RibbonApplicationMenuItem Header="Save" ImageSource="Images/Save_16x.png" KeyTip="S" />
<RibbonApplicationSplitMenuItem Header="Save As" ImageSource="Images/SaveAs_16x.png" KeyTip="Shift+S"/>
<RibbonApplicationMenuItem Header="Save" ImageSource="Images/Save_16x.png"
KeyTip="S" Click="Save_Click" />
<RibbonApplicationSplitMenuItem Header="Save As..." ImageSource="Images/SaveAs_16x.png"
KeyTip="Shift+S" Click="SaveAs_Click"/>
</RibbonApplicationMenu>
</Ribbon.ApplicationMenu>
+22 -1
View File
@@ -31,6 +31,8 @@ namespace ZuneUIXTools
/// </summary>
public partial class MainWindow : Window
{
private const string FILE_FORMAT_FILTER = "Microsoft Iris UI (*.uix)|*.uix|XML files (*.xml)|*.xml";
public string DocumentPath { get; set; }
public string UIRoot { get; set; }
@@ -176,7 +178,7 @@ namespace ZuneUIXTools
{
OpenFileDialog openFileDialog = new OpenFileDialog
{
Filter = "Microsoft Iris UI (*.uix)|*.uix|XML files (*.xml)|*.xml"
Filter = FILE_FORMAT_FILTER
};
if (openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
return;
@@ -184,5 +186,24 @@ namespace ZuneUIXTools
DocumentPath = openFileDialog.FileName;
textEditor.Load(DocumentPath);
}
private void Save_Click(object sender, RoutedEventArgs e)
{
textEditor.Save(DocumentPath);
}
private void SaveAs_Click(object sender, RoutedEventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog
{
Filter = FILE_FORMAT_FILTER,
FileName = DocumentPath
};
if (saveFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
return;
DocumentPath = saveFileDialog.FileName;
textEditor.Save(DocumentPath);
}
}
}