예제 #1
0
        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;
        }
예제 #3
0
파일: GraphForm.cs 프로젝트: zrolfs/pwiz
        public GraphForm(Manager manager)
        {
            InitializeComponent();

            this.manager = manager;
            paneList     = new PaneList();
            paneLayout   = PaneLayout.SingleColumn;

            msGraphControl.BorderStyle = BorderStyle.None;

            msGraphControl.MasterPane.InnerPaneGap = 1;
            msGraphControl.MouseDownEvent         += new ZedGraphControl.ZedMouseEventHandler(msGraphControl_MouseDownEvent);
            msGraphControl.MouseMoveEvent         += new ZedGraphControl.ZedMouseEventHandler(msGraphControl_MouseMoveEvent);

            msGraphControl.ZoomButtons      = MouseButtons.Left;
            msGraphControl.ZoomModifierKeys = Keys.None;
            msGraphControl.ZoomButtons2     = MouseButtons.None;

            msGraphControl.UnzoomButtons      = new MSGraphControl.MouseButtonClicks(MouseButtons.Middle);
            msGraphControl.UnzoomModifierKeys = Keys.None;
            msGraphControl.UnzoomButtons2     = new MSGraphControl.MouseButtonClicks(MouseButtons.None);

            msGraphControl.UnzoomAllButtons  = new MSGraphControl.MouseButtonClicks(MouseButtons.Left, 2);
            msGraphControl.UnzoomAllButtons2 = new MSGraphControl.MouseButtonClicks(MouseButtons.None);

            msGraphControl.PanButtons      = MouseButtons.Left;
            msGraphControl.PanModifierKeys = Keys.Control;
            msGraphControl.PanButtons2     = MouseButtons.None;

            msGraphControl.ContextMenuBuilder += new MSGraphControl.ContextMenuBuilderEventHandler(GraphForm_ContextMenuBuilder);

            msGraphControl.GraphPane.YAxis.ScaleFormatEvent += YAxis_ScaleFormatEvent;

            ContextMenuStrip dummyMenu = new ContextMenuStrip();

            dummyMenu.Opening      += new CancelEventHandler(foo_Opening);
            TabPageContextMenuStrip = dummyMenu;
        }
예제 #4
0
파일: Legend.cs 프로젝트: tu-tran/FareLiz
        /// <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;
        }
예제 #5
0
파일: Legend.cs 프로젝트: tu-tran/FareLiz
        /// <summary>
        /// The get max height.
        /// </summary>
        /// <param name="paneList">
        /// The pane list.
        /// </param>
        /// <param name="g">
        /// The g.
        /// </param>
        /// <param name="scaleFactor">
        /// The scale factor.
        /// </param>
        /// <returns>
        /// The <see cref="float"/>.
        /// </returns>
        private float GetMaxHeight(PaneList paneList, Graphics g, float scaleFactor)
        {
            // Set up some scaled dimensions for calculating sizes and locations
            float defaultCharHeight = this.FontSpec.GetHeight(scaleFactor);
            float maxCharHeight = defaultCharHeight;

            // Find the largest charHeight, just in case the curves have individual fonts defined
            foreach (GraphPane tmpPane in paneList)
            {
                foreach (CurveItem curve in tmpPane.CurveList)
                {
                    if (curve._label._text != string.Empty && curve._label._isVisible)
                    {
                        float tmpHeight = defaultCharHeight;
                        if (curve._label._fontSpec != null)
                        {
                            tmpHeight = curve._label._fontSpec.GetHeight(scaleFactor);
                        }

                        // Account for multiline legend entries
                        tmpHeight *= curve._label._text.Split('\n').Length;

                        if (tmpHeight > maxCharHeight)
                        {
                            maxCharHeight = tmpHeight;
                        }
                    }
                }
            }

            return maxCharHeight;
        }
예제 #6
0
파일: MasterPane.cs 프로젝트: CareyGit/jx
		/// <summary>
		/// Constructor for deserializing objects
		/// </summary>
		/// <param name="info">A <see c_ref="SerializationInfo"/> instance that defines the serialized data
		/// </param>
		/// <param name="context">A <see c_ref="StreamingContext"/> instance that contains the serialized data
		/// </param>
		protected MasterPane( SerializationInfo info, StreamingContext context ) : base( info, context )
		{
			// The schema value is just a file version parameter.  You can use it to make future versions
			// backwards compatible as new member variables are added to classes
			int sch = info.GetInt32( "schema2" );

			_paneList = (PaneList) info.GetValue( "paneList", typeof(PaneList) );
			//_paneLayoutMgr = (PaneLayoutMgr) info.GetValue( "paneLayoutMgr", typeof(PaneLayoutMgr) );
			_innerPaneGap = info.GetSingle( "innerPaneGap" );

			_isUniformLegendEntries = info.GetBoolean( "isUniformLegendEntries" );
			_isCommonScaleFactor = info.GetBoolean( "isCommonScaleFactor" );

			_paneLayout = (PaneLayout)info.GetValue( "paneLayout", typeof( PaneLayout ) );
			_countList = (int[])info.GetValue( "countList", typeof( int[] ) );

			_isColumnSpecified = info.GetBoolean( "isColumnSpecified" );
			_prop = (float[])info.GetValue( "prop", typeof( float[] ) );

			if ( sch >= 11 )
				_isAntiAlias = info.GetBoolean( "isAntiAlias" );
		}
예제 #7
0
파일: MasterPane.cs 프로젝트: CareyGit/jx
		/// <summary>
		/// The Copy Constructor - Make a deep-copy clone of this class instance.
		/// </summary>
		/// <param name="rhs">The <see c_ref="MasterPane"/> object from which to copy</param>
		public MasterPane( MasterPane rhs ) : base( rhs )
		{
			// copy all the value types
			//_paneLayoutMgr = rhs._paneLayoutMgr.Clone();
			_innerPaneGap = rhs._innerPaneGap;
			_isUniformLegendEntries = rhs._isUniformLegendEntries;
			_isCommonScaleFactor = rhs._isCommonScaleFactor;

			// Then, fill in all the reference types with deep copies
			_paneList = rhs._paneList.Clone();

			_paneLayout = rhs._paneLayout;
			_countList = rhs._countList;
			_isColumnSpecified = rhs._isColumnSpecified;
			_prop = rhs._prop;
			_isAntiAlias = rhs._isAntiAlias;
		}
예제 #8
0
파일: MasterPane.cs 프로젝트: CareyGit/jx
		/// <summary>
		/// Default constructor for the class.  Specifies the <see c_ref="PaneBase.Title"/> of
		/// the <see c_ref="MasterPane"/>, and the size of the <see c_ref="PaneBase.Rect"/>.
		/// </summary>
		public MasterPane( string title, RectangleF paneRect ) : base( title, paneRect )
		{
			_innerPaneGap = Default.InnerPaneGap;

			//_paneLayoutMgr = new PaneLayoutMgr();

			_isUniformLegendEntries = Default.IsUniformLegendEntries ;
			_isCommonScaleFactor = Default.IsCommonScaleFactor;

			_paneList = new PaneList();

			_legend.IsVisible = Default.IsShowLegend;

			_isAntiAlias = false;

			InitLayout();
		}