Esempio n. 1
0
        private void cvsInSightDisplay1_InSightChanged(object sender, EventArgs e)
        {
            InSight = cvsInSightDisplay1.InSight;
            PropertyChanged.BeginInvoke(this, new PropertyChangedEventArgs("IsConnected"), null, null);

            mImageOrientation = cvsInSightDisplay1.ImageOrientation;
        }
Esempio n. 2
0
        protected void OnNotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            Logger.Trace("[{0}] OnNotifyPropertyChanged() propertyName:{1}", GetType().Name, propertyName);

            // This should be an invoke becuase we want to tell the view to update, usually on a CompositionTarger.RenderFrame
            // Doing this as BeginInvoke adds far too many messages to the message queue.

            switch (InvokeBehavior)
            {
            case InvokeBehavior.BeginInvoke:
                PropertyChanged?.BeginInvoke(this, new PropertyChangedEventArgs(propertyName), null, null);
                break;

            case InvokeBehavior.Invoke:
            default:
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
                break;
            }
        }
 /// <summary>
 /// Synchronously sets the property in the UI thread.
 /// </summary>
 /// <param name="property"></param>
 /// <param name="value"></param>
 public new void SetValue(DependencyProperty property, object value)
 {
     try
     {
         if (IsUIThread)
         {
             object oldValue = base.GetValue(property);
             base.SetValue(property, value);
             if (oldValue != value)
             {
                 PropertyChanged?.BeginInvoke(this, new DependencyPropertyChangedEventArgs(property, oldValue, value), null, null);
             }
         }
         else
         {
             Invoke(new Action <DependencyProperty, object>(this.SetValue), property, value);
         }
     }
     catch (Exception ex)
     {
     }
 }