Пример #1
0
 public override WindowResponse Show(object parent, string message, string title, MessageWindowType type, MessageWindowButtons bType)
 {
     if (parent != null)
     {
         return(WinFormHelper.GetResponse(MessageBox.Show(message, title, WinFormHelper.GetButtons(bType), WinFormHelper.GetWinType(type))));
     }
     else
     {
         return(WinFormHelper.GetResponse(MessageBox.Show((IWin32Window)parent, message, title, WinFormHelper.GetButtons(bType), WinFormHelper.GetWinType(type))));
     }
 }
Пример #2
0
        public override WindowResponse Show()
        {
            if (DialogType == FileDialogType.SelectFolder)
            {
                fbdlg = new OpenFolderDialog();
                fbdlg.InitialFolder = InitialDirectory;
                fbdlg.Title         = Title;

                WindowResponse resp = WinFormHelper.GetResponse(fbdlg.ShowDialog(owner));
                SelectedPath = fbdlg.Folder;
                return(resp);
            }
            else
            {
                switch (DialogType)
                {
                case FileDialogType.OpenFile:
                    fdlg = new OpenFileDialog();
                    break;

                case FileDialogType.SaveFile:
                    fdlg = new SaveFileDialog();
                    break;
                }

                fdlg.InitialDirectory = InitialDirectory;
                fdlg.Title            = Title;
                string tmpFilter = string.Empty;

                foreach (FileTypeFilter filter in FileTypeFilters)
                {
                    tmpFilter += filter.FilterName + "|";
                    for (int i = 0; i < filter.Filter.Length; i++)
                    {
                        tmpFilter += (i == 0 ? "" : ";") + "*." + filter.Filter[i];
                    }
                }
                fdlg.Filter = tmpFilter;
                WindowResponse resp = WinFormHelper.GetResponse(fdlg.ShowDialog());
                SelectedPath = fdlg.FileName;
                return(resp);
            }
        }