本文整理汇总了C#中GLib.List.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# List.Dispose方法的具体用法?C# List.Dispose怎么用?C# List.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLib.List
的用法示例。
在下文中一共展示了List.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LaunchWithFiles
void LaunchWithFiles (GLib.File app, IEnumerable<GLib.File> files)
{
AppInfo appinfo = null;
if (app != null) {
appinfo = GLib.DesktopAppInfo.NewFromFilename (app.Path);
} else {
if (!files.Any ())
return;
// if we weren't given an app info, query the file for the default handler
try {
appinfo = files.First ().QueryDefaultHandler (null);
} catch {
// file probably doesnt exist
return;
}
}
try {
GLib.List launchList;
if (!files.Any ()) {
appinfo.Launch (null, null);
// check if the app supports files or Uris
} else if (appinfo.SupportsFiles) {
launchList = new GLib.List (new GLib.File[] {}, typeof (GLib.File), true, false);
foreach (GLib.File f in files)
launchList.Append (f);
appinfo.Launch (launchList, null);
launchList.Dispose ();
} else if (appinfo.SupportsUris) {
launchList = new GLib.List (new string[] {}, typeof (string), true, true);
foreach (GLib.File f in files) {
// try to use GLib.File.Uri first, if that throws an exception,
// catch and use P/Invoke to libdocky. If that's still null, warn & skip the file.
try {
launchList.Append (f.Uri.ToString ());
} catch (UriFormatException) {
string uri = f.StringUri ();
if (string.IsNullOrEmpty (uri)) {
Log<SystemService>.Warn ("Failed to retrieve URI for {0}. It will be skipped.", f.Path);
continue;
}
launchList.Append (uri);
}
}
appinfo.LaunchUris (launchList, null);
launchList.Dispose ();
} else {
Log<SystemService>.Error ("Error opening files. The application doesn't support files/URIs or wasn't found.");
}
} catch (GException e) {
Log.Notify (string.Format ("Error running: {0}", appinfo.Name), Gtk.Stock.DialogWarning, e.Message);
Log<SystemService>.Error (e.Message);
Log<SystemService>.Info (e.StackTrace);
}
(appinfo as IDisposable).Dispose ();
}