//Returns value when choice. public void ReceiveChanged(string result) { int index; //For internal processing, only uses Index type. if (!int.TryParse(result, out index)) { return; } switch (resultType) { case ResultType.Index: if (OnValueIndexChanged != null) { OnValueIndexChanged.Invoke(index); } break; case ResultType.Text: if (OnValueChanged != null) { OnValueChanged.Invoke(items[index].text); } break; case ResultType.Value: if (OnValueChanged != null) { OnValueChanged.Invoke(items[index].value); } break; } }
private async void OnRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args) { // Use args.GetDeferral() (and release the deferral later) if args is to be used after awaited calls var requestedValues = new ValueSet(); var values = new ValueSet(); foreach (var element in args.Request.Message) { if (element.Value != null) { _valueStorage[element.Key] = element.Value; values.Add(element.Key, element.Value); } else { var key = element.Key; _valueStorage.TryGetValue(key, out object value); requestedValues.Add(key, value); } } if (values.Count != 0) { ValueChanged?.Invoke(values); } if (requestedValues.Count != 0) { await _connection.SendMessageAsync(requestedValues); } }
//Returns value when slider moving. public void ReceiveChanged(string result) { if (OnValueChanged != null) { string[] arr = result.Split('='); OnValueChanged.Invoke(arr[0], arr[1]); } }
//Returns value when slider moving. public void ReceiveChanged(string result) { if (OnValueChanged != null) { string[] arr = result.Split('='); float value; if (float.TryParse(arr[1], out value)) { OnValueChanged.Invoke(arr[0], value); } } }
//Returns value when switch pressed. public void ReceiveChanged(string result) { if (OnValueChanged != null) { string[] arr = result.Split('='); bool isOn; if (bool.TryParse(arr[1], out isOn)) { OnValueChanged.Invoke(arr[0], isOn); } } }
//Returns value when choice. public void ReceiveChanged(string result) { int[] indexes; if (!string.IsNullOrEmpty(result)) { try { indexes = result.Split('\n').Select(e => int.Parse(e)).ToArray(); //For internal processing, only uses Index type. } catch (Exception) { return; } } else { indexes = new int[0]; //Necessary for all empty } switch (resultType) { case ResultType.Index: if (OnValueIndexChanged != null) { OnValueIndexChanged.Invoke(indexes); } break; case ResultType.Text: if (OnValueChanged != null) { OnValueChanged.Invoke(indexes.Select(i => items[i].text).ToArray()); } break; case ResultType.Value: if (OnValueChanged != null) { OnValueChanged.Invoke(indexes.Select(i => items[i].value).ToArray()); } break; } }
private void ValueChanged(T oldValue, T newValue) { OnValueChanged?.Invoke(oldValue, newValue); //Debug.LogErrorFormat("ValueChanged = {0}", OnValueChanged == null); }
private void ValueChanged(T oldValue, T newValue) { OnValueChanged?.Invoke(oldValue, newValue); }
private void OnValueChanged(string id, double value) { ValueChangedHandler?.Invoke(id, value); }
private static void OnValueChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) => ValueChanged?.Invoke(obj);