/// <summary> /// Shows a <see cref="SaveFileDialog"/> allowing the user to enter or select a scenario /// section file to save to.</summary> /// <param name="section"> /// A <see cref="ScenarioSection"/> value indicating the scenario section that the file /// represents.</param> /// <param name="file"> /// The file initially selected in the dialog, relative to the current <see /// cref="FilePaths.CommonFolder"/>.</param> /// <returns> /// A <see cref="RootedPath"/> wrapping the absolute file path selected by the user, or an /// empty path if the user cancelled the dialog.</returns> /// <exception cref="InvalidEnumArgumentException"> /// <paramref name="section"/> is not a valid <see cref="ScenarioSection"/> value. /// </exception> /// <remarks> /// The specified <paramref name="file"/> may be a null reference or an empty string to /// indicate that no file should be initially selected. The dialog initially shows the /// default folder for the specified <paramref name="section"/>, unless overriden by an /// absolute <paramref name="file"/> path.</remarks> public static RootedPath SaveSectionDialog(ScenarioSection section, string file) { string directory = FilePaths.GetSectionFolder(section); return(SaveDialog(Strings.TitleSectionSave, Strings.FilterSection, 1, "xml", FilePaths.CreateCommonPath(file), directory)); }
/// <summary> /// Shows an <see cref="OpenFileDialog"/> allowing the user to select a file with a /// graphical tile set to open.</summary> /// <param name="file"> /// The file initially selected in the dialog, relative to the current <see /// cref="FilePaths.CommonFolder"/>.</param> /// <returns> /// A <see cref="RootedPath"/> wrapping the absolute file path selected by the user, or an /// empty path if the user cancelled the dialog.</returns> /// <remarks><para> /// <b>OpenImageDialog</b> only allows the selection of existing files. /// </para><para> /// The specified <paramref name="file"/> may be a null reference or an empty string to /// indicate that no file should be initially selected. The dialog initially shows the /// default folder for the <see cref="ScenarioSection.Images"/> section, unless overriden by /// an absolute <paramref name="file"/> path.</para></remarks> public static RootedPath OpenImageDialog(string file) { string directory = FilePaths.GetSectionFolder(ScenarioSection.Images); return(OpenDialog(Strings.TitleImageOpen, Strings.FilterImage, "png", FilePaths.CreateCommonPath(file), directory, false)); }
/// <summary> /// Shows an <see cref="OpenFileDialog"/> allowing the user to enter or select a scenario /// section file to open.</summary> /// <param name="section"> /// A <see cref="ScenarioSection"/> value indicating the scenario section that the file /// represents.</param> /// <param name="file"> /// The file initially selected in the dialog, relative to the current <see /// cref="FilePaths.CommonFolder"/>.</param> /// <param name="create"> /// <c>true</c> if the user may enter nonexistent file names; or <c>false</c> if the user /// may only select an existing file.</param> /// <returns> /// A <see cref="RootedPath"/> wrapping the absolute file path selected by the user, or an /// empty path if the user cancelled the dialog.</returns> /// <exception cref="InvalidEnumArgumentException"> /// <paramref name="section"/> is not a valid <see cref="ScenarioSection"/> value. /// </exception> /// <remarks> /// The specified <paramref name="file"/> may be a null reference or an empty string to /// indicate that no file should be initially selected. The dialog initially shows the /// default folder for the specified <paramref name="section"/>, unless overriden by an /// absolute <paramref name="file"/> path.</remarks> public static RootedPath OpenSectionDialog( ScenarioSection section, string file, bool create) { string directory = FilePaths.GetSectionFolder(section); return(OpenDialog(Strings.TitleSectionOpen, Strings.FilterSection, "xml", FilePaths.CreateCommonPath(file), directory, create)); }