Exemplo n.º 1
0
 public void DeinitControl()
 {
     durationTimer.Enabled = false;
     iconTimer.Enabled = false;
     m_app = null;
     m_session = null;
 }
Exemplo n.º 2
0
        public RunningOverlay(AppScreenSharing _app, AppSharingSession _sess)
            : this()
        {
            Debug.Assert(_app != null);

            this.Text = "Screen Sharing in '" + _app.Helper.GetKwsName() + "'";

            overlayCtrl.InitControl(_app, _sess);
            SetLocation();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initialize the control with the right objects.
        /// </summary>
        /// <param name="_app"></param>
        /// <param name="_ses"></param>
        public void InitControl(AppScreenSharing _app, AppSharingSession _ses)
        {
            Debug.Assert(_app != null);
            Debug.Assert(_ses != null);
            Debug.Assert(_ses.Status == AppSharingSession.AppSharingSessionStatus.RUNNING);

            m_app = _app;
            m_session = _ses;

            durationTimer.Enabled = true;
            iconTimer.Enabled = true;

            UpdateLabels();
            UpdateDuration();
        }
Exemplo n.º 4
0
 public OnVncSessionEventArgs(AppSharingSession _session)
 {
     m_session = _session;
 }
Exemplo n.º 5
0
        public override KwsAnpEventStatus HandleAnpEvent(AnpMsg msg)
        {
            switch (msg.Type)
            {
                case KAnpType.KANP_EVT_VNC_START:
                    AppSharingSession newSession = new AppSharingSession(
                        msg.Elements[3].UInt64,
                        msg.Elements[2].UInt32,
                        Helper.GetUserByID(msg.Elements[2].UInt32).UiSimpleName,
                        msg.Elements[4].String,
                        msg.Elements[1].UInt64,
                        0);
                    m_lstSharingSessions.Add(newSession);

                    // Notify if this session was not created by this KWM.
                    if (m_createdSessionID != newSession.ID)
                        Helper.NotifyUser(new ScreenSharingNotificationItem(msg, Helper));

                    DoOnVncSessionStart(new OnVncSessionEventArgs(newSession));
                    return KwsAnpEventStatus.Processed;

                case KAnpType.KANP_EVT_VNC_END:
                    AppSharingSession ses = m_lstSharingSessions[msg.Elements[3].UInt64];
                    ses.EndTimeUInt64 = msg.Elements[1].UInt64;

                    AppSharingState currentState = m_state;

                    bool notify = true;

                    // If we were connected to this session, disconnect from it and notify
                    // our user.
                    if (m_state == AppSharingState.Connected && m_connectedSessionID == ses.ID)
                    {
                        notify = false;
                        ResetToIdle();

                        if (msg.Minor >= 5 && msg.Elements[4].UInt32 == KAnpType.KANP_RES_FAIL_RESOURCE_QUOTA)
                        {
                            if (Helper.IsCreatorKwmUser)
                            {
                                Helper.PostGuiExecRequest(new LicenseRestrictionGer(
                                    "The screen sharing session was closed by the system because it exceeded " +
                                    "the duration allowed by your license. ", true));
                            }
                            else
                            {
                                Helper.PostGuiExecRequest(new LicenseRestrictionGer(
                                        "The screen sharing session was closed by the system because it exceeded the " +
                                        "duration allowed by the " + Base.GetKwsString() + " creator's license.", false));
                            }
                        }
                        else
                        {
                            Helper.PostGuiExecRequest(new MiscGuiExecRequest("This Screen Sharing session has been closed.", "Screen sharing session closed", MessageBoxIcon.Exclamation));
                        }
                    }

                    // If we started this session, close it and reset our state.
                    // Do not tell our user since in most cases the session was
                    // deliberatly ended by him.
                    if (m_createdSessionID == ses.ID)
                    {
                        m_createdSessionID = 0;

                        notify = false;
                        if (inactivityMonitor != null)
                            inactivityMonitor.Enabled = false;

                        ResetToIdle();

                        if (msg.Minor >= 5 && msg.Elements[4].UInt32 == KAnpType.KANP_RES_FAIL_RESOURCE_QUOTA)
                        {
                            if (Helper.IsCreatorKwmUser)
                            {
                                Helper.PostGuiExecRequest(new LicenseRestrictionGer(
                                    "Your screen sharing session was closed by the system because it exceeded " +
                                    "the duration allowed by your license. ", true));
                            }

                            else
                            {
                                Helper.PostGuiExecRequest(new LicenseRestrictionGer(
                                    "The screen sharing session was closed by the system because it exceeded the " +
                                    "duration allowed by the " + Base.GetKwsString() + " creator's license.", false));
                            }
                        }
                    }

                    // Notify if we were not connected to the session and we did not started it.
                    if (notify)
                        Helper.NotifyUser(new ScreenSharingNotificationItem(msg, Helper));

                    DoOnVncSessionEnd(new OnVncSessionEventArgs(ses));
                    return KwsAnpEventStatus.Processed;
            }

            return KwsAnpEventStatus.Unprocessed;
        }
Exemplo n.º 6
0
        public override KwsAnpEventStatus HandleAnpEvent(AnpMsg msg)
        {
            switch (msg.Type)
            {
                case KAnpType.KANP_EVT_VNC_START:
                    AppSharingSession newSession = new AppSharingSession(
                        msg.Elements[3].UInt64,
                        msg.Elements[2].UInt32,
                        Helper.GetUserDisplayName(msg.Elements[2].UInt32),
                        msg.Elements[4].String,
                        msg.Elements[1].UInt64,
                        0);
                    m_lstSharingSessions.Add(newSession);

                    // Notify if this session comes from a different user than our id.
                    if (m_createdSessionID != newSession.ID)
                        Helper.NotifyUser(new ScreenSharingNotificationItem(msg, Helper));

                    DoOnVncSessionStart(new OnVncSessionEventArgs(newSession));
                    return KwsAnpEventStatus.Processed;

                case KAnpType.KANP_EVT_VNC_END:
                    AppSharingSession ses = m_lstSharingSessions[msg.Elements[3].UInt64];
                    ses.EndTimeUInt64 = msg.Elements[1].UInt64;

                    AppSharingState currentState = m_state;

                    bool notify = true;

                    // If we were connected to this session, disconnect from it and notify
                    // our user.
                    if (m_state == AppSharingState.Connected && m_connectedSessionID == ses.ID)
                    {
                        notify = false;
                        ResetToIdle();
                        Misc.KwmTellUser("This Screen Sharing session has been closed.", MessageBoxIcon.Exclamation);
                    }

                    // If we started this session, close it and reset our state.
                    // Do not tell our user since in most cases the session was
                    // deliberatly ended by him.
                    if (m_createdSessionID == ses.ID)
                    {
                        m_createdSessionID = 0;

                        notify = false;
                        if (inactivityMonitor != null)
                            inactivityMonitor.Enabled = false;

                        ResetToIdle();
                    }

                    // Notify if we were not connected to the session and we did not started it.
                    if (notify)
                        Helper.NotifyUser(new ScreenSharingNotificationItem(msg, Helper));

                    DoOnVncSessionEnd(new OnVncSessionEventArgs(ses));
                    return KwsAnpEventStatus.Processed;
            }

            return KwsAnpEventStatus.Unprocessed;
        }