partial void CompareReset(NSObject sender) { plotView.Model = null; CompareSort.Enabled = false; CompareDiagramSelect.Enabled = false; IntervalCompareButton.Enabled = false; IntervalCompareButton.State = NSCellStateValue.Off; CompareDiagramSelect.SelectItem(0); CompareSort.SelectItem(0); ChooseLabel.Hidden = false; ((IntervalCompareOutlineDelegate)CompareIntervalTree.Delegate).maxTimeLost = -1; ((IntervalCompareOutlineDelegate)CompareIntervalTree.Delegate).maxTimeGPU = -1; ((IntervalOutlineDataSource)CompareIntervalTree.DataSource).Intervals.Clear(); CompareIntervalTree.ReloadData(); CompareSplitView.SetPositionOfDivider(CompareSplitView.Frame.Width, 0); }
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; }
void ReleaseDesignerOutlets() { if (LoadStatLabel != null) { LoadStatLabel.Dispose(); LoadStatLabel = null; } if (ChooseLabel != null) { ChooseLabel.Dispose(); ChooseLabel = null; } if (CompareDiagramSelect != null) { CompareDiagramSelect.Dispose(); CompareDiagramSelect = null; } if (CompareIntervalTree != null) { CompareIntervalTree.Dispose(); CompareIntervalTree = null; } if (CompareSort != null) { CompareSort.Dispose(); CompareSort = null; } if (CompareSplitView != null) { CompareSplitView.Dispose(); CompareSplitView = null; } if (GPUPlotView != null) { GPUPlotView.Dispose(); GPUPlotView = null; } if (GPUScrollView != null) { GPUScrollView.Dispose(); GPUScrollView = null; } if (GPUStackView != null) { GPUStackView.Dispose(); GPUStackView = null; } if (InterText != null) { InterText.Dispose(); InterText = null; } if (InterTreePlotView != null) { InterTreePlotView.Dispose(); InterTreePlotView = null; } if (InterTreeSegmentController != null) { InterTreeSegmentController.Dispose(); InterTreeSegmentController = null; } if (InterTreeSplitView != null) { InterTreeSplitView.Dispose(); InterTreeSplitView = null; } if (IntervalCompareButton != null) { IntervalCompareButton.Dispose(); IntervalCompareButton = null; } if (InterView != null) { InterView.Dispose(); InterView = null; } if (PlotSplitView != null) { PlotSplitView.Dispose(); PlotSplitView = null; } if (plotView != null) { plotView.Dispose(); plotView = null; } if (StatPath != null) { StatPath.Dispose(); StatPath = null; } if (StatTableView != null) { StatTableView.Dispose(); StatTableView = null; } if (TableHeader != null) { TableHeader.Dispose(); TableHeader = null; } if (TabView != null) { TabView.Dispose(); TabView = null; } }
static void Main(string[] args) { var modelFaker = new Faker <User>() .RuleFor(o => o.Id, f => f.Random.Number(1, 650)) .RuleFor(o => o.Age, f => f.Random.Number(15, 90)) .RuleFor(o => o.Company, f => f.Company.CompanyName()) .RuleFor(o => o.IsMarried, f => f.Random.Bool()) .RuleFor(o => o.Name, f => f.Name.FullName()) .RuleFor(o => o.BirthDate, f => f.Date.Future(90)); var allUserData = new List <User>(); //string sortModelField = FluentInterfacePattern.Properties.Settings.Default.sortParameter; //var faker = new Faker("en"); //var emailList = Enumerable.Range(1, 1000) // .Select(_ => faker.Random) // .ToList(); for (int i = 0; i < 1000; i++) { var myModel = modelFaker.Generate(); User tom = new UserBuilder() .SetId(myModel.Id) .SetName(myModel.Name) .SetCompany(myModel.Company) .SetAge(myModel.Age) .SetIsMarried(myModel.IsMarried) .SetBirthDate(myModel.BirthDate); allUserData.Add(tom); } //foreach (var element in allUserData) //{ // Console.WriteLine(element.Id + " " + element.Name + " " + element.Age); //} //allUserData.Sort(new Comparison<User>((x, y) => string.Compare(x.Name, y.Name, StringComparison.InvariantCulture))); //allUserData.Sort(new Comparison<User>((x, y) => string.Compare(x.Id.ToString(), y.Id.ToString(), StringComparison.InvariantCulture))); ShellSort sortShell = new ShellSort(); BubbleSort bubbleSort = new BubbleSort(); LinqSort linqSort = new LinqSort(); CompareSort compareSort = new CompareSort(); InsertionSort insertionSort = new InsertionSort(); QuickSort quickSort = new QuickSort(); var sortedShellCollection = sortShell.ShellSortAlgorithm(allUserData); var sortedBubbleCollection = bubbleSort.BubbleSortAlgorithm(allUserData); var sortedLinqCollection = linqSort.LinqSortAlgorithm(allUserData); var sortedCompareCollection = compareSort.LinqSortAlgorithm(allUserData); var insertionSortCollection = insertionSort.InsertionSortAlgorithm(allUserData); Stopwatch sw = new Stopwatch(); sw.Start(); var quickSortCollection = quickSort.QuickSortAlgorithm(allUserData, 0, allUserData.Count - 1); sw.Stop(); Console.WriteLine("QuickSort: " + sw.ElapsedMilliseconds); Printers.PrintUsers(quickSortCollection); Console.ReadLine(); //============================================ Guid orderId = Guid.Parse("9043f30c-446f-421f-af70-234fe8f57c0d"); Order order = new OrderBuilder() .InitializeOrder(orderId) .ValidateOrder(orderId) .ProcessOrder(orderId) .SaveOrder(orderId); Console.ReadKey(); //============================================ Guid customerId = Guid.Parse("9043f30c-446f-421f-af70-234fe8f57c0d"); Customer customer = new Customer(); customer .InitializeOrder(customerId) .ValidateOrder(customerId) .ProcessOrder() .SaveOrder(); Console.ReadKey(); }