Пример #1
0
        private void ToolBarButtonClick(object sender, EventArgs e)
        {
            var b = sender as ToolStripMenuItem;

            if (_log.Enabled)
            {
                _log.Debug(GetHashCode(), "ToolBarButtonClick " + b.Name);
            }

            if (_sessions.Count > 0)
            {
                var currentSession = ((ViewerForm)ActiveMdiChild).Session;

                switch (b.Name)
                {
                case "clearToolStripMenuItem":
                    currentSession.Viewer.Clear();
                    break;

                case "settingsToolStripMenuItem":
                    var f = new ConfigureSession(currentSession);
                    f.ShowDialog(this);
                    f.Dispose();
                    ActiveMdiChild.Text = currentSession.Title;
                    break;

                case "pauseToolStripMenuItem":
                    currentSession.Viewer.Paused = !currentSession.Viewer.Paused;
                    UpdatePauseButton();
                    break;

                case "actionsToolStripMenuItem":
                    var ma = new ManageActions((TextViewer)currentSession.Viewer);
                    ma.ShowDialog(this);
                    ma.Dispose();
                    break;

                case "wordWrapToolStripMenuItem":
                    currentSession.Viewer.WordWrap = !currentSession.Viewer.WordWrap;
                    UpdateWordWrapButton();
                    break;
                }
            }

            switch (b.Name)
            {
            case "newSessionToolStripMenuItem":
                StartListening();
                EnableButtons();
                break;

            case "aboutToolStripMenuItem":
                var a = new About();
                a.ShowDialog();
                break;
            }
        }
Пример #2
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Пример #3
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (Source == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Source");
     }
     if (Source != null)
     {
         Source.Validate();
     }
     if (ManageActions != null)
     {
         ManageActions.Validate();
     }
 }