Ejemplo n.º 1
0
        /// <summary>
        /// Connect or Disconnect EventHandlers when attached value has changed.
        /// </summary>
        /// <param name="dependencyObject"></param>
        /// <param name="dependencyPropertyChangedEventArgs"></param>
        private static void OnSetCallback(DependencyObject dependencyObject,
                                          DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            var frameworkElement = (FrameworkElement)dependencyObject;
            var target           = OffLineIndicator.GetIsOnline(frameworkElement);

            //      if (target == null)
            //        return;

            if (frameworkElement == null)
            {
                return;
            }

            if (target == true)
            {
                frameworkElement.Loaded   += new RoutedEventHandler(mainToolBar_Loaded);
                frameworkElement.Unloaded += new RoutedEventHandler(frameworkElement_Unloaded);
            }
            else
            {
                frameworkElement.Loaded   -= mainToolBar_Loaded;
                frameworkElement.Unloaded -= frameworkElement_Unloaded;
            }
        }
Ejemplo n.º 2
0
        private static void OnSetCallback(DependencyObject dependencyObject,
                                          DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            var frameworkElement = (FrameworkElement)dependencyObject;
            var target           = OffLineIndicator.GetIsOnline(frameworkElement);

            //      if (target == null)
            //        return;

            if (frameworkElement == null)
            {
                return;
            }

            if (target == true)
            {
                frameworkElement.Opacity = 1;
            }
            else
            {
                frameworkElement.Opacity = .5;
            }
        }