Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create open and save file dialogs for test WPF application #381

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/TestApplications/WpfApplication/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="_File">
<MenuItem Header="_Open" Click="MenuItemOpenOnClick"/>
<MenuItem Header="_Save" Click="MenuItemSaveOnClick"/>
<MenuItem Header="E_xit" />
</MenuItem>
<MenuItem Header="_Edit">
Expand Down
19 changes: 19 additions & 0 deletions src/TestApplications/WpfApplication/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Windows;
using System.Windows.Controls;
using Microsoft.Win32;

namespace WpfApplication
{
Expand Down Expand Up @@ -41,5 +42,23 @@ private void OnShowLabel(object sender, RoutedEventArgs e)
lblMenuChk.Visibility = Visibility.Hidden;
}
}

private void MenuItemOpenOnClick(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
if (openFileDialog.ShowDialog() == true)
{
MessageBox.Show(openFileDialog.FileName);
}
}

private void MenuItemSaveOnClick(object sender, RoutedEventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
if (saveFileDialog.ShowDialog() == true)
{
MessageBox.Show(saveFileDialog.FileName);
}
}
}
}