public async Task AddPaneByLink(string link) { var dynamicComponentRegexp = @"/page/[\S]*"; if (PaneList.Find(pane => pane.Key == link) != null) { return; } if (Regex.IsMatch(link, dynamicComponentRegexp)) { var dynamicComponentClass = Regex.Match(link, dynamicComponentRegexp); var panelClassName = dynamicComponentClass.Value.Substring(6); var menu = await menuService.GetMenuDataByLink(link); var menuSegments = await menuService.GetMenuDataSegmentsByLink(menu); Console.WriteLine(JsonSerializer.Serialize(menuSegments)); PaneList.Add(new Pane { Link = panelClassName, Title = menu.Label, Key = link, MenuSegments = menuSegments }); tabs.ActiveKey = link; StateHasChanged(); } else { showCounter = true; } }
public Form1() { InitializeComponent(); // we'll calculate all of our incoming data relative to this point in time _startTime = DateTime.UtcNow; // construct our graph _graphControl = new ZedGraphControl() { Dock = DockStyle.Fill }; _graphControl.MouseClick += GraphControl_MouseClick; _graphControl.GraphPane.Title.Text = "Myo EMG Data vs Time"; MasterPane Main_Pane = _graphControl.MasterPane; Main_Pane.PaneList.Clear(); _pointPairs = new PointPairList[NUMBER_OF_SENSORS]; _sortOrderZ = new List <LineItem>(); Panes = new PaneList(); for (int i = 0; i < 8; i++) { Panes.Add(new GraphPane()); Main_Pane.Add(Panes[i]); Panes[i].XAxis.Scale.MajorStep = 100; Panes[i].YAxis.Scale.Max = 200; Panes[i].YAxis.Scale.Min = -200; _pointPairs[i] = new PointPairList(); var dataPointLine = Panes[i].AddCurve("Sensor " + i, _pointPairs[i], DATA_SERIES_COLORS[i]); dataPointLine.Line.IsVisible = true; _sortOrderZ.Add(dataPointLine); } Controls.Add(_graphControl); // get set up to listen for Myo events _channel = Channel.Create(ChannelDriver.Create(ChannelBridge.Create(), MyoErrorHandlerDriver.Create(MyoErrorHandlerBridge.Create()))); _hub = Hub.Create(_channel); _hub.MyoConnected += Hub_MyoConnected; _hub.MyoDisconnected += Hub_MyoDisconnected; }
/// <summary> /// The get pane list. /// </summary> /// <param name="pane"> /// The pane. /// </param> /// <returns> /// The <see cref="PaneList"/>. /// </returns> private PaneList GetPaneList(PaneBase pane) { // For a single GraphPane, create a PaneList to contain it // Otherwise, just use the paneList from the MasterPane PaneList paneList; if (pane is GraphPane) { paneList = new PaneList(); paneList.Add((GraphPane)pane); } else { paneList = ((MasterPane)pane).PaneList; } return paneList; }