Example #1
0
        public bool SelectFolderDialog(SelectFolderDialogParams folderParams, Action <SelectFolderDialogParams> callback)
        {
            WinformsSystemWindow.ShowingSystemDialog = true;
            Gtk.Application.Init();

            Gtk.FileChooserDialog fc =
                new Gtk.FileChooserDialog(folderParams.Description,
                                          null,
                                          FileChooserAction.SelectFolder,
                                          "Cancel", ResponseType.Cancel,
                                          "Open", ResponseType.Accept);

            fc.KeepAbove = true;

            if (fc.Run() == (int)ResponseType.Accept)
            {
                folderParams.FolderPath = fc.Filename;
                UiThread.RunOnIdle(() =>
                {
                    callback(folderParams);
                });
            }

            fc.Destroy();
            while (Gtk.Application.EventsPending())
            {
                Gtk.Main.Iteration();
            }

            WinformsSystemWindow.ShowingSystemDialog = false;

            return(true);
        }
        private string SelectFolderDialog(ref SelectFolderDialogParams folderParams)
        {
            WinformsSystemWindow.ShowingSystemDialog = true;

            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();

            folderBrowserDialog.Description = folderParams.Description;
            switch (folderParams.RootFolder)
            {
            case SelectFolderDialogParams.RootFolderTypes.MyComputer:
                folderBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer;
                break;

            default:
                throw new NotImplementedException();
            }
            folderBrowserDialog.ShowNewFolderButton = folderParams.ShowNewFolderButton;

            folderBrowserDialog.ShowDialog();

            WinformsSystemWindow.ShowingSystemDialog = false;
            folderParams.FolderPath = folderBrowserDialog.SelectedPath;

            return(folderBrowserDialog.SelectedPath);
        }
 public bool SelectFolderDialog(SelectFolderDialogParams folderParams, Action <SelectFolderDialogParams> callback)
 {
     SelectFolderDialog(ref folderParams);
     UiThread.RunOnIdle(() =>
     {
         callback(folderParams);
     });
     return(true);
 }
 public bool SelectFolderDialog(SelectFolderDialogParams folderParams, Action <SelectFolderDialogParams> callback)
 {
     throw new NotImplementedException();
 }