Exemplo n.º 1
0
        private void OnModeButtonClick(object sender, ModeButtonClickEventArgs e)
        {
            Button button = e.modeButton;

            Services.Mode mode    = modeManager.GetMode(button);
            Label         counter = mode.GetCounter();
            TextBox       textBox = mode.GetTextBox();

            // Read custom text, if custom mode button was clicked.
            if (mode.IsCustom())
            {
                string logId = loggerGui.GetCustomText(textBox);

                // If no custom Text is entered, text will be "custom".
                if (logId == "")
                {
                    logId = "custom";
                }

                // For custom modes that are not annotations,
                // logId will contain the modeType aswell.
                if (!mode.IsAnnotation())
                {
                    logId = mode.GetModeType() + " " + logId;
                }
                // Annotations will get the additional string "NOTE "
                else
                {
                    logId = "NOTE '" + logId + "'";
                }

                mode.SetLogId(logId);
            }

            // Immediately create logLine for Custom annotations
            if (mode.IsAnnotation() && mode.IsCustom())
            {
                CreateLogLine(mode);
            }
            // For all other mode buttons check if button was already clicked.
            else if (modeManager.GetActiveMode() != mode)
            {
                CreateLogLine(mode);

                // Set mode and button as active. Increase Count.
                modeManager.SetActiveMode(button);
                int count = mode.IncreaseCount();
                if (counter != null)
                {
                    loggerGui.SetModeCounter(counter, count, mode.IsOverLimit());
                }

                // Reset the time in Mode Ticker.
                modeSecTicker.ResetTicker();
                loggerGui.ResetTimeInMode();
            }
        }
Exemplo n.º 2
0
        private void OnModeButtonClick(object sender, ModeButtonClickEventArgs e)
        {
            Button button = e.modeButton;
            Services.Mode mode = modeManager.GetMode(button);
            Label counter = mode.GetCounter();
            TextBox textBox = mode.GetTextBox();

            // Read custom text, if custom mode button was clicked.
            if (mode.IsCustom())
            {
                string logId = loggerGui.GetCustomText(textBox);

                // If no custom Text is entered, text will be "custom".
                if (logId == "")
                {
                    logId = "custom";
                }

                // For custom modes that are not annotations,
                // logId will contain the modeType aswell.
                if (!mode.IsAnnotation())
                {
                    logId = mode.GetModeType() + " " + logId;
                }
                // Annotations will get the additional string "NOTE "
                else
                {
                    logId = "NOTE '" + logId + "'";
                }

                mode.SetLogId(logId);
            }

            // Immediately create logLine for Custom annotations
            if (mode.IsAnnotation() && mode.IsCustom())
            {
                CreateLogLine(mode);
            }
            // For all other mode buttons check if button was already clicked.
            else if (modeManager.GetActiveMode() != mode)
            {
                CreateLogLine(mode);

                // Set mode and button as active. Increase Count.
                modeManager.SetActiveMode(button);
                int count = mode.IncreaseCount();
                if (counter != null)
                {
                    loggerGui.SetModeCounter(counter, count, mode.IsOverLimit());
                }

                // Reset the time in Mode Ticker.
                modeSecTicker.ResetTicker();
                loggerGui.ResetTimeInMode();
            }
        }