当前位置: 首页>>代码示例>>C#>>正文


C# FileChooserDialog.AddButton方法代码示例

本文整理汇总了C#中Gtk.FileChooserDialog.AddButton方法的典型用法代码示例。如果您正苦于以下问题:C# FileChooserDialog.AddButton方法的具体用法?C# FileChooserDialog.AddButton怎么用?C# FileChooserDialog.AddButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.FileChooserDialog的用法示例。


在下文中一共展示了FileChooserDialog.AddButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: loadBatchPoints

        //Will load in multiple files, or a folder of files which will be matched against
        //loaded templates
        public static List<Tuple<string, List<PointD>>> loadBatchPoints()
        {
            List<Tuple<string,List<PointD>>> result = new List<Tuple<string,List<PointD>>> ();

            //Setup of dialog and limiting it to only XML files
            FileChooserDialog fileChooser = new FileChooserDialog ("Open Files", null, FileChooserAction.Open);
            fileChooser.AddButton (Stock.Cancel, ResponseType.Cancel);
            fileChooser.AddButton (Stock.Open, ResponseType.Ok);

            fileChooser.Filter = new FileFilter ();
            fileChooser.Filter.AddPattern ("*.xml");

            string tmp = System.IO.Directory.GetCurrentDirectory();
            string newTmp = tmp + "/../../Gestures/RecordedDataPoints/";
            fileChooser.SetCurrentFolder (newTmp);

            fileChooser.SelectMultiple = true;

            ResponseType retVal = (ResponseType)fileChooser.Run ();

            if (retVal == ResponseType.Ok) {
                foreach (string file in fileChooser.Filenames) {
                    result.Add (XMLParser.BatchLoadPoints (file));
                }
            }

            fileChooser.Destroy ();
            return result;
        }
开发者ID:justingruber,项目名称:Protractor,代码行数:31,代码来源:CustomFunctions.cs

示例2: OnBtnExeBrowseClicked

 protected void OnBtnExeBrowseClicked(object o, EventArgs args)
 {
     FileChooserDialog fileChooser = new FileChooserDialog("Locate SuperTux Executable", settingsDialog, FileChooserAction.Open, new object[] {});
     fileChooser.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
     fileChooser.AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok);
     fileChooser.DefaultResponse = Gtk.ResponseType.Ok;
     if (fileChooser.Run() == (int)ResponseType.Ok) {
         entryExe.Text = fileChooser.Filename;
     }
     fileChooser.Destroy();
 }
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:11,代码来源:SettingsDialog.cs

示例3: OnBtnDataDirBrowseClicked

 protected void OnBtnDataDirBrowseClicked(object o, EventArgs args)
 {
     FileChooserDialog fileChooser = new FileChooserDialog("Locate SuperTux Data Directory", settingsDialog, FileChooserAction.SelectFolder, new object[] {});
     fileChooser.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
     fileChooser.AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok);
     fileChooser.DefaultResponse = Gtk.ResponseType.Ok;
     if (fileChooser.Run() == (int)ResponseType.Ok) {
         entryDataDir.Text = fileChooser.Filename;
     }
     fileChooser.Destroy();
 }
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:11,代码来源:SettingsDialog.cs

示例4: OnButton46Clicked

		protected void OnButton46Clicked (object sender, EventArgs e)
		{
			Gtk.FileChooserDialog fcd = new FileChooserDialog("Save File",null, FileChooserAction.Save, new object[0]);
			fcd.AddButton("Cancel",ResponseType.Cancel);
			fcd.AddButton("OK",ResponseType.Ok);
			if((ResponseType)fcd.Run() == ResponseType.Ok) {
				_filename = fcd.Filename;
				this.entry3.Text = fcd.Filename;
			}

			fcd.Destroy();
		}
开发者ID:Meticulus,项目名称:tactical,代码行数:12,代码来源:filter_file_dialog.cs

示例5: OnButton41Clicked

 protected void OnButton41Clicked(object sender, EventArgs e)
 {
     FileChooserDialog fcd = new FileChooserDialog("Select LunaLua Directory", null, FileChooserAction.SelectFolder);
     fcd.AddButton(Stock.Cancel, ResponseType.Cancel);
     fcd.AddButton(Stock.Ok, ResponseType.Ok);
     int ret = fcd.Run();
     if (ret == (int)ResponseType.Ok)
     {
         lunaLuaDirEntry.Text = fcd.Filename;
     }
     fcd.Destroy();
 }
开发者ID:Luigifan,项目名称:LuaScriptsManager,代码行数:12,代码来源:SettingsUI.cs

示例6: open_file

		void open_file (object sender, EventArgs e)
		{
			Gtk.FileChooserDialog fcd = new FileChooserDialog("Oopen File",null, FileChooserAction.Open, new object[0]);
			fcd.AddButton("Cancel",ResponseType.Cancel);
			fcd.AddButton("OK",ResponseType.Ok);
			if((ResponseType)fcd.Run() == ResponseType.Ok) {
				String mimetype = meticulus.servers.common.mime_types.GetMimeType(System.IO.Path.GetExtension(fcd.Filename));
				view(fcd.Filename, mimetype);
			}
			fcd.Destroy();

		}
开发者ID:Meticulus,项目名称:tactical,代码行数:12,代码来源:default_viewer.cs

示例7: add_attachment

    protected virtual void add_attachment(object sender, System.EventArgs e)
    {
        FileChooserDialog Fcd = new FileChooserDialog ("Open file", null, FileChooserAction.Open);

        Fcd.AddButton(Stock.Cancel, ResponseType.Cancel);
        Fcd.AddButton(Stock.Open, ResponseType.Ok);

        ResponseType RetVal = (ResponseType)Fcd.Run();

        if (RetVal == ResponseType.Ok)
            attach_box.Text = Fcd.Filename;

        Fcd.Destroy();
    }
开发者ID:josephlewis42,项目名称:personal_codebase,代码行数:14,代码来源:MainWindow.cs

示例8: ChooseDialog

        // creates a custom choose dialog
        static string[] ChooseDialog(FileChooserAction action, string title, bool many)
        {
            FileChooserDialog dialog = new FileChooserDialog (title, null, action);

            if (last_folder != null)
                dialog.SetCurrentFolder (last_folder);
            if (many)
                dialog.SelectMultiple = true;

            dialog.AddButton (Stock.Cancel, ResponseType.Cancel);
            dialog.AddButton (Stock.Ok, ResponseType.Ok);

            int response = dialog.Run ();
            string[] ret = null;

            if ((ResponseType) response == ResponseType.Ok)
                ret = dialog.Filenames;
            if ((ResponseType) response == ResponseType.Cancel)
                ret = null;

            last_folder = dialog.CurrentFolder;
            dialog.Destroy ();

            if(ret != null && ret.Length == 0) ret = null;
            return ret;
        }
开发者ID:gsterjov,项目名称:fusemc,代码行数:27,代码来源:Dialogs.cs

示例9: OpenFile

    private void OpenFile()
    {
        Gtk.FileChooserDialog fcd = new Gtk.FileChooserDialog("Open JSON File", this, FileChooserAction.Open);
        fcd.AddButton(Stock.Cancel, ResponseType.Cancel);
        fcd.AddButton(Stock.Ok, ResponseType.Ok);
        fcd.Filter = new FileFilter();
        fcd.Filter.AddPattern("*json");
        if (fcd.Run() == (int)ResponseType.Ok)
        {
            //TODO: open the file lmao
            JsonSerializer jsr = new JsonSerializer();
            using (StreamReader sr = new StreamReader(fcd.Filename))
            {
                using (JsonReader jr = new JsonTextReader(sr))
                {
                    this.db = jsr.Deserialize<List<LuaModule>>(jr);
                }
            }
            LoadDatabaseIntoView();
        }

        fcd.Destroy();
    }
开发者ID:Luigifan,项目名称:LuaScriptsManager,代码行数:23,代码来源:MainWindow.cs

示例10: OnButtonBrowseClicked

        protected virtual void OnButtonBrowseClicked(object sender, System.EventArgs e)
        {
            FileChooserDialog dlg = new FileChooserDialog ("Select Folder", this, FileChooserAction.SelectFolder);
            try {
                dlg.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
                dlg.AddButton (Gtk.Stock.Open, Gtk.ResponseType.Ok);

                dlg.SetFilename (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
                if (dlg.Run () == (int) ResponseType.Ok) {
                    pathEntry.Text = dlg.Filename;
                }
            } finally {
                dlg.Destroy ();
            }
        }
开发者ID:slluis,项目名称:mono-addins,代码行数:15,代码来源:NewSiteDialog.cs

示例11: OnChoose

    private void OnChoose(object o, EventArgs args)
    {
        FileChooserDialog dialog = new FileChooserDialog("Choose resource", null, FileChooserAction.Open, new object[] {});
        dialog.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
        dialog.AddButton(Gtk.Stock.Open, Gtk.ResponseType.Ok);
        dialog.DefaultResponse = Gtk.ResponseType.Ok;

        dialog.Action = FileChooserAction.Open;
        dialog.SetFilename(Settings.Instance.SupertuxData + entry.Text);
        int result = dialog.Run();
        if(result != (int) ResponseType.Ok) {
            dialog.Destroy();
            return;
        }

        if(dialog.Filename.StartsWith(Settings.Instance.SupertuxData))
            entry.Text = dialog.Filename.Substring(Settings.Instance.SupertuxData.Length,
                                                   dialog.Filename.Length - Settings.Instance.SupertuxData.Length);
        else
            entry.Text = System.IO.Path.GetFileName(dialog.Filename);
        // Fixes backslashes on windows:
        entry.Text = entry.Text.Replace("\\", "/");
        dialog.Destroy();
    }
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:24,代码来源:ChooseResourceWidget.cs

示例12: ImportInstance

        public string ImportInstance()
        {
            FileChooserDialog browserDlg = new FileChooserDialog(
                "Import .minecraft folder", this, FileChooserAction.SelectFolder);
            browserDlg.SelectMultiple = false;

            browserDlg.AddButton("_Cancel", 0);
            browserDlg.AddButton("_Select Folder", 1);

            int response = browserDlg.Run();

            if (response == 1)
            {
                return browserDlg.Filename;
            }
            else
            {
                return null;
            }
        }
开发者ID:Altreus,项目名称:MultiMC,代码行数:20,代码来源:MainWindow.cs

示例13: ExportData

        public static void ExportData(Connection conn, Gtk.Window parent, string dn)
        {
            FileChooserDialog fcd = new FileChooserDialog (
                Mono.Unix.Catalog.GetString ("Save LDIF export as"),
                Gtk.Stock.Save,
                parent,
                FileChooserAction.Save);

            fcd.AddButton (Gtk.Stock.Cancel, ResponseType.Cancel);
            fcd.AddButton (Gtk.Stock.Save, ResponseType.Ok);

            fcd.SelectMultiple = false;

            ResponseType response = (ResponseType) fcd.Run();
            if (response == ResponseType.Ok)  {

                string data = export (conn, dn);

                try {

                    using (StreamWriter sw = new StreamWriter(fcd.Filename))
                    {
                        sw.Write (data);
                    }

                } catch (Exception e) {

                    Log.Debug (e);

                    HIGMessageDialog dialog = new HIGMessageDialog (
                        parent,
                        0,
                        Gtk.MessageType.Error,
                        Gtk.ButtonsType.Ok,
                        "Export error",
                        e.Message);

                    dialog.Run ();
                    dialog.Destroy ();
                }
            }

            fcd.Destroy();
        }
开发者ID:MrJoe,项目名称:lat,代码行数:44,代码来源:Util.cs

示例14: ChooseFiles

        string[] ChooseFiles(string dialogTitle)
        {
            FileChooserDialog fcDialog = new FileChooserDialog(
                dialogTitle, this, FileChooserAction.Open);
            fcDialog.AddButton("_Cancel", ResponseType.Cancel);
            fcDialog.AddButton("_Add", ResponseType.Ok);

            string[] files = new string[0];

            fcDialog.Response += (o, args) =>
                {
                    if (args.ResponseId == ResponseType.Ok)
                        files = fcDialog.Filenames;

                    fcDialog.Destroy();
                };

            fcDialog.Run();
            return files;
        }
开发者ID:Glought,项目名称:MultiMC,代码行数:20,代码来源:EditModsDialog.cs

示例15: OnBrowse

        void OnBrowse(object o, EventArgs args)
        {
            FileChooserDialog chooser_dialog = new FileChooserDialog (
                Catalog.GetString ("Open Location") , null,
                browse_file ? FileChooserAction.Open : FileChooserAction.SelectFolder);

            if (browse_file) {
                if (default_dir != null)
                    chooser_dialog.SetCurrentFolder (default_dir);
            }
            else {
                chooser_dialog.SetCurrentFolder (filename.Text);
            }

            chooser_dialog.AddButton (Stock.Cancel, ResponseType.Cancel);
            chooser_dialog.AddButton (Stock.Open, ResponseType.Ok);
            chooser_dialog.DefaultResponse = ResponseType.Ok;
            chooser_dialog.LocalOnly = false;

            if (filters != null) {
                foreach (Gtk.FileFilter filter in filters)
                    chooser_dialog.AddFilter (filter);
            }

            if (chooser_dialog.Run () == (int) ResponseType.Ok) {
                filename.Text = chooser_dialog.Filename;

                if (FileSelectedChanged != null)
                    FileSelectedChanged (this, EventArgs.Empty);
            }

            chooser_dialog.Destroy ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:33,代码来源:BrowseFile.cs


注:本文中的Gtk.FileChooserDialog.AddButton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。