Example #1
0
        /// <summary>
        /// Callback for when the assiciated UcTreeDesigner's ConnectingIOHandle property changes.
        /// </summary>
        /// <param name="args">The change arguments.</param>
        private void OnTreeDesignerConnectingIOHandleChanged(PropertyChangedCallbackArgs args)
        {
            UcIOHandle newValue = args.NewValue as UcIOHandle;

            // If user is trying to connect another IO handle, provide information about
            // whether this handle is compatible with its data by setting the IsConnectionCompatible
            // property.
            if (newValue != this)
            {
                if (newValue != null && this.IsInput != newValue.IsInput && this.NodeViewer != newValue.NodeViewer)
                {
                    this.IsConnectionCompatible = this.DataType == null || newValue.DataType == null ||
                                                  (!this.IsInput && this.DataType.CanConvertTo(newValue.DataType)) || (this.IsInput && newValue.DataType.CanConvertTo(this.DataType));
                }
                else
                {
                    this.IsConnectionCompatible = null;
                }
            }
        }
Example #2
0
        /// <summary>
        /// Property Changed Callback method of the IsSelected Dependency Property.
        /// </summary>
        /// <param name="sender">The instance of the class that had the IsSelected property changed.</param>
        /// <param name="e">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
        private static void OnIsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            UcIOHandle subject  = (UcIOHandle)sender;
            bool       newValue = (bool)e.NewValue;
            bool       oldValue = (bool)e.OldValue;

            if (newValue)
            {
                if (subject.NodeViewer != null)
                {
                    subject.NodeViewer.IsSelected = true;
                    foreach (var other in subject.NodeViewer.IoHandles)
                    {
                        if (other != subject)
                        {
                            other.IsSelected = false;
                        }
                    }
                }
            }
        }