CreateChooser() public method

public CreateChooser ( string title, FileChooserAction action ) : Gtk.FileChooserDialog
title string
action FileChooserAction
return Gtk.FileChooserDialog
Beispiel #1
0
        // File menu actions

        void OnOpen(object o, EventArgs args)
        {
            var chooser = app.CreateChooser(Catalog.GetString("Select PDF"), FileChooserAction.Open);

            chooser.SelectMultiple = true;
            chooser.AddButton(Stock.Open, ResponseType.Ok);

            if (app.Document != null)
            {
                chooser.SetCurrentFolder(System.IO.Path.GetDirectoryName(app.Document.SuggestedSavePath));
            }
            else
            {
                chooser.SetCurrentFolder(Client.Configuration.LastOpenFolder);
            }

            var response  = chooser.Run();
            var filenames = chooser.Filenames;

            chooser.Destroy();

            if (response == (int)ResponseType.Ok)
            {
                Client.RunIdle(delegate {
                    foreach (var file in filenames)
                    {
                        app.LoadPath(file);
                    }
                });
            }
        }