public bool Run(AddFileDialogData data) { var parentWindow = data.TransientFor ?? MessageService.RootWindow; parentWindow.FocusInEvent += OnParentFocusIn; bool result = SelectFileDialogHandler.RunWinUIMethod(RunDialog, data); parentWindow.FocusInEvent -= OnParentFocusIn; parentWindow.Present(); return(result); }
public bool Run(AddFileDialogData data) { CustomAddFilesDialog adlg = new CustomAddFilesDialog(); adlg.StartLocation = AddonWindowLocation.Bottom; adlg.OpenDialog.InitialDirectory = data.CurrentFolder; adlg.OpenDialog.AddExtension = true; adlg.BuildActions = data.BuildActions; // adlg.OpenDialog.Filter = "Image Files(*.bmp;*.jpg;*.gif;*.png)|*.bmp;*.jpg;*.gif;*.png"; WinFormsRunner runner = new WinFormsRunner(); bool result = false; Timer t = new Timer(); t.Interval = 20; try { t.Tick += delegate { // MonoDevelop.Core.Gui.DispatchService.RunPendingEvents(); }; //t.Enabled = true; WinFormsRoot root = new WinFormsRoot(); if (adlg.ShowDialog(root) == DialogResult.Cancel) { result = false; } else { FilePath[] paths = new FilePath [adlg.OpenDialog.FileNames.Length]; for (int n = 0; n < adlg.OpenDialog.FileNames.Length; n++) { paths [n] = adlg.OpenDialog.FileNames [n]; } data.SelectedFiles = paths; data.OverrideAction = adlg.OverrideAction; result = true; } } finally { t.Enabled = false; adlg.Dispose(); } return(result); }
public bool Run(AddFileDialogData data) { var parent = data.TransientFor ?? MessageService.RootWindow; var dialog = new CommonOpenFileDialog(); SelectFileDialogHandler.SetCommonFormProperties(data, dialog); var buildActionCombo = new CommonFileDialogComboBox(); var group = new CommonFileDialogGroupBox("overridebuildaction", "Override build action:"); buildActionCombo.Items.Add(new CommonFileDialogComboBoxItem(GettextCatalog.GetString("Default"))); foreach (var ba in data.BuildActions) { if (ba == "--") { continue; } buildActionCombo.Items.Add(new CommonFileDialogComboBoxItem(ba)); } buildActionCombo.SelectedIndex = 0; group.Items.Add(buildActionCombo); dialog.Controls.Add(group); if (!GdkWin32.RunModalWin32Dialog(dialog, parent)) { return(false); } SelectFileDialogHandler.GetCommonFormProperties(data, dialog); var idx = buildActionCombo.SelectedIndex; if (idx > 0) { data.OverrideAction = buildActionCombo.Items [idx].Text; } return(true); }
bool RunDialog(AddFileDialogData data) { Application.EnableVisualStyles(); CustomAddFilesDialog adlg = new CustomAddFilesDialog(); adlg.StartLocation = AddonWindowLocation.Bottom; adlg.BuildActions = data.BuildActions; bool result = false; SelectFileDialogHandler.SetCommonFormProperties(data, adlg.FileDialog); try { rootForm = new WinFormsRoot(); if (adlg.ShowDialog(rootForm) == DialogResult.Cancel) { result = false; } else { FilePath[] paths = new FilePath [adlg.FileDialog.FileNames.Length]; for (int n = 0; n < adlg.FileDialog.FileNames.Length; n++) { paths [n] = adlg.FileDialog.FileNames [n]; } data.SelectedFiles = paths; data.OverrideAction = adlg.OverrideAction; result = true; } } finally { adlg.Dispose(); } return(result); }
public bool Run(AddFileDialogData data) { throw new NotImplementedException(); }
public bool Run(AddFileDialogData data) { using (var panel = new NSOpenPanel { CanChooseDirectories = false, CanChooseFiles = true, }) { MacSelectFileDialogHandler.SetCommonPanelProperties(data, panel); var popup = new NSPopUpButton(new CGRect(0, 0, 200, 28), false); var dropdownBox = new MDBox(LayoutDirection.Horizontal, 2, 0) { { new MDLabel(GettextCatalog.GetString("Override build action:")), true }, { new MDAlignment(popup, true) { MinWidth = 200 } } }; var filterPopup = MacSelectFileDialogHandler.CreateFileFilterPopup(data, panel); if (filterPopup != null) { dropdownBox.Layout(); var box = new MDBox(LayoutDirection.Vertical, 2, 2) { dropdownBox.View, filterPopup, }; box.Layout(); panel.AccessoryView = box.View; box.Layout(box.View.Superview.Frame.Size); } else { dropdownBox.Layout(); panel.AccessoryView = dropdownBox.View; } popup.AddItem(GettextCatalog.GetString("(Default)")); popup.Menu.AddItem(NSMenuItem.SeparatorItem); foreach (var b in data.BuildActions) { if (b == "--") { popup.Menu.AddItem(NSMenuItem.SeparatorItem); } else { popup.AddItem(b); } } if (panel.RunModal() == 0) { GtkQuartz.FocusWindow(data.TransientFor ?? MessageService.RootWindow); return(false); } data.SelectedFiles = MacSelectFileDialogHandler.GetSelectedFiles(panel); var idx = popup.IndexOfSelectedItem - 2; if (idx >= 0) { data.OverrideAction = data.BuildActions[idx]; } GtkQuartz.FocusWindow(data.TransientFor ?? MessageService.RootWindow); return(true); } }