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 InstrumenationChartView (InstrumentationViewerDialog parent)
		{
			Build ();
			
			this.parent = parent;
			
			// The list for the List Mode
			
			listViewStore = new ListStore (typeof(ListViewValueInfo), typeof(Gdk.Pixbuf), typeof (string), typeof(string), typeof(string), typeof (string), typeof (string));
			listView = new TreeView ();
			listView.Model = listViewStore;
			
			CellRendererText crx = new CellRendererText ();
			listView.AppendColumn ("Timestamp", crx, "text", 3);
			
			TreeViewColumn col = new TreeViewColumn ();
			col.Title = "Counter";
			CellRendererPixbuf crp = new CellRendererPixbuf ();
			col.PackStart (crp, false);
			col.AddAttribute (crp, "pixbuf", 1);
			col.PackStart (crx, true);
			col.AddAttribute (crx, "text", 2);
			listView.AppendColumn (col);
			
			listView.AppendColumn ("Count", crx, "text", 4);
			listView.AppendColumn ("Total Count", crx, "text", 5);
			listView.AppendColumn ("Time", crx, "text", 6);
			
			listView.RowActivated += HandleListViewRowActivated;
			
			listViewScrolled = new ScrolledWindow ();
			listViewScrolled.Add (listView);
			listViewScrolled.ShadowType = ShadowType.In;
			listViewScrolled.HscrollbarPolicy = PolicyType.Automatic;
			listViewScrolled.VscrollbarPolicy = PolicyType.Automatic;
			listViewScrolled.ShowAll ();
			boxCharts.PackStart (listViewScrolled, true, true, 0);
			
			// The series list
			
			seriesStore = new ListStore (typeof(bool), typeof(Gdk.Pixbuf), typeof (string), typeof(ChartSerieInfo), typeof(String), typeof(String), typeof (String));
			listSeries.Model = seriesStore;
			
			col = new TreeViewColumn ();
			col.Title = "Counter";
			CellRendererToggle crt = new CellRendererToggle ();
			col.PackStart (crt, false);
			col.AddAttribute (crt, "active", 0);
			
			crp = new CellRendererPixbuf ();
			col.PackStart (crp, false);
			col.AddAttribute (crp, "pixbuf", 1);
			
			crx = new CellRendererText ();
			col.PackStart (crx, true);
			col.AddAttribute (crx, "text", 2);
			listSeries.AppendColumn (col);
			
			listSeries.AppendColumn ("Last", crx, "text", 4);
			listSeries.AppendColumn ("Sel", crx, "text", 5);
			listSeries.AppendColumn ("Diff", crx, "text", 6);
			
			crt.Toggled += SerieToggled;
			
			countChart = new BasicChart ();
			countAxisY = new IntegerAxis (true);
			countAxisX = new DateTimeAxis (true);
			countChart.AddAxis (countAxisX, AxisPosition.Bottom);
			countChart.AddAxis (countAxisY, AxisPosition.Right);
			countChart.OriginY = 0;
			countChart.StartY = 0;
//			countChart.EndY = 100;
			countChart.AllowSelection = true;
			countChart.SetAutoScale (AxisDimension.Y, false, true);
			countChart.SelectionStart.LabelAxis = countAxisX;
			countChart.SelectionEnd.LabelAxis = countAxisX;
			countChart.SelectionChanged += CountChartSelectionChanged;
			
			timeChart = new BasicChart ();
			timeAxisY = new IntegerAxis (true);
			timeAxisX = new DateTimeAxis (true);
			timeChart.AddAxis (timeAxisX, AxisPosition.Bottom);
			timeChart.AddAxis (timeAxisY, AxisPosition.Right);
			timeChart.OriginY = 0;
			timeChart.StartY = 0;
			timeChart.EndY = 100;
			timeChart.AllowSelection = true;
//			timeChart.SetAutoScale (AxisDimension.Y, true, true);
			timeChart.SelectionStart.LabelAxis = timeAxisX;
			timeChart.SelectionEnd.LabelAxis = timeAxisX;
			
			frameCharts.PackStart (countChart, true, true, 0);
			frameCharts.PackStart (timeChart, true, true, 0);
			frameCharts.ShowAll ();
			
			if (App.FromFile) {
				if (visibleTime > App.Service.EndTime - App.Service.StartTime)
					visibleTime = App.Service.EndTime - App.Service.StartTime;
				startTime = App.Service.StartTime;
				endTime = startTime + visibleTime;
			}
			else {
				endTime = DateTime.Now;
				startTime = endTime - visibleTime;
			}
			
			DateTime st = App.Service.StartTime;
			if (st > startTime) st = startTime;
			
			chartScroller.Adjustment.Lower = st.Ticks;
			
			UpdateCharts ();
			chartScroller.Value = chartScroller.Adjustment.Upper;
			
			if (!App.FromFile)
				StartAutoscroll ();
			
			toggleTimeView.Active = true;
		}
Beispiel #5
0
        public InstrumenationChartView(InstrumentationViewerDialog parent)
        {
            Build();

            this.parent = parent;

            // The list for the List Mode

            listViewStore  = new ListStore(typeof(ListViewValueInfo), typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
            listView       = new TreeView();
            listView.Model = listViewStore;

            CellRendererText crx = new CellRendererText();

            listView.AppendColumn("Timestamp", crx, "text", 3);

            TreeViewColumn col = new TreeViewColumn();

            col.Title = "Counter";
            CellRendererPixbuf crp = new CellRendererPixbuf();

            col.PackStart(crp, false);
            col.AddAttribute(crp, "pixbuf", 1);
            col.PackStart(crx, true);
            col.AddAttribute(crx, "text", 2);
            listView.AppendColumn(col);

            listView.AppendColumn("Count", crx, "text", 4);
            listView.AppendColumn("Total Count", crx, "text", 5);
            listView.AppendColumn("Time", crx, "text", 6);

            listView.RowActivated += HandleListViewRowActivated;

            listViewScrolled = new ScrolledWindow();
            listViewScrolled.Add(listView);
            listViewScrolled.ShadowType       = ShadowType.In;
            listViewScrolled.HscrollbarPolicy = PolicyType.Automatic;
            listViewScrolled.VscrollbarPolicy = PolicyType.Automatic;
            listViewScrolled.ShowAll();
            boxCharts.PackStart(listViewScrolled, true, true, 0);

            // The series list

            seriesStore      = new ListStore(typeof(bool), typeof(Gdk.Pixbuf), typeof(string), typeof(ChartSerieInfo), typeof(String), typeof(String), typeof(String));
            listSeries.Model = seriesStore;

            col       = new TreeViewColumn();
            col.Title = "Counter";
            CellRendererToggle crt = new CellRendererToggle();

            col.PackStart(crt, false);
            col.AddAttribute(crt, "active", 0);

            crp = new CellRendererPixbuf();
            col.PackStart(crp, false);
            col.AddAttribute(crp, "pixbuf", 1);

            crx = new CellRendererText();
            col.PackStart(crx, true);
            col.AddAttribute(crx, "text", 2);
            listSeries.AppendColumn(col);

            listSeries.AppendColumn("Last", crx, "text", 4);
            listSeries.AppendColumn("Sel", crx, "text", 5);
            listSeries.AppendColumn("Diff", crx, "text", 6);

            crt.Toggled += SerieToggled;

            countChart = new BasicChart();
            countAxisY = new IntegerAxis(true);
            countAxisX = new DateTimeAxis(true);
            countChart.AddAxis(countAxisX, AxisPosition.Bottom);
            countChart.AddAxis(countAxisY, AxisPosition.Right);
            countChart.OriginY = 0;
            countChart.StartY  = 0;
//			countChart.EndY = 100;
            countChart.AllowSelection = true;
            countChart.SetAutoScale(AxisDimension.Y, false, true);
            countChart.SelectionStart.LabelAxis = countAxisX;
            countChart.SelectionEnd.LabelAxis   = countAxisX;
            countChart.SelectionChanged        += CountChartSelectionChanged;

            timeChart = new BasicChart();
            timeAxisY = new IntegerAxis(true);
            timeAxisX = new DateTimeAxis(true);
            timeChart.AddAxis(timeAxisX, AxisPosition.Bottom);
            timeChart.AddAxis(timeAxisY, AxisPosition.Right);
            timeChart.OriginY        = 0;
            timeChart.StartY         = 0;
            timeChart.EndY           = 100;
            timeChart.AllowSelection = true;
//			timeChart.SetAutoScale (AxisDimension.Y, true, true);
            timeChart.SelectionStart.LabelAxis = timeAxisX;
            timeChart.SelectionEnd.LabelAxis   = timeAxisX;

            frameCharts.PackStart(countChart, true, true, 0);
            frameCharts.PackStart(timeChart, true, true, 0);
            frameCharts.ShowAll();

            if (App.FromFile)
            {
                if (visibleTime > App.Service.EndTime - App.Service.StartTime)
                {
                    visibleTime = App.Service.EndTime - App.Service.StartTime;
                }
                startTime = App.Service.StartTime;
                endTime   = startTime + visibleTime;
            }
            else
            {
                endTime   = DateTime.Now;
                startTime = endTime - visibleTime;
            }

            DateTime st = App.Service.StartTime;

            if (st > startTime)
            {
                st = startTime;
            }

            chartScroller.Adjustment.Lower = st.Ticks;

            UpdateCharts();
            chartScroller.Value = chartScroller.Adjustment.Upper;

            if (!App.FromFile)
            {
                StartAutoscroll();
            }

            toggleTimeView.Active = true;
        }
        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();
        }