public void StopListening() { try { counterListener.StopListening(); } catch (Exception ex) { Debug.WriteLine($"Counter: {ex.Message}"); } }
public void StopListening() { try { counterListener.StopListening(); counterListener.IndividualCountersEvent -= OnIndividualCounter; } catch (Exception ex) { Debug.WriteLine($"CounterVis: {ex.Message}"); } }
/// <summary> /// Customer counter reset helper /// </summary> /// <param name="val">number of customers in store currently</param> /// <returns></returns> public static async Task <bool> ResetCustomerCounter(int val) { bool succeeded = false; try { CounterListener counterListener = new CounterListener(SettingsHelper.Instance.CustomerCounterEndpoint, Util.ToIntSafely(SettingsHelper.Instance.CustomerCounterTiming, 5)); counterListener.StartListening(); succeeded = await counterListener.ResetAsync(val); counterListener.StopListening(); } catch (Exception) { // Ignore } return(succeeded); }
protected override void OnNavigatedFrom(NavigationEventArgs e) { counterListener.StopListening(); base.OnNavigatedFrom(e); }