partial void InterTreeSegment(NSObject sender) { var s = sender as NSSegmentedControl; if (s.IsSelectedForSegment(0) && InterTreePlotView.Frame.Width <= 20) { InterTreeSplitView.SetPositionOfDivider( (nfloat)Math.Min(674, InterTreeSplitView.Frame.Width - 300), 0); } else if (!s.IsSelectedForSegment(0)) { InterTreeSplitView.SetPositionOfDivider(0, 0); } if (s.IsSelectedForSegment(1) && InterText.Frame.Width <= 20) { NSAnimationContext.RunAnimation((NSAnimationContext a) => { a.AllowsImplicitAnimation = true; a.Duration = 0.5; InterTreeSplitView.SetPositionOfDivider(InterTreeSplitView.Frame.Width - 300, 1); }); } else if (!s.IsSelectedForSegment(1)) { NSAnimationContext.RunAnimation((NSAnimationContext a) => { a.AllowsImplicitAnimation = true; a.Duration = 0.5; InterTreeSplitView.SetPositionOfDivider(InterTreeSplitView.Frame.Width, 1); }); } }
private void InitInterTree() { DeselectProcessors(); plotStatMaxTime = -1; InterTreeSplitView.SetPositionOfDivider( (nfloat)Math.Min(674, InterTreeSplitView.Frame.Width - 300), 0); InterTreeSplitView.SetPositionOfDivider(InterTreeSplitView.Frame.Width, 1); InterTreeSegmentController.SetSelected(false, 1); InterTreeSegmentController.SetSelected(true, 0); }
partial void ResetLoadStat(NSObject sender) { DeselectProcessors(); LoadedStat = null; InterTreePlotView.Model = new OxyPlot.PlotModel(); ((IntervalOutlineDataSource)InterView.DataSource).Intervals.Clear(); InterView.ReloadData(); InterTreeSplitView.SetPositionOfDivider(0, 0); InterTreeSegmentController.SetSelected(false, 0); InterTreeSplitView.SetPositionOfDivider(InterTreeSplitView.Frame.Width, 1); InterTreeSegmentController.SetSelected(false, 1); InterText.Value = ""; LoadStatLabel.StringValue = ""; LoadStatLabel.Hidden = true; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Do any additional setup after loading the view. GPUScrollView.DocumentView = GPUStackView; LoadStatList(); InitDataInterView(); InitInterTree(); InterTreeSplitView.SetPositionOfDivider(0, 0); InterTreeSegmentController.SetSelected(false, 0); //--- Init alerts ---// Alert = new NSAlert(); RemoveAlert = new NSAlert(); NoButtonTag = RemoveAlert.AddButton("Нет").Tag; YesButtonTag = RemoveAlert.AddButton("Да").Tag; RemoveAlert.MessageText = "Вы уверены, что хотите " + "удалить выбранные статистики выполнения?"; CompareList = new StatCompareList(); plotView.Model = new OxyPlot.PlotModel(); //--- Init help button ---// NSButton helpIntervalCompare = new NSButton { BezelStyle = NSBezelStyle.HelpButton, Title = "", BezelColor = NSColor.White }; helpIntervalCompare.SetButtonType(NSButtonType.MomentaryPushIn); helpIntervalCompare.SetFrameSize(helpIntervalCompare.FittingSize); helpIntervalCompare.SetFrameOrigin(new CGPoint(TableHeader.Frame.Width - helpIntervalCompare.FittingSize.Width, 2)); helpIntervalCompare.AutoresizingMask = NSViewResizingMask.MinXMargin; //--- Init help popover ---// var helpWindowController = storyboard .InstantiateControllerWithIdentifier("Popover") as NSWindowController; var helpViewController = helpWindowController .ContentViewController as PopoverController; helpPopover = new NSPopover { ContentSize = new CGSize(200, 180), Behavior = NSPopoverBehavior.Transient, Animates = true, ContentViewController = helpViewController }; helpIntervalCompare.Activated += (object sender, EventArgs e) => helpPopover.Show(new CGRect(helpIntervalCompare.Frame.Location, new CGSize(200, 180)), TableHeader, NSRectEdge.MaxYEdge); TableHeader.AddSubview(helpIntervalCompare); //--- Init Compare Controls ---// CompareSort.Enabled = false; IntervalCompareButton.Enabled = false; CompareDiagramSelect.Enabled = false; CompareSort.RemoveAllItems(); string[] CompareItems = { "Кол-во процессоров", "Потерянное время", "Время выполнения", "Коэф. эффективности" }; CompareSort.AddItems(CompareItems); CompareSort.Activated += (object sender, EventArgs e) => { // TODO: Мб, для этого есть нормальное решение? var selectedRow = (int)CompareIntervalTree.SelectedRow; CompareList.Sort(CompareSort.TitleOfSelectedItem, selectedRow); switch (plotView.Model.Title) { case "Потерянное время": plotView.Model = PlotMaker.LostTimeComparePlot(selectedRow, plotView.Model.GetAxis("Time").ActualMaximum); break; case "ГПУ": plotView.Model = PlotMaker.GPUComparePlot(selectedRow, plotView.Model.GetAxis("Time").ActualMaximum); break; } CompareIntervalTree.ReloadData(); CompareIntervalTree.SelectRow(selectedRow, false); }; CompareIntervalTree.IntercellSpacing = new CGSize(10, 0); var dataSource = new IntervalOutlineDataSource(); CompareIntervalTree.DataSource = dataSource; CompareIntervalTree.Delegate = new IntervalCompareOutlineDelegate(CompareIntervalTree, plotView); IntervalCompareButton.Activated += IntervalCompareButton_Activated; }