Exemplo n.º 1
0
        private void MdiParentForm_Load(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Maximized;

            var projectMruPlaceholder = new MruPlaceholderToolStripMenuItem()
            {
                Text = "<mru>"
            };

            fileToolStripMenuItem.DropDownItems.Insert(10, projectMruPlaceholder);

            var sessionMruPlaceholder = new MruPlaceholderToolStripMenuItem()
            {
                Text = "<mru>"
            };

            sessionToolStripMenuItem.DropDownItems.Insert(7, sessionMruPlaceholder);

            var projectMruFile = Path.Combine(Options.AppDirectory, "projectsMru.json");

            _projectMru = MruMenu.Load(projectMruFile);
            _projectMru.MruItemSelected           += _projectMru_MruItemSelected;
            fileToolStripMenuItem.DropDownOpening += FileToolStripMenuItem_DropDownOpening;

            var sessionMruFile = Path.Combine(Options.AppDirectory, "sessionsMru.json");

            _sessionMru = MruMenu.Load(sessionMruFile);
            _sessionMru.MruItemSelected += _sessionMru_MruItemSelected;
            sessionToolStripMenuItem.DropDownOpening += SessionToolStripMenuItem_DropDownOpening;

            _sessionMru.SetMenuItemState(false);
        }
Exemplo n.º 2
0
        protected virtual void ControllerStateChanged(TelemetryAppStateChangedEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new MethodInvoker(() => { ControllerStateChanged(e); }));
            }
            else
            {
                mnuMainViewMenu.Enabled      = e.NewState.HasFlag(AppState.Ready);
                tlsMainViewToolStrip.Enabled = e.NewState.HasFlag(AppState.Ready);
                tlsSessionToolStrip.Enabled  = e.NewState.HasFlag(AppState.SessionLoaded);

                openProjectToolStripMenuItem.Enabled   = e.NewState.HasFlag(AppState.Ready);
                newProjectToolStripMenuItem.Enabled    = e.NewState.HasFlag(AppState.Ready);
                closeProjectToolStripMenuItem.Enabled  = e.NewState.HasFlag(AppState.ProjectLoaded);
                saveProjectAsToolStripMenuItem.Enabled = e.NewState.HasFlag(AppState.ProjectLoaded);
                saveProjectToolStripMenuItem.Enabled   = e.NewState.HasFlag(AppState.ProjectLoaded);

                btnOpenProject.Enabled   = e.NewState.HasFlag(AppState.Ready);
                btnNewProject.Enabled    = e.NewState.HasFlag(AppState.Ready);
                btnCloseProject.Enabled  = e.NewState.HasFlag(AppState.ProjectLoaded);
                btnSaveProject.Enabled   = e.NewState.HasFlag(AppState.ProjectLoaded);
                btnSaveProjectAs.Enabled = e.NewState.HasFlag(AppState.ProjectLoaded);

                openToolStripMenuItem.Enabled             = e.NewState.HasFlag(AppState.ProjectLoaded);
                closeSessionToolStripMenuItem.Enabled     = e.NewState.HasFlag(AppState.SessionLoaded);
                loadSavedSessionToolStripMenuItem.Enabled = e.NewState.HasFlag(AppState.SessionLoaded);
                saveSessionToolStripMenuItem.Enabled      = e.NewState.HasFlag(AppState.SessionLoaded);
                saveSessionToolStripMenuItem.Enabled      = e.NewState.HasFlag(AppState.SessionLoaded);
                btnOpenSession.Enabled  = e.NewState.HasFlag(AppState.ProjectLoaded);
                btnCloseSession.Enabled = e.NewState.HasFlag(AppState.SessionLoaded);
                _sessionMru?.SetMenuItemState(e.NewState.HasFlag(AppState.ProjectLoaded));

                btnNewHistogramDisplay.Enabled   = e.NewState.HasFlag(AppState.ProjectLoaded);
                btnNewLapTimesDisplay.Enabled    = e.NewState.HasFlag(AppState.ProjectLoaded);
                btnNewWaveformDisplay.Enabled    = e.NewState.HasFlag(AppState.ProjectLoaded);
                btnNewTrackMapDisplay.Enabled    = e.NewState.HasFlag(AppState.ProjectLoaded);
                btnSetupDisplay.Enabled          = e.NewState.HasFlag(AppState.ProjectLoaded);
                btnSessionDetailsDisplay.Enabled = e.NewState.HasFlag(AppState.SessionLoaded);

                histogramToolStripMenuItem.Enabled      = e.NewState.HasFlag(AppState.ProjectLoaded);
                lapTimesToolStripMenuItem.Enabled       = e.NewState.HasFlag(AppState.ProjectLoaded);
                waveformToolStripMenuItem.Enabled       = e.NewState.HasFlag(AppState.ProjectLoaded);
                trackMapToolStripMenuItem.Enabled       = e.NewState.HasFlag(AppState.ProjectLoaded);
                setupToolStripMenuItem.Enabled          = e.NewState.HasFlag(AppState.ProjectLoaded);
                sessionDetailsToolStripMenuItem.Enabled = e.NewState.HasFlag(AppState.ProjectLoaded);

                btnFirstLap.Enabled    = e.NewState.HasFlag(AppState.SessionLoaded);
                btnNextLap.Enabled     = e.NewState.HasFlag(AppState.SessionLoaded);
                btnPreviousLap.Enabled = e.NewState.HasFlag(AppState.SessionLoaded);
                btnLastLap.Enabled     = e.NewState.HasFlag(AppState.SessionLoaded);
                btnFastestLap.Enabled  = e.NewState.HasFlag(AppState.SessionLoaded);

                btnResetZoom.Enabled = e.NewState.HasFlag(AppState.SessionLoaded);
                btnZoomIn.Enabled    = e.NewState.HasFlag(AppState.SessionLoaded);
                btnZoomOut.Enabled   = e.NewState.HasFlag(AppState.SessionLoaded);

                copyToolStripMenuItem.Enabled   = false;
                cutToolStripMenuItem.Enabled    = false;
                pasteToolStripMenuItem.Enabled  = false;
                deleteToolStripMenuItem.Enabled = false;

                btnCut.Enabled    = false;
                btnCopy.Enabled   = false;
                btnPaste.Enabled  = false;
                btnDelete.Enabled = false;

                fieldDefinitionsToolStripMenuItem.Enabled = e.NewState.HasFlag(AppState.Ready);
                btnFieldDefinitions.Enabled             = e.NewState.HasFlag(AppState.Ready);
                functionEditorToolStripMenuItem.Enabled = e.NewState.HasFlag(AppState.Ready);
                btnFunctionEditor.Enabled = e.NewState.HasFlag(AppState.Ready);
                trackMapBuilderToolStripMenuItem.Enabled = e.NewState.HasFlag(AppState.Ready);
                btnTrackMapBuilder.Enabled       = e.NewState.HasFlag(AppState.Ready);
                optionsToolStripMenuItem.Enabled = e.NewState.HasFlag(AppState.Ready);
                btnOptions.Enabled = e.NewState.HasFlag(AppState.Ready);

                btnSaveDisplay.Enabled = e.NewState.HasFlag(AppState.ProjectLoaded);
                saveDisplayToolStripMenuItem.Enabled  = e.NewState.HasFlag(AppState.ProjectLoaded);
                saveDisplayToolStripMenuItem1.Enabled = e.NewState.HasFlag(AppState.ProjectLoaded);
                loadDisplayToolStripMenuItem.Enabled  = e.NewState.HasFlag(AppState.ProjectLoaded);

                openDisplayToolStripMenuItem.Enabled = e.NewState.HasFlag(AppState.ProjectLoaded);
                btnOpenDisplay.Enabled = e.NewState.HasFlag(AppState.ProjectLoaded);

                Console.WriteLine($"Old State: {e.OldState.ToString()}   New State: {e.NewState.ToString()}");

                UpdateProject(Controller?.Project);
                UpdateSession(Controller?.Session);
            }
        }