Пример #1
0
        protected override string ShowBrowseDialog(string name, string start_in)
        {
            FolderDialog fd = new FolderDialog (name);
            if (start_in != null)
                fd.SetFilename (start_in);

            int response = fd.Run ();

            if (response == (int) ResponseType.Ok) {
                fd.Hide ();
                return fd.Filename;
            }
            fd.Hide ();

            return null;
        }
        void BrowseDirectoryEvent(object sender, EventArgs e)
        {
            PropertyService PropertyService = (PropertyService)ServiceManager.GetService (typeof (PropertyService));
            FolderDialog fd = new FolderDialog (GettextCatalog.GetString ("Select directory"));

            // set up the dialog to point to currently selected folder, or the default projects folder
            string defaultFolder = this.directoryTextBox.Text;
            if (defaultFolder == string.Empty || defaultFolder == null) {
                // only use the bew project default path if there is no path set
                defaultFolder =	PropertyService.GetProperty (
                        "MonoDevelop.Gui.Dialogs.NewProjectDialog.DefaultPath",
                        System.IO.Path.Combine (
                            System.Environment.GetEnvironmentVariable ("HOME"),
                            "Projects")).ToString ();
            }
            fd.SetFilename( defaultFolder );
            if (fd.Run() == (int)Gtk.ResponseType.Ok)
            {
                directoryTextBox.Text = fd.Filename;
            }
            fd.Hide ();
        }