Beispiel #1
0
        protected override void Run()
        {
            var dlg = new OpenFileDialog(GettextCatalog.GetString("File to Open"), MonoDevelop.Components.FileChooserAction.Open)
            {
                TransientFor         = DesktopService.GetFocusedTopLevelWindow(),
                ShowEncodingSelector = true,
                ShowViewerSelector   = true,
            };

            if (!dlg.Run())
            {
                return;
            }

            var file = dlg.SelectedFile;

            if (dlg.SelectedViewer != null)
            {
                dlg.SelectedViewer.OpenFile(file, dlg.Encoding);
                return;
            }

            if (Services.ProjectService.IsWorkspaceItemFile(file) || Services.ProjectService.IsSolutionItemFile(file))
            {
                IdeApp.Workspace.OpenWorkspaceItem(file, dlg.CloseCurrentWorkspace);
            }
            else
            {
                IdeApp.Workbench.OpenDocument(file, null, dlg.Encoding, OpenDocumentOptions.DefaultInternal);
            }
        }
Beispiel #2
0
 public static Task <bool> Run(string url, SupportedCredentialTypes types, Credentials cred, Components.Window parentWindow = null)
 {
     return(Runtime.RunInMainThread(() => {
         var engine = Platform.IsMac ? Toolkit.NativeEngine : Toolkit.CurrentEngine;
         var response = false;
         engine.Invoke(() => {
             using (var xwtDialog = new XwtCredentialsDialog(url, types, cred)) {
                 response = xwtDialog.Run(parentWindow ?? DesktopService.GetFocusedTopLevelWindow()) == Command.Ok;
             }
         });
         return response;
     }));
 }
 public MessageDialogProgressMonitor(bool showProgress, bool allowCancel, bool showDetails, bool hideWhenDone, Components.Window parent)
     : base(Runtime.MainSynchronizationContext)
 {
     if (showProgress)
     {
         var parentWindow = parent ?? DesktopService.GetFocusedTopLevelWindow();
         dialog         = new ProgressDialog(parentWindow, allowCancel, showDetails);
         dialog.Message = "";
         MessageService.PlaceDialog(dialog, parentWindow);
         dialog.Show();
         dialog.CancellationTokenSource = CancellationTokenSource;
         DispatchService.RunPendingEvents();
         this.hideWhenDone = hideWhenDone;
         this.showDetails  = showDetails;
     }
 }
Beispiel #4
0
 public void ShowDialog()
 {
     MessageService.ShowCustomDialog(this, DesktopService.GetFocusedTopLevelWindow());
 }
Beispiel #5
0
 protected override void Run()
 {
     using (var dlg = new NewFileDialog(null, null))              // new file seems to fail if I pass the project IdeApp.ProjectOperations.CurrentSelectedProject
         MessageService.ShowCustomDialog(dlg, DesktopService.GetFocusedTopLevelWindow());
 }