コード例 #1
0
        public void MonitorGetStatus(string options)
        {
            var ok = (_monitor != null);

            if (!ok)
            {
                LogMessage(string.Format("Monitor.GetStatus ignored; monitor has not been created yet"));
            }

            var status = ok ? _monitor.Status : null;
            var cap    = ok ? status.Capabilities : null;
            var thecap = new JsonObjCapabilities();

            // NOTE: add all as strings so the javascript-result have same types on all platforms!
            thecap.MaxAllowedBandwidthUsagePerDayInKB = (ok ? cap.MaxAllowedBandwidthUsagePerDayInKB : 0).ToString();
            thecap.MaxInstallationIDSize = (ok ? cap.MaxInstallationIDSize : 0).ToString();
            thecap.MaxKeySizeOfInstallationPropertyKey = (ok ? cap.MaxKeySizeOfInstallationPropertyKey : 0).ToString();
            thecap.MaxLengthOfFeatureName             = (ok ? cap.MaxLengthOfFeatureName : 0).ToString();
            thecap.MaxLengthOfExceptionContextMessage = (ok ? cap.MaxLengthOfExceptionContextMessage : 0).ToString();
            thecap.MaxNumberOfInstallationProperties  = (ok ? cap.MaxNumberOfInstallationProperties : 0).ToString();
            thecap.MaxStorageSizeInKB = (ok ? cap.MaxStorageSizeInKB : 0).ToString();
            var thestatus = new JsonObjStatus();

            thestatus.Capabilities = thecap;
            thestatus.Connectivity = (ok ? status.Connectivity : ConnectivityStatus.Unknown).ToString();
            thestatus.CookieId     = ok ? status.CookieId : string.Empty;
            thestatus.IsStarted    = (ok ? status.IsStarted : false).ToString();
            thestatus.RunTime      = (ok ? (int)status.RunTime.TotalSeconds : 0).ToString();
            var pluginResult = new PluginResult(PluginResult.Status.OK, thestatus);

            SendResult(CurrentCommandCallbackId, pluginResult);
        }
コード例 #2
0
        public void MonitorGetStatus(string options)
        {
            var ok = (_monitor != null);
              if (!ok)
            LogMessage(string.Format("Monitor.GetStatus ignored; monitor has not been created yet"));

              var status = ok ? _monitor.Status : null;
              var cap = ok ? status.Capabilities : null;
              var thecap = new JsonObjCapabilities();
              // NOTE: add all as strings so the javascript-result have same types on all platforms!
              thecap.MaxAllowedBandwidthUsagePerDayInKB = (ok ? cap.MaxAllowedBandwidthUsagePerDayInKB : 0).ToString();
              thecap.MaxInstallationIDSize = (ok ? cap.MaxInstallationIDSize : 0).ToString();
              thecap.MaxKeySizeOfInstallationPropertyKey = (ok ? cap.MaxKeySizeOfInstallationPropertyKey : 0).ToString();
              thecap.MaxLengthOfFeatureName = (ok ? cap.MaxLengthOfFeatureName : 0).ToString();
              thecap.MaxLengthOfExceptionContextMessage = (ok ? cap.MaxLengthOfExceptionContextMessage : 0).ToString();
              thecap.MaxNumberOfInstallationProperties = (ok ? cap.MaxNumberOfInstallationProperties : 0).ToString();
              thecap.MaxStorageSizeInKB = (ok ? cap.MaxStorageSizeInKB : 0).ToString();
              var thestatus = new JsonObjStatus();
              thestatus.Capabilities = thecap;
              thestatus.Connectivity = (ok ? status.Connectivity : ConnectivityStatus.Unknown).ToString();
              thestatus.CookieId = ok ? status.CookieId : string.Empty;
              thestatus.IsStarted = (ok ? status.IsStarted : false).ToString();
              thestatus.RunTime = (ok ? (int)status.RunTime.TotalSeconds : 0).ToString();
              var pluginResult = new PluginResult(PluginResult.Status.OK, thestatus);
              SendResult(CurrentCommandCallbackId, pluginResult);
        }