/// <summary>
        /// Connect/disconnect the digital system.
        /// </summary>
        internal void SystemConnect()
        {
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                OTCContext.Project.DigitalSystem?.Connect();
            }
            catch (Exception ex)
            {
                StudioContext.LogError(ex.Message);
            }

            this.RefreshStatus();

            Cursor.Current = Cursors.Default;
        }
        /// <summary>
        /// Connect/disconnect the digital system.
        /// </summary>
        internal void SystemConnect()
        {
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                // Register project events
                OTCContext.Project.DigitalSystem.InformationReceived += DigitalSystem_OnInformationReceived;
                OTCContext.Project.DigitalSystem.CommandReceived     += DigitalSystem_OnCommandReceived;

                OTCContext.Project.DigitalSystem?.Connect();
            }
            catch (Exception ex)
            {
                StudioContext.LogError(ex.Message);
            }

            this.RefreshStatus();

            Cursor.Current = Cursors.Default;
        }
        private void DigitalSystem_OnInformationReceived(object sender, Otc.Systems.SystemConsoleEventArgs e)
        {
            switch (e.Type)
            {
            case SystemConsoleEventArgs.MessageType.Error:
                StudioContext.LogError(e.Message);
                break;

            case SystemConsoleEventArgs.MessageType.Warning:
                StudioContext.LogWarning(e.Message);
                break;

            case SystemConsoleEventArgs.MessageType.Debug:
                StudioContext.LogDebug(e.Message);
                break;

            default:
                StudioContext.LogInformation(e.Message);
                break;
            }
        }