private void StopAnalyticsIfNotNull(IAnalyticsMonitor monitor) { if (monitor != null) { monitor.Stop(); } }
public void FactoryCreateMonitor(string options) { const string caller = "Factory.CreateMonitor"; var callbackId = CurrentCommandCallbackId; Task.Run(() => { try { var args = ParseOptions(options); var productId = args[0]; var version = args[1]; if (!ValidateMonitorCreateParameters(callbackId, caller, productId, version)) { return; } if (_monitor != null && _monitor.Status.IsStarted) { _monitor.Stop(); } if (string.IsNullOrWhiteSpace(version)) { _monitor = AnalyticsMonitorFactory.CreateMonitor(productId); } else { var settings = AnalyticsMonitorFactory.CreateSettings(productId); settings.Version = new Version(version); _monitor = AnalyticsMonitorFactory.CreateMonitor(settings); } SendResult(callbackId, PluginResult.Status.OK); } catch (Exception ex) { SendResultError(callbackId, caller, ex); } }); }
public static void Stop() { if (monitor != null) { try { monitor.Stop(); monitor.Dispose(); } catch { } monitor = null; } }
private void StopAnalyticsIfNotNull(IAnalyticsMonitor monitor) { if (monitor != null) { monitor.Stop(); } }