예제 #1
0
        /// <summary>
        /// Initializing Controls
        /// </summary>
        private void InitControls()
        {
            try
            {
                // Вкладка №0
                TrackNameTextBox.Text = $"Test track - ({DateTime.Now:HH:mm:ss dd.MM.yy})";
                _track             = new ImitationTrack();
                _track.Author      = "User1";
                _track.Description = "Put here your description...";

                _pinStart = new Pushpin {
                    Content = "A"
                };                                         // Start marker
                _pinEnd = new Pushpin {
                    Content = "B"
                };                                         // End marker
                _pinCar = new Pushpin                      // A marker for playing a route
                {
                    Content    = "->",
                    Background = new SolidColorBrush(Color.FromRgb(53, 196, 53))
                };

                NewGpsDevices         = new ObservableRangeCollection <GpsDevice>();
                TrackPositions        = new ObservableRangeCollection <TrackPosition>();
                OsrmWayPointsPushpins = new ObservableRangeCollection <DraggablePin>();

                NewImitationTrackGpsDevicesDataGrid.ItemsSource = NewGpsDevices;
                TrackPositionsDataGrid.ItemsSource   = TrackPositions;
                WayPointsForOsrmDataGrid.ItemsSource = OsrmWayPointsPushpins;

                NewGpsDevices.Add(new GpsDevice(0)
                {
                    Imei = "000002245678915"
                });
                NewGpsDevices.Add(new GpsDevice(0)
                {
                    Imei = "444555678154689"
                });

                foreach (var item in TabControlItems.Items)
                {
                    _tabItemsIsValidCollection.Add(new bool());
                }

                Player.Timer.Tick += Timer_Tick;
                Player.PlayerSlider.ValueChanged += PlayerSlider_ValueChanged;
                TrackPositions.CollectionChanged += TrackPositions_CollectionChanged;
                Player.CurrentPosition            = 0;

                CommonData.DataContext = _track;
                TotalView.DataContext  = _track;
            }
            catch (Exception exc)
            {
                LogWindowControl.AddMessage(exc.ToString());
            }
        }
예제 #2
0
        /// <summary>
        /// Clear all data
        /// </summary>
        private void ClearAll()
        {
            // Tab №1
            _track = new ImitationTrack();
            TrackNameTextBox.Text        = String.Empty;
            AuthorTextBox.Text           = String.Empty;
            TrackDescriptionTextBox.Text = String.Empty;

            // Tab №3
            NewGpsDevices.Clear();

            // Tabs №2-3
            ClearMapInfo();

            CheckTabItems();
        }
예제 #3
0
        /// <summary>
        /// Clone track
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CloneTrackButton_OnClick(object sender, RoutedEventArgs e)
        {
            var result = MessageBox.Show($"Do you want to save the current track?", "Saving data", MessageBoxButton.OKCancel, MessageBoxImage.Information);

            if (result.Equals(MessageBoxResult.OK))
            {
                SaveCreatedTrack();
            }

            _track = _track.Clone() as ImitationTrack;

            if (_track != null)
            {
                _track.Name           = _track.Name += " Cloned at " + DateTime.Now.ToString("HH:mm:ss dd.MM.yyyy");
                TrackNameTextBox.Text = _track.Name;

                LogWindowControl.AddMessage($"The track was successfully cloned as { _track.Name }");
            }
        }