本文整理汇总了C#中Gtk.FileChooserDialog.SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# FileChooserDialog.SetPosition方法的具体用法?C# FileChooserDialog.SetPosition怎么用?C# FileChooserDialog.SetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.FileChooserDialog
的用法示例。
在下文中一共展示了FileChooserDialog.SetPosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSaveAs
void OnSaveAs(object sender, EventArgs e)
{
var fc=
new FileChooserDialog("Choose the file to save",
_thisDialog,
FileChooserAction.Save,
"Cancel",ResponseType.Cancel,
"Save",ResponseType.Accept);
fc.SetPosition (WindowPosition.Center);
if (fc.Run() == (int)ResponseType.Accept)
{
_fileName = fc.Filename;
System.IO.File.WriteAllText (_fileName, textview1.Buffer.Text);
}
//Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
fc.Destroy();
}
示例2: OnOpen
void OnOpen(object sender, EventArgs e)
{
var fc=
new FileChooserDialog("Choose the file to open",
this,
FileChooserAction.Open,
"Cancel",ResponseType.Cancel,
"Open",ResponseType.Accept);
fc.SetPosition (WindowPosition.Center);
if (fc.Run() == (int)ResponseType.Accept)
{
if (!AppController.Instance.Surface.IsEmpty ()) {
string fileName = Process.GetCurrentProcess ().MainModule.FileName.Replace (".vshost", "");
ProcessStartInfo info = new ProcessStartInfo (fileName);
info.UseShellExecute = false;
info.Arguments = fc.Filename;
Process processChild = Process.Start (info);
} else {
AppController.Instance.FileName = fc.Filename;
var saved = ConfigManager.Read<PrimitivesSurface> (AppController.Instance.FileName);
AppController.Instance.ResetSurface ();
AppController.Instance.ReloadSurface (saved);
_grid.Surface = AppController.Instance.Surface;
_grid.Surface.QueueDraw ();
}
}
//Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
fc.Destroy();
}
示例3: OnSaveAs
void OnSaveAs(object sender, EventArgs e)
{
var fc=
new FileChooserDialog("Enter the file to save",
this,
FileChooserAction.Save,
"Cancel",ResponseType.Cancel,
"Save",ResponseType.Accept);
fc.SetPosition (WindowPosition.Center);
if (fc.Run() == (int)ResponseType.Accept)
{
AppController.Instance.FileName = fc.Filename;
ConfigManager.Write<PrimitivesSurface> (AppController.Instance.Surface, AppController.Instance.FileName);
}
//Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
fc.Destroy();
}
示例4: OnExportToPng
void OnExportToPng(object sender, EventArgs e)
{
var fc=
new FileChooserDialog("Enter the file to save",
this,
FileChooserAction.Save,
"Cancel",ResponseType.Cancel,
"Save",ResponseType.Accept);
fc.SetPosition (WindowPosition.Center);
if (fc.Run() == (int)ResponseType.Accept)
{
_grid.ExportToPng (fc.Filename);
Process.Start (fc.Filename);
}
//Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
fc.Destroy();
}