コード例 #1
0
        //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;
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 //Returns value when slider moving.
 public void ReceiveChanged(string result)
 {
     if (OnValueChanged != null)
     {
         string[] arr = result.Split('=');
         OnValueChanged.Invoke(arr[0], arr[1]);
     }
 }
コード例 #4
0
 //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);
         }
     }
 }
コード例 #5
0
 //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);
         }
     }
 }
コード例 #6
0
        //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;
            }
        }
コード例 #7
0
ファイル: BindableProperty.cs プロジェクト: junfff/mygame
 private void ValueChanged(T oldValue, T newValue)
 {
     OnValueChanged?.Invoke(oldValue, newValue);
     //Debug.LogErrorFormat("ValueChanged = {0}", OnValueChanged == null);
 }
コード例 #8
0
 private void ValueChanged(T oldValue, T newValue)
 {
     OnValueChanged?.Invoke(oldValue, newValue);
 }
コード例 #9
0
 private void OnValueChanged(string id, double value)
 {
     ValueChangedHandler?.Invoke(id, value);
 }
コード例 #10
0
 private static void OnValueChanged(DependencyObject obj,
                                    DependencyPropertyChangedEventArgs args) =>
 ValueChanged?.Invoke(obj);