本文整理汇总了C#中System.Program.Run方法的典型用法代码示例。如果您正苦于以下问题:C# Program.Run方法的具体用法?C# Program.Run怎么用?C# Program.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Program
的用法示例。
在下文中一共展示了Program.Run方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
Gnome.Program program =
new Program("collection-properties", "0.10.0", Modules.UI, args);
Store store = Store.GetStore();
if(args.Length < 1)
{
Console.WriteLine("Usage: ColPropViewer [collectionID]");
Console.WriteLine(" where collectionID is:");
foreach(ShallowNode sn in store)
{
Collection col = store.GetCollectionByID(sn.ID);
Console.WriteLine("{0} : {1}", col.Name, col.ID);
}
}
else
{
Collection col = store.GetCollectionByID(args[0]);
if(col != null)
{
CollectionProperties cp = new CollectionProperties();
cp.Collection = col;
cp.Closed += new EventHandler(on_cp_closed);
cp.Show();
program.Run();
}
}
}
示例2: Main
public static void Main(string[] args)
{
Gnome.Program program =
new Program("slogger", "0.10.0", Modules.UI, args);
GtkSlogger slogger = new GtkSlogger();
slogger.ShowAll();
program.Run();
}
示例3: Main
public static void Main(string[] args)
{
Gnome.Program program =
new Program("contact-browser", "0.10.0", Modules.UI, args);
ContactBrowser cb = new ContactBrowser();
cb.AddrBookClosed += new EventHandler(on_cb_closed);
cb.ShowAll();
program.Run();
}
示例4: Main
public static void Main(string[] args)
{
Gnome.Program program =
new Program("pobox-viewer", "0.10.0", Modules.UI, args);
POBoxViewer poBox = new POBoxViewer();
poBox.ViewerClosed += new EventHandler(on_po_closed);
poBox.ShowAll();
program.Run();
}
示例5: Main
static void Main(string[] args)
{
//Create a new instance of the program class
Program program = new Program();
//Run the program
program.Run();
//Instead of terminating the programing immediately, wait for a key press to exit
Console.WriteLine("\r\nProgram terminated. Press any key to exit.");
Console.ReadKey();
}
示例6: Main
public static void Main(string[] args)
{
Gnome.Program program =
new Program("invitation-assistant", "0.10.0", Modules.UI, args);
InvitationAssistant inviteAss;
if(args.Length > 0)
inviteAss = new InvitationAssistant(args[0]);
else
inviteAss = new InvitationAssistant();
inviteAss.AssistantClosed += new EventHandler(on_assistant_closed);
inviteAss.ShowAll();
program.Run();
}
示例7: Main
public static int Main(string[] args)
{
if (args.Length == 0)
return 0;
Gnome.Program program =
new Program ("Nautilus-Extension-UI", "0.1.0", Modules.UI, args);
Util.InitCatalog();
switch (args [0]) {
case "share":
return showShareDialog (args);
case "properties":
return showPropertiesDialog (args);
case "help":
return showHelp (args);
}
program.Run ();
return 0;
}
示例8: Main
//.........这里部分代码省略.........
GLib.LogFunc logFunc = new GLib.LogFunc (GLib.Log.PrintTraceLogFunction);
GLib.Log.SetLogHandler ("GdkPixbuf", GLib.LogLevelFlags.Critical, logFunc);
// Debug Gtk critical warnings
GLib.Log.SetLogHandler ("Gtk", GLib.LogLevelFlags.Critical, logFunc);
break;
case "--uninstalled": case "--gdb":
break;
default:
if (args [i].StartsWith ("--profile"))
break;
if (args [i].StartsWith ("--trace"))
break;
Log.DebugFormat ("Unparsed argument >>{0}<<", args [i]);
Help ();
return 1;
}
}
// Validate command line options
if ( (import_uri != null && (view || shutdown || slideshow)) ||
(view && (shutdown || slideshow)) ||
(shutdown && slideshow) ) {
Log.Error ("Can't mix -import, -view, -shutdown or -slideshow");
return 1;
}
if (slideshow == true) {
Catalog.Init ("f-spot", Defines.LOCALE_DIR);
Core core = new Core ();
core.ShowSlides (null);
program.Run ();
Log.Debug ("done");
return 0;
}
try {
uint timer = Log.InformationTimerStart ("Initializing DBus");
try {
NDesk.DBus.BusG.Init();
} catch (Exception e) {
throw new ApplicationException ("F-Spot cannot find the Dbus session bus. Make sure dbus is configured properly or start a new session for f-spot using \"dbus-launch f-spot\"", e);
}
Log.DebugTimerPrint (timer, "DBusInitialization took {0}");
uint ma_timer = Log.InformationTimerStart ("Initializing Mono.Addins");
AddinManager.Initialize (FSpot.Global.BaseDirectory);
AddinManager.Registry.Update (null);
SetupService setupService = new SetupService (AddinManager.Registry);
string maj_version = String.Join (".", Defines.VERSION.Split ('.'), 0, 3);
foreach (AddinRepository repo in setupService.Repositories.GetRepositories ())
if (repo.Url.StartsWith ("http://addins.f-spot.org/") && !repo.Url.StartsWith ("http://addins.f-spot.org/" + maj_version)) {
Log.InformationFormat ("Unregistering {0}", repo.Url);
setupService.Repositories.RemoveRepository (repo.Url);
}
setupService.Repositories.RegisterRepository (null, "http://addins.f-spot.org/" + maj_version, false);
Log.DebugTimerPrint (ma_timer, "Mono.Addins Initialization took {0}");
bool create = true;
int retry_count = 0;
while (control == null) {
try {
示例9: Main
static private void Main (string [] args)
{
Program program = new Program ("TagSelectionWidgetTest", "0.0", Modules.UI, args);
Test test = new Test ();
program.Run ();
}
示例10: Main
static void Main (String[] args)
{
ParseArgs (args);
Program best = new Program ("best", "0.0", Modules.UI, args);
try {
GeckoUtils.Init ();
} catch (DllNotFoundException) {
// We might get this exception if there are
// missing symbols from the Mozilla runtime if
// the user did a Firefox 1.0 -> 1.5 upgrade.
// There's nothing we can do about this, it's
// an ABI change, so tell the user this is
// probably what's wrong.
Console.WriteLine (Catalog.GetString ("Best cannot initialize Mozilla's Gecko runtime environment.\n" +
"Have you upgraded Mozilla or Firefox recently? If so, you\n" +
"probably need to rebuild beagle against this new version.\n" +
"See http://bugzilla.gnome.org/show_bug.cgi?id=326503 for\n" +
"more information."));
Environment.Exit (1);
}
GeckoUtils.SetSystemFonts ();
// I18N
Catalog.Init ("beagle", ExternalStringsHack.LocaleDir);
// Create the window.
BestWindow win;
if (query != "") {
win = new BestWindow (query);
win.Show ();
} else {
win = new BestWindow ();
if (showWindow)
win.Show ();
}
// Create the tray icon.
BestTray icon;
if (doTray) {
icon = new BestTray (win, autostarted);
icon.Show ();
Console.WriteLine (Catalog.GetString ("If you're wondering whether Best is working check " +
"your notification area (system tray)"));
} else {
win.Show ();
win.Present ();
win.FocusEntry ();
win.DeleteEvent += new Gtk.DeleteEventHandler (NoTrayWindowDeleteEvent);
}
best.Run ();
}
示例11: Main
public static int Main (string[] args)
{
Program kit = new Program ("gnome-hello-world", "0.0.1", Modules.UI,
args);
GnomeHelloWorld hello = new GnomeHelloWorld ();
Gtk.Window win = hello.CreateWindow ();
win.ShowAll ();
kit.Run ();
return 0;
}
示例12: Main
public static void Main(string [] args)
{
bool empty = false;
Program program = null;
ICore control = null;
SetProcessName (Defines.PACKAGE);
try {
FSpotOptions options = new FSpotOptions ();
options.ProcessArgs (args);
if (!options.Validate ()) {
options.DoHelp ();
return;
}
if (options.basedir != null) {
FSpot.Global.BaseDirectory = options.basedir;
System.Console.WriteLine("BaseDirectory is now {0}", FSpot.Global.BaseDirectory);
}
if (options.photodir != null) {
FSpot.Global.PhotoDirectory = System.IO.Path.GetFullPath(options.photodir);
System.Console.WriteLine("PhotoDirectory is now {0}", FSpot.Global.PhotoDirectory);
}
if (options.slideshow) {
Catalog.Init ("f-spot", Defines.LOCALE_DIR);
program = new Program (Defines.PACKAGE,
Defines.VERSION,
Modules.UI, args);
Core core = new Core ();
core.ShowSlides (null);
program.Run ();
System.Console.WriteLine ("done");
return;
}
try {
NDesk.DBus.BusG.Init();
} catch (Exception e) {
throw new ApplicationException ("F-Spot cannot find the Dbus session bus. Make sure dbus is configured properly or start a new session for f-spot using \"dbus-launch f-spot\"", e);
}
/*
* FIXME we need to inialize gobject before making the dbus calls, we'll go
* ahead and do it like this for now.
*/
program = new Program (Defines.PACKAGE,
Defines.VERSION,
Modules.UI, args);
Console.WriteLine ("Initializing Mono.Addins");
Mono.Addins.AddinManager.Initialize (FSpot.Global.BaseDirectory);
Mono.Addins.AddinManager.Registry.Update (null);
bool create = true;
while (control == null) {
try {
control = Core.FindInstance ();
System.Console.WriteLine ("Found active FSpot server: {0}", control);
program = null;
} catch (System.Exception) {
if (!options.shutdown)
System.Console.WriteLine ("Starting new FSpot server");
}
Core core = null;
try {
if (control == null && create) {
create = false;
Gnome.Vfs.Vfs.Initialize ();
StockIcons.Initialize ();
Catalog.Init ("f-spot", Defines.LOCALE_DIR);
Gtk.Window.DefaultIconList = new Gdk.Pixbuf [] {PixbufUtils.LoadFromAssembly ("f-spot-16.png"),
PixbufUtils.LoadFromAssembly ("f-spot-22.png"),
PixbufUtils.LoadFromAssembly ("f-spot-32.png"),
PixbufUtils.LoadFromAssembly ("f-spot-48.png")};
core = new Core (options.view);
core.RegisterServer ();
// FIXME: Error checking is non-existant here...
empty = options.view || Core.Database.Empty;
control = core;
}
} catch (System.Exception e) {
System.Console.WriteLine ("XXXXX{1}{0}{1}XXXXX", e, Environment.NewLine);
control = null;
if (core != null)
core.UnregisterServer ();
}
if (control == null)
System.Console.WriteLine ("Can't get a connection to the dbus. Trying again...");
}
UriList list = new UriList ();
//.........这里部分代码省略.........