Exemple #1
0
        public GraphViewModel(IApplicationController app, AbstractViewModel chooseVM, Boolean isLive, int width)
            : base()
        {
            _app = app;

            DistanceArray = new ObservableCollection<KeyValuePair<float, float>>();
            SpeedArray = new ObservableCollection<KeyValuePair<float, float>>();

            if (isLive)
            {
                GraphSeconds = 30;
                LineVisibilty = Visibility.Hidden;
                LineVisibilty2 = Visibility.Hidden;
            }
            else
            {
                GraphSeconds = 10;
                LineVisibilty = Visibility.Visible;
                LineVisibilty2 = Visibility.Hidden;
                LineMargin = new Thickness(87, 25, 0, 0);
                LineMargin2 = new Thickness(87, 25, 0, 0);
            }

            LineOneColor = Brushes.Black;
            LineTwoColor = new SolidColorBrush(Color.FromRgb(250, 42, 42));
            DisplayWidth = width;
            WidthChart = width;
            GridWidth = width;
            SizeAxisTime = 30;
            SizeAxisDistance = 30;
            SizeAxisSpeed = 30;

            if (isLive)
            {
                seconds = -1;
                timer = new System.Timers.Timer();
                timer.Interval = 500D;
                timer.Elapsed += new System.Timers.ElapsedEventHandler(this.timer_Elapsed);
                timer.Start();
            }

            // Setup default customization
            HasSecondAxis = Visibility.Visible;
            AxisTitle = "Distance (m)";
            OnPropertyChanged("AxisTitleColor");
            IsSpecializedGraph = false;
            AxisTimeMaximum = GraphSeconds;
            AxisMaxLeft = 30;
            AxisMaxRight = 10;
            AxisInterval = 5;
        }
Exemple #2
0
 private void _setContent(AbstractViewModel viewModel)
 {
     if (currentViewModel != viewModel)
     {
         mainViewModel.Content = viewModel;
         currentViewModel = viewModel;
     }
 }