コード例 #1
0
                public void PropertyChanged_ViewModel(object sender, global::System.ComponentModel.PropertyChangedEventArgs e)
                {
                    MainPage_obj1_Bindings bindings;

                    if (WeakRefToBindingObj.TryGetTarget(out bindings))
                    {
                        string propName = e.PropertyName;
                        global::SerialWS.HostViewModel obj = sender as global::SerialWS.HostViewModel;
                        if (global::System.String.IsNullOrEmpty(propName))
                        {
                            if (obj != null)
                            {
                                bindings.Update_ViewModel_RxOrTxOption(obj.RxOrTxOption, DATA_CHANGED);
                                bindings.Update_ViewModel_TextToSend(obj.TextToSend, DATA_CHANGED);
                                bindings.Update_ViewModel_SelectedFileName(obj.SelectedFileName, DATA_CHANGED);
                            }
                        }
                        else
                        {
                            switch (propName)
                            {
                            case "RxOrTxOption":
                            {
                                if (obj != null)
                                {
                                    bindings.Update_ViewModel_RxOrTxOption(obj.RxOrTxOption, DATA_CHANGED);
                                }
                                break;
                            }

                            case "TextToSend":
                            {
                                if (obj != null)
                                {
                                    bindings.Update_ViewModel_TextToSend(obj.TextToSend, DATA_CHANGED);
                                }
                                break;
                            }

                            case "SelectedFileName":
                            {
                                if (obj != null)
                                {
                                    bindings.Update_ViewModel_SelectedFileName(obj.SelectedFileName, DATA_CHANGED);
                                }
                                break;
                            }

                            default:
                                break;
                            }
                        }
                    }
                }
コード例 #2
0
 private void Update_ViewModel(global::SerialWS.HostViewModel obj, int phase)
 {
     this.bindingsTracking.UpdateChildListeners_ViewModel(obj);
     if (obj != null)
     {
         if ((phase & (NOT_PHASED | DATA_CHANGED | (1 << 0))) != 0)
         {
             this.Update_ViewModel_RxOrTxOption(obj.RxOrTxOption, phase);
             this.Update_ViewModel_TextToSend(obj.TextToSend, phase);
             this.Update_ViewModel_SelectedFileName(obj.SelectedFileName, phase);
         }
     }
 }
コード例 #3
0
 public void UpdateChildListeners_ViewModel(global::SerialWS.HostViewModel obj)
 {
     if (obj != cache_ViewModel)
     {
         if (cache_ViewModel != null)
         {
             ((global::System.ComponentModel.INotifyPropertyChanged)cache_ViewModel).PropertyChanged -= PropertyChanged_ViewModel;
             cache_ViewModel = null;
         }
         if (obj != null)
         {
             cache_ViewModel = obj;
             ((global::System.ComponentModel.INotifyPropertyChanged)obj).PropertyChanged += PropertyChanged_ViewModel;
         }
     }
 }