Esempio n. 1
0
        private void PrepareOperationCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled == false &&
                e.Error == null)
            {
                ejsServerStats stats =
                    e.Result as ejsServerStats;
                if (stats != null)
                {
                    this._lv_SessionsList.ItemsSource = stats._currentSessions;
                    this._l_ServerName.Content        = stats._serverName;
                    this._l_ServerAddress.Content     = ejsBridgeManager.EjsAddress;
                }
            }

            this.IsStageReady = true;
            this._isStageBusy = false;

            this.RaiseAsyncOperationCompletedEvent();
        }
Esempio n. 2
0
        /// <summary>
        /// Gets all the current stats from the designated server.
        /// </summary>
        public static ejsServerStats GetServerStats(
            ejsSessionToken sessionToken)
        {
            EjsPublicServiceClient _client = null;

            try
            {
                _client = new EjsPublicServiceClient();
                _client.Endpoint.Address = new EndpointAddress(ejsBridgeManager.EjsAddress);

                ejsServerStats result = _client.GetCurrentServerStats(sessionToken);

                return(result);
            }
            catch (FaultException <ejsFailureReport> ex)
            {
                if (ex.Detail._failureCode == 7)
                {
                    sessionToken._isAuthenticated = false;
                }

                throw new ApplicationException(ex.Detail._header + "\n" + ex.Detail._originalException.Message);
            }
            catch (Exception)
            {
                sessionToken._isAuthenticated = false;
                throw new ApplicationException("EJSと接続する際に失敗しました。");
            }
            finally
            {
                if (_client != null)
                {
                    _client.Close();
                }
            }
        }