mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
Implemented Save and Save As
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user