Moved Windows Forms common dialog functions into Windows Forms-specific UserInterface library

This commit is contained in:
Michael Becker 2014-11-14 08:31:20 -05:00
parent ac8234a903
commit 561bd1fd04
6 changed files with 21 additions and 17 deletions

View File

@ -381,7 +381,7 @@ namespace UniversalEditor.UserInterface.WindowsForms.Dialogs
SaveFileDialog sfd = new SaveFileDialog();
if (mvarDataFormat != null)
{
sfd.Filter = UniversalEditor.Common.Dialog.GetCommonDialogFilter(mvarDataFormat.MakeReference());
sfd.Filter = UniversalEditor.UserInterface.WindowsForms.CommonDialog.GetCommonDialogFilter(mvarDataFormat.MakeReference());
}
if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{

View File

@ -1087,7 +1087,7 @@ namespace UniversalEditor.UserInterface.WindowsForms
{
SolutionObjectModel solution = new SolutionObjectModel();
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = UniversalEditor.Common.Dialog.GetCommonDialogFilter(solution.MakeReference());
ofd.Filter = UniversalEditor.UserInterface.WindowsForms.CommonDialog.GetCommonDialogFilter(solution.MakeReference());
ofd.Multiselect = false;
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
@ -1190,7 +1190,7 @@ namespace UniversalEditor.UserInterface.WindowsForms
List<DataFormatReference> refs = new List<DataFormatReference>();
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = UniversalEditor.Common.Dialog.GetCommonDialogFilter(mvarCurrentSolution.MakeReference(), out refs);
sfd.Filter = UniversalEditor.UserInterface.WindowsForms.CommonDialog.GetCommonDialogFilter(mvarCurrentSolution.MakeReference(), out refs);
sfd.FileName = mvarCurrentSolution.Title + ".sln";
if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{

View File

@ -1,10 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UniversalEditor.Common
namespace UniversalEditor.UserInterface.WindowsForms
{
public static class Dialog
/// <summary>
/// Contains methods useful for common file dialogs in Windows Forms.
/// </summary>
public static class CommonDialog
{
// UniversalDataStorage.Common.Methods
public static string GetCommonDialogFilter(DataFormatReference dataFormatReference)
@ -43,7 +47,7 @@ namespace UniversalEditor.Common
List<DataFormatReference> dfrs = new List<DataFormatReference>();
StringBuilder sb = new StringBuilder();
StringBuilder sbCompatible = new StringBuilder();
DataFormatReference[] dataFormats = Reflection.GetAvailableDataFormats(objectModelReference);
DataFormatReference[] dataFormats = UniversalEditor.Common.Reflection.GetAvailableDataFormats(objectModelReference);
DataFormatReference[] array = dataFormats;
for (int k = 0; k < array.Length; k++)
{
@ -73,15 +77,15 @@ namespace UniversalEditor.Common
}
}
sb.Insert(0, string.Concat(new string[]
{
"All ",
objectModelReference.Title,
" files (",
sbCompatible.ToString(),
")|",
sbCompatible.ToString(),
"|"
}));
{
"All ",
objectModelReference.Title,
" files (",
sbCompatible.ToString(),
")|",
sbCompatible.ToString(),
"|"
}));
sb.Append("All files (*.*)|*.*");
dataFormatReferences = dfrs;

View File

@ -39,6 +39,7 @@
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="CommonDialog.cs" />
<Compile Include="Controls\DocumentTypeSelector.cs">
<SubType>UserControl</SubType>
</Compile>

View File

@ -166,7 +166,7 @@ namespace UniversalEditor.Editors.Multimedia.Picture.Collection
sfd.Title = "Export Current Frame";
ObjectModelReference omr = mvarCurrentPicture.MakeReference();
sfd.Filter = UniversalEditor.Common.Dialog.GetCommonDialogFilter(omr);
sfd.Filter = UniversalEditor.UserInterface.WindowsForms.CommonDialog.GetCommonDialogFilter(omr);
if (sfd.ShowDialog() == DialogResult.OK)
{
DataFormatReference[] dfrs = UniversalEditor.Common.Reflection.GetAvailableDataFormats(sfd.FileName);

View File

@ -39,7 +39,6 @@
<ItemGroup>
<Compile Include="Collections\Generic\AutoDictionary.cs" />
<Compile Include="Collections\Generic\BidirectionalDictionary.cs" />
<Compile Include="Common\Dialog.cs" />
<Compile Include="Common\Reflection.cs" />
<Compile Include="Condition.cs" />
<Compile Include="Converter.cs" />