Пример #1
0
        // -----------------------DRAW--------------------------------


        /// <summary>
        /// Draw dots already in the StaticValues.dotlist when creating view
        /// </summary>
        private void DrawExistingDots()
        {
            foreach (GraphDot dot in graphViewModel.GetGraphDotsList())
            {
                if (dot.GraphicDot != null)
                {
                    DrawNewDot(dot);
                }
            }
        }
Пример #2
0
        private GraphViewModel graphViewModel; // the viewmodel class

        /// <summary>
        /// Initializes the GraphView and draws the existing dots
        /// </summary>
        public GraphView()
        {
            InitializeComponent();

            graphViewModel = StaticValues.graphViewModel;
            graphViewModel.SwitchToThisView();

            this.BindingContext = graphViewModel;

            this.SizeChanged                   += graphViewModel.UpdateUiElement; // when the window size is changed, move the dots/values to their correct locations
            SliderZoom.ValueChanged            += KeepScrollPosistion;
            AcceptedLineValueEntry.TextChanged += graphViewModel.UpdateAcceptedValueLine;
            graphViewModel.GetGraphDotsList().CollectionChanged += DrawChangedDots; // Called when a new dot/value is added to the graph list
            StaticValues.graphYValues.CollectionChanged += DrawYValueListChanged;
            GraphScroller.Scrolled += GraphYValuesFollowScroll;

            DrawExistingDots();
            DrawExistingYValues();
        }