private void AwakeService() { lock (lockStatus) { var serviceStatus = ServiceStatus; if (serviceStatus == null || serviceStatus.ServiceState == ServiceStateCode.Idle) { // tracking start bool performed = false; for (var attempts = Properties.Settings.Default.ClientRetries + 1; attempts > 0; attempts--) { try { performed = _serviceClient.TrackingStart(CurrentContextId); if (performed) { break; } } catch { } } if (!performed) { throw new StatusException(Properties.Resources.MsgTrackingStartFailure) { Code = StatusExceptionCode.ServiceFailure }; } for (var attempts = Properties.Settings.Default.ClientRetries + 1; attempts > 0; attempts--) { try { performed = _serviceClient.TrackingStop(); if (performed) { break; } } catch { } } if (!performed) { throw new StatusException(Properties.Resources.MsgTrackingStartFailure) { Code = StatusExceptionCode.ServiceFailure }; } NotifyIcon.ShowBalloonTip(Properties.Resources.PopupInfo, Properties.Resources.MsgServiceAwake, BalloonIcon.Info); } } }
private void btnTrackStart_Click(object sender, EventArgs e) { if (SelectedContext != null) { _serviceClient.TrackingStart(SelectedContext); } }