コード例 #1
0
        /// <summary>
        /// Occurs when the user selects another tab
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!(DataContext is MainWindowViewModel viewModel))
                return;

            if (viewModel.SelectedTrack == null)
                return;

            if (TabControl.SelectedIndex == 2) // Replay tab
            {
                ReplayControl.LoadData(viewModel.SelectedTrack.TrackId);
            }
            else if (TabControl.SelectedIndex == 3) // Object tab
            {
                ObjectControl.LoadData(viewModel.SelectedTrack.TrackId);
            }
            
        }
コード例 #2
0
        /// <summary>
        /// Occurs when the user selects another track
        /// </summary>
        private void ViewModel_SelectionChanged()
        {
            if (!(DataContext is MainWindowViewModel viewModel))
                return;

            if (viewModel.SelectedTrack == null)
                return;

            if (TabControl.SelectedIndex == 2)
            {
                if (viewModel.SelectedTrack.ReplayCount == 0)
                    TabControl.SelectedIndex = 0;
                else
                    ReplayControl.LoadData(viewModel.SelectedTrack.TrackId);
            }
            else if (TabControl.SelectedIndex == 3)
            {
                if (viewModel.SelectedTrack.EmbeddedObjectsCount == 0)
                    TabControl.SelectedIndex = 0;
                else
                    ObjectControl.LoadData(viewModel.SelectedTrack.TrackId);
            }
        }