public void NativeSessionStatusChanged(ConnectionStatusArguments args)
        {
            this.ConnectionStatus = args.Status;

            if (args.ErrorNumber != (int)RDConnectionError.ConnectionErrorNone &&
                args.ErrorNumber != (int)RDConnectionError.ConnectionErrorCanceled &&
                (int)args.ErrorNumber > 0 &&
                (int)args.ErrorNumber < m_errorDescriptions.Length)
            {
                args.ErrorMessage = m_errorDescriptions[(int)args.ErrorNumber];
            }

            if (this.ConnectionStatus == RtsConnectionStatus.rtsConnectionConnected)
            {
                string sel = "sessionView";

                if (m_nativeController.RespondsToSelector(sel))
                {
                    this.SessionView = m_nativeController.SendMessage <NSView>(sel);
                }
            }            /* else if (this.ConnectionStatus == RtsConnectionStatus.rtsConnectionClosed) {
                          *     this.SessionView = null;
                          * } */

            if (this.ConnectionStatusChanged != null)
            {
                this.ConnectionStatusChanged(this, args);
            }

            if (this.ConnectionStatus == RtsConnectionStatus.rtsConnectionConnected &&
                this.ContentSizeChanged != null)
            {
                this.ContentSizeChanged(this, new ContentSizeChangedEventArgs(this.ContentSize));
            }
        }
        public override void Disconnect()
        {
            NativeSessionStatusChanged(ConnectionStatusArguments.ArgumentsWithStatus(RtsConnectionStatus.rtsConnectionDisconnecting));

            // Delay by 1 second to demonstrate progress
            ApiUtils.ExecuteAfterDelay(() => {
                NativeSessionStatusChanged(ConnectionStatusArguments.ArgumentsWithStatus(RtsConnectionStatus.rtsConnectionClosed));
            }, 1000);
        }
        public override void NativeSessionStatusChanged(ConnectionStatusArguments args)
        {
            ConnectionStatus = args.Status;

            ConnectionStatusChangedHandler ev = ConnectionStatusChanged;

            if (ev != null)
            {
                ev(this, args);
            }
        }
        public override void Connect()
        {
            LogConnectionInfo();

            NativeSessionStatusChanged(ConnectionStatusArguments.ArgumentsWithStatus(RtsConnectionStatus.rtsConnectionConnecting));

            // Delay by 1 second to demonstrate progress
            ApiUtils.ExecuteAfterDelay(() => {
                m_sessionViewController = new DummySessionViewController();
                SessionView             = m_sessionViewController.View;

                NativeSessionStatusChanged(ConnectionStatusArguments.ArgumentsWithStatus(RtsConnectionStatus.rtsConnectionConnected));
            }, 1000);
        }
		public void NativeSessionStatusChanged(ConnectionStatusArguments args)
		{
			this.ConnectionStatus = args.Status;
					
			if (args.ErrorNumber != (int)RDConnectionError.ConnectionErrorNone && 
			    args.ErrorNumber != (int)RDConnectionError.ConnectionErrorCanceled &&
			    (int)args.ErrorNumber > 0 && 
			    (int)args.ErrorNumber < m_errorDescriptions.Length)
			{
				args.ErrorMessage = m_errorDescriptions[(int)args.ErrorNumber];
			}
			
			if (this.ConnectionStatus == RtsConnectionStatus.rtsConnectionConnected) {
				string sel = "sessionView";
				
				if (m_nativeController.RespondsToSelector(sel))
					this.SessionView = m_nativeController.SendMessage<NSView>(sel);
			}/* else if (this.ConnectionStatus == RtsConnectionStatus.rtsConnectionClosed) {
				this.SessionView = null;
			} */
			
			if (this.ConnectionStatusChanged != null)
				this.ConnectionStatusChanged(this, args);

			if (this.ConnectionStatus == RtsConnectionStatus.rtsConnectionConnected &&
			    this.ContentSizeChanged != null)
				this.ContentSizeChanged(this, new ContentSizeChangedEventArgs(this.ContentSize));
		}