using System.Windows.Forms; namespace Palmmedia.WpfGraph.UI.Interaction { /// <summary> /// <see cref="IFileSelector"/> implementation using dialogs. /// </summary> internal class FormFileSelector : IFileSelector { /// <summary> /// Gets the file name for opening. /// </summary> /// <returns>The name of the file to open.</returns> public string GetFileNameForOpening() { using (var openFileDialog = new OpenFileDialog()) { openFileDialog.Filter = "XML (*.xml)|*.xml"; openFileDialog.ShowDialog(); return openFileDialog.FileName; } } /// <summary> /// Gets the file name for saving. /// </summary> /// <returns>The name of the file to save.</returns> public string GetFileNameForSaving() { using (var saveFileDialog = new SaveFileDialog()) { saveFileDialog.Filter = "XML (*.xml)|*.xml"; saveFileDialog.ShowDialog(); return saveFileDialog.FileName; } } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0