コード例 #1
0
ファイル: EveServer.cs プロジェクト: Almamu/evemon
        /// <summary>
        /// Occurs when CCP returns new data
        /// </summary>
        /// <param name="result"></param>
        private void OnMonitorUpdated(APIResult <SerializableServerStatus> result)
        {
            // Was there an error ?
            var lastStatus = m_status;

            if (result.HasError)
            {
                m_status = ServerStatus.Unknown;
                EveClient.Notifications.NotifyServerStatusError(result);
                return;
            }

            // Update status and users, notify no more errors
            m_users  = result.Result.Players;
            m_status = (result.Result.Open ? ServerStatus.Online : ServerStatus.Offline);
            EveClient.Notifications.InvalidateServerStatusError();

            // Notify subscribers about update
            EveClient.OnServerStatusUpdated(this, lastStatus, m_status);

            // Send a notification
            if (lastStatus != m_status)
            {
                EveClient.Notifications.NotifyServerStatusChange(m_status);
            }
            else
            {
                EveClient.Notifications.InvalidateServerStatusChange();
            }
        }
コード例 #2
0
        /// <summary>
        /// Occurs when CCP returns new data.
        /// </summary>
        /// <param name="result"></param>
        private void OnMonitorUpdated(APIResult <SerializableAPIServerStatus> result)
        {
            // Was there an error ?
            var lastStatus = m_status;

            if (result.HasError)
            {
                // Checks if EVE Backend Database is temporarily disabled
                if (result.EVEBackendDatabaseDisabled)
                {
                    return;
                }

                m_status = ServerStatus.Unknown;
                EveClient.Notifications.NotifyServerStatusError(result);

                // Notify subscribers about update
                EveClient.OnServerStatusUpdated(this, lastStatus, m_status);
                return;
            }

            // Update status and users, notify no more errors
            m_users  = result.Result.Players;
            m_status = (result.Result.Open ? ServerStatus.Online : ServerStatus.Offline);
            EveClient.Notifications.InvalidateServerStatusError();

            // Notify subscribers about update
            EveClient.OnServerStatusUpdated(this, lastStatus, m_status);

            // Send a notification
            if (lastStatus != m_status)
            {
                EveClient.Notifications.NotifyServerStatusChanged(Name, m_status);
                return;
            }

            EveClient.Notifications.InvalidateServerStatusChange();
        }