本文整理汇总了C#中Gtk.FileChooserDialog.Hide方法的典型用法代码示例。如果您正苦于以下问题:C# FileChooserDialog.Hide方法的具体用法?C# FileChooserDialog.Hide怎么用?C# FileChooserDialog.Hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.FileChooserDialog
的用法示例。
在下文中一共展示了FileChooserDialog.Hide方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnButtonLoadPhotoClicked
protected void OnButtonLoadPhotoClicked(object sender, EventArgs e)
{
FileChooserDialog Chooser = new FileChooserDialog ("Выберите фото для загрузки...",
(Window)this.Toplevel,
FileChooserAction.Open,
"Отмена", ResponseType.Cancel,
"Загрузить", ResponseType.Accept);
FileFilter Filter = new FileFilter ();
Filter.AddPixbufFormats ();
Filter.Name = "Все изображения";
Chooser.AddFilter (Filter);
if ((ResponseType)Chooser.Run () == ResponseType.Accept) {
Chooser.Hide ();
logger.Info ("Загрузка фотографии...");
FileStream fs = new FileStream (Chooser.Filename, FileMode.Open, FileAccess.Read);
if (Chooser.Filename.ToLower ().EndsWith (".jpg")) {
using (MemoryStream ms = new MemoryStream ()) {
fs.CopyTo (ms);
ImageFile = ms.ToArray ();
}
} else {
logger.Info ("Конвертация в jpg ...");
Gdk.Pixbuf image = new Gdk.Pixbuf (fs);
ImageFile = image.SaveToBuffer ("jpeg");
}
fs.Close ();
buttonSavePhoto.Sensitive = true;
logger.Info ("Ok");
}
Chooser.Destroy ();
}
示例2: GetTemplateFromDisk
public static byte[] GetTemplateFromDisk()
{
//Читаем файл документа
FileChooserDialog Chooser = new FileChooserDialog ("Выберите шаблон документа...",
null,
FileChooserAction.Open,
"Отмена", ResponseType.Cancel,
"Выбрать", ResponseType.Accept);
FileFilter Filter = new FileFilter ();
Filter.Name = "ODT документы и OTT шаблоны";
Filter.AddMimeType ("application/vnd.oasis.opendocument.text");
Filter.AddMimeType ("application/vnd.oasis.opendocument.text-template");
Filter.AddPattern ("*.odt");
Filter.AddPattern ("*.ott");
Chooser.AddFilter (Filter);
Filter = new FileFilter ();
Filter.Name = "Все файлы";
Filter.AddPattern ("*.*");
Chooser.AddFilter (Filter);
byte[] file = null;
if ((ResponseType)Chooser.Run () == ResponseType.Accept) {
Chooser.Hide ();
logger.Info ("Чтение файла...");
file = File.ReadAllBytes(Chooser.Filename);
logger.Info ("Ok");
}
Chooser.Destroy ();
return file;
}
示例3: OnChooseClick
protected virtual void OnChooseClick(object sender, System.EventArgs e)
{
FileChooserDialog dlg = new FileChooserDialog (Catalog.GetString ("Choose Executable or Script"), this,
FileChooserAction.Open, Catalog.GetString ("Cancel"),
ResponseType.Cancel, Catalog.GetString ("OK"),
ResponseType.Accept);
if (dlg.Run () == (int)ResponseType.Accept) {
execEntry.Text = dlg.Filename;
dlg.Hide ();
}
dlg.Destroy ();
}
示例4: OnAdd
protected void OnAdd(object s, EventArgs args)
{
FileChooserDialog dialog = new FileChooserDialog (Catalog.GetString (Catalog.GetString ("Add Widget Library")), null, FileChooserAction.Open,
Gtk.Stock.Cancel, Gtk.ResponseType.Cancel,
Gtk.Stock.Open, Gtk.ResponseType.Ok);
int response = dialog.Run ();
if (response == (int)Gtk.ResponseType.Ok) {
SteticMain.SteticApp.AddWidgetLibrary (dialog.Filename);
AddLibrary (dialog.Filename);
LoadList ();
}
dialog.Hide ();
}
示例5: ImagePreviewWidget
public ImagePreviewWidget()
{
this.Build ();
saveDialog = new FileChooserDialog (
"",
null,
FileChooserAction.Save,
"Cancel", ResponseType.Cancel,
"Save", ResponseType.Accept
);
imageloader.OnLoaded += (ImageLoader obj) => {
imageloader.ShowButtons = true;
UpdateTitle ();
};
imageloader.OnSaveClick += (string obj) => {
saveDialog.CurrentName = System.IO.Path.GetFileName (imageloader.Url);
if (saveDialog.Run () == (int)ResponseType.Accept) {
imageloader.Image.Pixbuf.Save (saveDialog.Filename, "jpeg");
}
saveDialog.Hide ();
};
}
示例6: OnButtonSavePhotoClicked
protected void OnButtonSavePhotoClicked(object sender, EventArgs e)
{
FileChooserDialog fc =
new FileChooserDialog ("Укажите файл для сохранения фотографии",
(Window)this.Toplevel,
FileChooserAction.Save,
"Отмена", ResponseType.Cancel,
"Сохранить", ResponseType.Accept);
fc.CurrentName = (GetSaveFileName != null ? GetSaveFileName() : "фото") + ".jpg";
fc.Show ();
if (fc.Run () == (int)ResponseType.Accept) {
fc.Hide ();
FileStream fs = new FileStream (fc.Filename, FileMode.Create, FileAccess.Write);
fs.Write (ImageFile, 0, ImageFile.Length);
fs.Close ();
}
fc.Destroy ();
}
示例7: OnOpen
protected void OnOpen(object o, EventArgs e) {
FileChooserDialog fileChooser = new FileChooserDialog("Select TileSet", MainWindow, 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;
Gtk.FileFilter filter;
filter = new Gtk.FileFilter();
filter.Name = "Supertux tilesets";
filter.AddPattern("*.strf");
filter.AddPattern("*.stgt");
fileChooser.AddFilter( filter );
filter = new Gtk.FileFilter();
filter.Name = "Supertux 0.1.x tilesets";
filter.AddPattern("*.stgt");
fileChooser.AddFilter( filter );
filter = new Gtk.FileFilter();
filter.Name = "Supertux 0.3.x tilesets";
filter.AddPattern("*.strf");
fileChooser.AddFilter( filter );
Gtk.FileFilter all = new Gtk.FileFilter();
all.Name = "All Files";
all.AddPattern("*");
fileChooser.AddFilter( all );
int result = fileChooser.Run();
fileChooser.Hide();
if(result != (int) ResponseType.Ok)
return;
LoadTileSet(fileChooser.Filename);
}
示例8: on_open_activate
public void on_open_activate(System.Object b, EventArgs e)
{
statusbar.Pop (gameStatusbarId);
FileChooserDialog fd = new FileChooserDialog (Catalog.GetString ("Open Game"), csboardWindow, FileChooserAction.Open);
fd.AddButton (Stock.Close, (int) ResponseType.Close);
fd.AddButton (Stock.Open, (int) ResponseType.Ok);
if (fd.Run () == (int)ResponseType.Ok) {
control.OpenGame (fd.Filename);
control.SaveGame(App.session.Filename);
}
fd.Hide ();
fd.Dispose ();
}
示例9: on_save_activate
public void on_save_activate(System.Object b, EventArgs e)
{
FileChooserDialog fd = new FileChooserDialog (Catalog.GetString("Save Game"), csboardWindow, FileChooserAction.Save);
fd.AddButton (Stock.Close, (int) ResponseType.Close);
fd.AddButton (Stock.Save, (int) ResponseType.Ok);
int res = fd.Run();
fd.Hide ();
if (res == (int) ResponseType.Ok) {
if (System.IO.File.Exists (fd.Filename)) {
MessageDialog md =
new MessageDialog (csboardWindow,
DialogFlags.
DestroyWithParent,
MessageType.Warning,
ButtonsType.OkCancel,
Catalog.GetString("File ") + fd.Filename +
Catalog.GetString(" already exists\n\n") +
Catalog.GetString("Do you wish to overwrite it?"));
if (md.Run () == (int)ResponseType.Ok) {
control.SaveGame (fd.Filename);
}
md.Hide ();
md.Dispose ();
} else {
control.SaveGame (fd.Filename);
}
}
fd.Dispose ();
}
示例10: OnSaveAsActionActivated
protected void OnSaveAsActionActivated(object sender, EventArgs e)
{
if(DocTemplate == null)
return;
FileChooserDialog fc=
new FileChooserDialog("Укажите файл для сохранения шаблона...",
this,
FileChooserAction.Save,
"Отмена",ResponseType.Cancel,
"Сохранить",ResponseType.Accept);
//FileFilter filter = new FileFilter();
fc.CurrentName = DocTemplate.Name + ".xml";
fc.Show();
if(fc.Run() == (int) ResponseType.Accept)
{
fc.Hide();
FileStream fs = new FileStream(fc.Filename, FileMode.Create, FileAccess.Write);
DocTemplate.SaveToStream(fs);
fs.Close();
}
fc.Destroy();
}
示例11: OnButtonSaveClicked
protected void OnButtonSaveClicked(object sender, EventArgs e)
{
TreePath sel = iconviewFiles.SelectedItems [0];
TreeIter iter;
FilesStore.GetIter (out iter, sel);
FileChooserDialog fc =
new FileChooserDialog ("Укажите путь для сохранения файла",
(Gtk.Window)this.Toplevel,
FileChooserAction.Save,
"Отмена", ResponseType.Cancel,
"Сохранить", ResponseType.Accept);
fc.CurrentName = (string)FilesStore.GetValue (iter, (int)FilesCol.name);
fc.Show ();
if (fc.Run () == (int)ResponseType.Accept) {
fc.Hide ();
logger.Info ("Сохраняем файл на диск...");
byte[] file = (byte[])FilesStore.GetValue (iter, (int)FilesCol.file);
if (file == null) {
file = LoadFileFromDB ((int)FilesStore.GetValue (iter, (int)FilesCol.id));
}
System.IO.File.WriteAllBytes (fc.Filename, file);
}
fc.Destroy ();
logger.Info ("Ок");
}
示例12: checkFile
protected void checkFile(Constants.EncoderCheckFileOp checkFileOp)
{
string exportString = "";
if(checkFileOp == Constants.EncoderCheckFileOp.CAPTURE_EXPORT_ALL)
exportString = Catalog.GetString ("Export set in CSV format");
else if(checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_IMAGE)
exportString = Catalog.GetString ("Save image");
else if(checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_AB)
exportString = Catalog.GetString ("Export repetition in CSV format");
else if(checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_TABLE)
exportString = Catalog.GetString ("Save table");
string nameString = currentPerson.Name + "_" + currentSession.DateShortAsSQL;
if(checkFileOp == Constants.EncoderCheckFileOp.CAPTURE_EXPORT_ALL)
nameString += "_encoder_set_export.csv";
else if(checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_IMAGE)
nameString += ".png";
else if(checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_AB)
nameString += "_encoder_repetition_export.csv";
else if(checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_TABLE)
nameString += "_encoder_curves_table.csv";
Gtk.FileChooserDialog fc=
new Gtk.FileChooserDialog(exportString,
app1,
FileChooserAction.Save,
Catalog.GetString("Cancel"),ResponseType.Cancel,
Catalog.GetString("Accept"),ResponseType.Accept
);
fc.CurrentName = nameString;
if (fc.Run() == (int)ResponseType.Accept)
{
exportFileName = fc.Filename;
//add ".csv" if needed
if(checkFileOp == Constants.EncoderCheckFileOp.CAPTURE_EXPORT_ALL ||
checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_AB ||
checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_TABLE)
exportFileName = Util.AddCsvIfNeeded(exportFileName);
else
exportFileName = Util.AddPngIfNeeded(exportFileName);
try {
if (File.Exists(exportFileName)) {
LogB.Information(string.Format(
"File {0} exists with attributes {1}, created at {2}",
exportFileName,
File.GetAttributes(exportFileName),
File.GetCreationTime(exportFileName)));
LogB.Information("Overwrite...");
ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString(
"Are you sure you want to overwrite file: "), "",
exportFileName);
if(checkFileOp == Constants.EncoderCheckFileOp.CAPTURE_EXPORT_ALL)
confirmWin.Button_accept.Clicked +=
new EventHandler(on_overwrite_file_export_all_curves_accepted);
else if(checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_IMAGE)
confirmWin.Button_accept.Clicked +=
new EventHandler(on_overwrite_file_encoder_save_image_accepted);
else if(checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_AB)
confirmWin.Button_accept.Clicked +=
new EventHandler(on_overwrite_file_encoder_save_AB_accepted);
else if(checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_TABLE)
confirmWin.Button_accept.Clicked +=
new EventHandler(on_overwrite_file_encoder_save_table_accepted);
} else {
if(checkFileOp == Constants.EncoderCheckFileOp.CAPTURE_EXPORT_ALL)
on_button_encoder_export_all_curves_file_selected (exportFileName);
else if(checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_IMAGE)
on_button_encoder_save_image_file_selected (exportFileName);
else if(checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_AB)
on_button_encoder_save_AB_file_selected (exportFileName);
else if(checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_TABLE)
on_button_encoder_save_table_file_selected (exportFileName);
string myString = string.Format(Catalog.GetString("Saved to {0}"),
exportFileName);
if(checkFileOp == Constants.EncoderCheckFileOp.CAPTURE_EXPORT_ALL ||
checkFileOp == Constants.EncoderCheckFileOp.ANALYZE_SAVE_AB)
myString += Constants.SpreadsheetString;
new DialogMessage(Constants.MessageTypes.INFO, myString);
}
} catch {
string myString = string.Format(
Catalog.GetString("Cannot save file {0} "), exportFileName);
new DialogMessage(Constants.MessageTypes.WARNING, myString);
}
}
else {
LogB.Information("cancelled");
//report does not currently send the appBar reference
new DialogMessage(Constants.MessageTypes.INFO, Catalog.GetString("Cancelled."));
fc.Hide ();
return ;
}
//Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
fc.Destroy();
//.........这里部分代码省略.........
示例13: SaveLog
private void SaveLog()
{
try
{
int rc = 0;
bool saveFile = true;
string filename = null;
string initialPath = Util.LastSavedSyncLogPath;
FileChooserDialog fcd = new FileChooserDialog(
Util.GS("Save as..."), this,
FileChooserAction.Save,
Stock.Cancel, ResponseType.Cancel,
Stock.Save, ResponseType.Ok);
fcd.SelectMultiple = false;
fcd.CurrentName = Util.GS("iFolder Synchronization Log.txt");
if (initialPath != null)
fcd.SetCurrentFolder(initialPath);
while (saveFile)
{
rc = fcd.Run();
fcd.Hide();
if(rc == (int)ResponseType.Ok)
{
filename = fcd.Filename;
if(File.Exists(filename))
{
iFolderMsgDialog dialog = new iFolderMsgDialog(
this,
iFolderMsgDialog.DialogType.Question,
iFolderMsgDialog.ButtonSet.YesNo,
"",
Util.GS("Overwrite the existing file?"),
Util.GS("The file you selected exists. Selecting yes will overwrite the contents of this file."));
rc = dialog.Run();
dialog.Hide();
dialog.Destroy();
if(rc != -8)
saveFile = false;
}
}
else
break;
if(saveFile)
{
FileStream fs = null;
try
{
fs = File.Create(filename);
}
catch (System.UnauthorizedAccessException uae)
{
iFolderMsgDialog dg = new iFolderMsgDialog(
this,
iFolderMsgDialog.DialogType.Error,
iFolderMsgDialog.ButtonSet.Ok,
"",
Util.GS("Insufficient access"),
Util.GS("You do not have access to save the file in the location you specified. Please select a different location."));
dg.Run();
dg.Hide();
dg.Destroy();
continue;
}
catch (Exception e)
{
iFolderMsgDialog dg = new iFolderMsgDialog(
this,
iFolderMsgDialog.DialogType.Error,
iFolderMsgDialog.ButtonSet.Ok,
"",
Util.GS("Error saving the log file"),
string.Format(Util.GS("An exception occurred trying to save the log: {0}"), e.Message),
e.StackTrace);
dg.Run();
dg.Hide();
dg.Destroy();
continue;
}
if(fs != null)
{
TreeIter iter;
StreamWriter w = new StreamWriter(fs);
if(LogTreeStore.GetIterFirst(out iter))
{
string logEntry =
(string)LogTreeStore.GetValue(iter, 0);
w.WriteLine(logEntry);
while(LogTreeStore.IterNext(ref iter))
{
logEntry =
(string)LogTreeStore.GetValue(iter, 0);
w.WriteLine(logEntry);
}
}
w.Close();
Util.LastSavedSyncLogPath = filename;
break;
}
else
{
//.........这里部分代码省略.........
示例14: OnSingleWizBrowseButtonClicked
private void OnSingleWizBrowseButtonClicked(object o, EventArgs e)
{
FileChooserDialog filedlg = new FileChooserDialog("", Util.GS("Select a file..."), this, FileChooserAction.Open, Stock.Cancel, ResponseType.Cancel,Stock.Ok, ResponseType.Ok);
FileFilter filter = new FileFilter();
filter.Name = "PKCS12 files";
filter.AddMimeType("PKCS12|p12");
filter.AddPattern("*.p12");
filedlg.AddFilter(filter);
filter = new FileFilter();
filter.Name = "PFX files";
filter.AddMimeType("PFX|pfx");
filter.AddPattern("*.pfx");
filedlg.AddFilter(filter);
filter = new FileFilter();
filter.Name = "All files";
filter.AddMimeType("All|all");
filter.AddPattern("*.*");
filedlg.AddFilter(filter);
int res = filedlg.Run();
string str = filedlg.Filename;
filedlg.Hide();
filedlg.Destroy();
if( res == (int)ResponseType.Ok)
{
this.p12FilePath.Text = str;
}
}
示例15: OnImportBrowseButtonClicked
private void OnImportBrowseButtonClicked(object o, EventArgs e)
{
FileChooserDialog filedlg = new FileChooserDialog("", Util.GS("Select a file ...."), this, FileChooserAction.Open, Stock.Cancel, ResponseType.Cancel,Stock.Ok, ResponseType.Ok);
FileFilter filter = new FileFilter();
filter.Name = "XML files";
filter.AddMimeType("XML files|xml");
filter.AddPattern("*.xml");
filedlg.AddFilter(filter);
int res = filedlg.Run();
string str = filedlg.Filename;
filedlg.Hide();
filedlg.Destroy();
if( res == (int)ResponseType.Ok)
{
this.importLocation.Text = str;
}
}