本文整理汇总了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;
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例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 ();
}
}
示例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();
}
示例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;
}
}
示例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();
}
示例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;
}
示例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 ();
}