本文整理汇总了C#中Gnome.Launch方法的典型用法代码示例。如果您正苦于以下问题:C# Gnome.Launch方法的具体用法?C# Gnome.Launch怎么用?C# Gnome.Launch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gnome
的用法示例。
在下文中一共展示了Gnome.Launch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleOpenWith
public void HandleOpenWith (object sender, Gnome.Vfs.MimeApplication mime_application)
{
Photo[] selected = SelectedPhotos ();
if (selected == null || selected.Length < 1)
return;
string header = Catalog.GetPluralString ("Create New Version?", "Create New Versions?", selected.Length);
string msg = String.Format (Catalog.GetPluralString (
"Before launching {1}, should F-Spot create a new version of the selected photo to preserve the original?",
"Before launching {1}, should F-Spot create new versions of the selected photos to preserve the originals?", selected.Length),
selected.Length, mime_application.Name);
// FIXME add cancel button? add help button?
HigMessageDialog hmd = new HigMessageDialog(GetToplevel (sender), DialogFlags.DestroyWithParent,
MessageType.Question, Gtk.ButtonsType.None,
header, msg);
hmd.AddButton (Gtk.Stock.No, Gtk.ResponseType.No, false);
//hmd.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false);
hmd.AddButton (Gtk.Stock.Yes, Gtk.ResponseType.Yes, true);
Gtk.ResponseType response = Gtk.ResponseType.Cancel;
try {
response = (Gtk.ResponseType) hmd.Run();
} finally {
hmd.Destroy ();
}
if (response == Gtk.ResponseType.Cancel)
return;
bool create_new_versions = (response == Gtk.ResponseType.Yes);
ArrayList errors = new ArrayList ();
GLib.List uri_list = new GLib.List (typeof (string));
foreach (Photo photo in selected) {
try {
if (create_new_versions) {
uint version = photo.CreateNamedVersion (mime_application.Name, photo.DefaultVersionId, true);
photo.DefaultVersionId = version;
}
} catch (Exception e) {
errors.Add (new EditException (photo, e));
}
uri_list.Append (photo.DefaultVersionUri.ToString ());
}
// FIXME need to clean up the error dialog here.
if (errors.Count > 0) {
Dialog md = new EditExceptionDialog (GetToplevel (sender), errors.ToArray (typeof (EditException)) as EditException []);
md.Run ();
md.Destroy ();
}
if (create_new_versions)
db.Photos.Commit (selected);
mime_application.Launch (uri_list);
}
示例2: OpenWith
private void OpenWith (Gnome.Vfs.MimeApplication mime_application)
{
GLib.List uri_list = new GLib.List (typeof (string));
uri_list.Append (Hit.EscapedUri);
mime_application.Launch (uri_list);
}