public static void Main (string[] args)
		{
			Application.Init ();
			if (args.Length == 0) {
				ShowHelp ();
				return;
			}
			if (args [0] == "-c") {
				if (args.Length != 2) {
					ShowHelp ();
					return;
				}
				service = InstrumentationService.GetRemoteService (args[1]);
				try {
					service.GetCategories ();
				} catch (Exception ex) {
					MessageDialog md = new MessageDialog (null, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, "Could not connect to instrumentation service: " + ex.Message);
					md.Run ();
					md.Destroy ();
					return;
				}
			} else if (args.Length == 1) {
				LoadServiceData (args[0]);
			} else {
				ShowHelp ();
				return;
			}
			
			InstrumentationViewerDialog win = new InstrumentationViewerDialog ();
			win.Show ();
			Application.Run ();
		}
Beispiel #2
0
		public static void Main (string[] args)
		{
			Application.Init ();
			if (args.Length == 0) {
				ShowHelp ();
				return;
			}
			if (args [0] == "-c") {
				if (args.Length != 2) {
					ShowHelp ();
					return;
				}
				service = InstrumentationService.GetRemoteService (args[1]);
				try {
					service.GetCategories ();
				} catch (Exception ex) {
					MessageDialog md = new MessageDialog (null, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, "Could not connect to instrumentation service: " + ex.Message);
					md.Run ();
					md.Destroy ();
					return;
				}
			} else if (args.Length == 1) {
				LoadServiceData (args[0]);
			} else {
				ShowHelp ();
				return;
			}
			
			InstrumentationViewerDialog win = new InstrumentationViewerDialog ();
			win.Show ();
			
			if (MacIntegration.PlatformDetection.IsMac) {
				try {
					Carbon.SetProcessName ("MDMonitor");
					
					ApplicationEvents.Quit += delegate (object sender, ApplicationQuitEventArgs e) {
						Application.Quit ();
						e.Handled = true;
					};
					
					ApplicationEvents.Reopen += delegate (object sender, ApplicationEventArgs e) {
						if (win != null) {
							win.Deiconify ();
							win.Visible = true;
							e.Handled = true;
						}
					};
				} catch (Exception ex) {
					Console.Error.WriteLine ("Installing Mac AppleEvent handlers failed. Skipping.\n" + ex);
				}
				try {
					win.InstallMacGlobalMenu ();
				} catch (Exception ex) {
					Console.Error.WriteLine ("Installing Mac IGE Main Menu failed. Skipping.\n" + ex);
				}
			}
			
			Application.Run ();
		}
Beispiel #3
0
        public static void Main(string[] args)
        {
            Application.Init();
            if (args.Length == 0)
            {
                ShowHelp();
                return;
            }
            if (args [0] == "-c")
            {
                if (args.Length != 2)
                {
                    ShowHelp();
                    return;
                }
                service = InstrumentationService.GetRemoteService(args[1]);
                try {
                    service.GetCategories();
                } catch (Exception ex) {
                    MessageDialog md = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, "Could not connect to instrumentation service: " + ex.Message);
                    md.Run();
                    md.Destroy();
                    return;
                }
            }
            else if (args.Length == 1)
            {
                LoadServiceData(args[0]);
            }
            else
            {
                ShowHelp();
                return;
            }

            InstrumentationViewerDialog win = new InstrumentationViewerDialog();

            win.Show();
            Application.Run();
        }
        public static void Main(string[] args)
        {
            Application.Init();
            if (args.Length == 0)
            {
                ShowHelp();
                return;
            }
            if (args [0] == "-c")
            {
                if (args.Length != 2)
                {
                    ShowHelp();
                    return;
                }
                service = InstrumentationService.GetRemoteService(args[1]);
                try
                {
                    service.GetCategories();
                }
                catch (Exception ex)
                {
                    MessageDialog md = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, "Could not connect to instrumentation service: " + ex.Message);
                    md.Run();
                    md.Destroy();
                    return;
                }
            }
            else if (args.Length == 1)
            {
                LoadServiceData(args[0]);
            }
            else
            {
                ShowHelp();
                return;
            }

            InstrumentationViewerDialog win = new InstrumentationViewerDialog();

            win.Show();

            if (MacIntegration.PlatformDetection.IsMac)
            {
                try
                {
                    Carbon.SetProcessName("MDMonitor");

                    ApplicationEvents.Quit += delegate(object sender, ApplicationQuitEventArgs e)
                    {
                        Application.Quit();
                        e.Handled = true;
                    };

                    ApplicationEvents.Reopen += delegate(object sender, ApplicationEventArgs e)
                    {
                        if (win != null)
                        {
                            win.Deiconify();
                            win.Visible = true;
                            e.Handled   = true;
                        }
                    };
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Installing Mac AppleEvent handlers failed. Skipping.\n" + ex);
                }
                try
                {
                    win.InstallMacGlobalMenu();
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Installing Mac IGE Main Menu failed. Skipping.\n" + ex);
                }
            }

            Application.Run();
        }