Example #1
2
 private void ThemeToolsGroup_OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (ThemeToolsGroup.IsVisible)
     {
         RibbonRoot.SelectedTabItem = ThemeToolsTabItem;
     }
 }
Example #2
1
 public static void OnAttachChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
 {
     var passwordBox = sender as PasswordBox;
     if (passwordBox == null) return;
     if ((bool)e.OldValue) passwordBox.PasswordChanged -= PasswordChanged;
     if ((bool)e.NewValue) passwordBox.PasswordChanged += PasswordChanged;
 }
        private void SecurityBlockSelection_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            SecurityManagementBox.ItemsSource = null;

            SecurityManagementBox.Visibility = Visibility.Collapsed;
            IManagementConsoleObject securityObject = e.NewValue as IManagementConsoleObject;
            if (securityObject != null)
            {
                if (securityObject is RootMap)
                {
                    NoAssociationsWarningTextblock.Text = ROOTMAP_WARNING;
                }
                else if (securityObject is Project)
                {
                    NoAssociationsWarningTextblock.Text = PROJECT_WARNING;
                }

                if (securityObject.IsLoaded)
                {
                    if (securityObject.HasNoSecurityAssociations)
                    {
                        NoAssociationWarning.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        NoAssociationWarning.Visibility = Visibility.Collapsed;
                    }
                }
                else
                {
                    securityObject.LoadCompleted += securityObject_LoadCompleted;
                }
            }
        }
 /// <summary>
 ///     Sets the coordinates of all the individual lines in the visual.
 /// </summary>
 /// <param name="args">
 ///     The <c>DependencyPropertyChangedEventArgs</c> object associated 
 ///     with the property-changed event that resulted in this method 
 ///     being called.
 /// </param>
 /// <param name="lines">
 ///     The <c>Point3DCollection</c> to be filled.
 /// </param>
 /// <remarks>
 ///     <para>
 ///         Classes that derive from <c>WireBase</c> override this
 ///         method to fill the <c>lines</c> collection.
 ///         It is custmary for implementations of this method to clear
 ///         the <c>lines</c> collection first before filling it. 
 ///         Each pair of successive members of the <c>lines</c>
 ///         collection indicate one straight line.
 ///     </para>
 ///     <para>
 ///         The <c>WireLine</c> class implements this method by 
 ///         clearing the <c>lines</c> collection and then adding 
 ///         <c>Point1</c> and <c>Point2</c> to the collection.
 ///     </para>
 /// </remarks>
 protected override void Generate(DependencyPropertyChangedEventArgs args, 
                                  Point3DCollection lines)
 {
     lines.Clear();
     lines.Add(Point1);
     lines.Add(Point2);
 }
Example #5
1
        private static void OnSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var image = d as Image;
            if (image == null)
            {
                throw new ArgumentException(
                    "You must set the Command attached property on an element that derives from Image.");
            }

            var oldCommand = (bool)e.OldValue;
            if (oldCommand)
            {
                image.Loaded -= OnLoaded;
                image.SizeChanged -= OnSizeChanged;
            }

            var newCommand = (bool)e.NewValue;
            if (newCommand)
            {
                image.Loaded += OnLoaded;
                image.SizeChanged += OnSizeChanged;
            }

            image.CropImageBorders();
        }
Example #6
1
 private static void OnDeckChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     var viewer = d as DeckCardsViewer;
     var newdeck = e.NewValue as MetaDeck ?? new MetaDeck(){IsCorrupt = true};
     var g = GameManager.Get().GetById(newdeck.GameId);
     viewer.deck = newdeck.IsCorrupt ?
         null
         : g == null ?
             null
             : newdeck;
     viewer._view = viewer.deck == null ? 
         new ListCollectionView(new List<MetaMultiCard>()) 
         : new ListCollectionView(viewer.deck.Sections.SelectMany(x => x.Cards).ToList());
     viewer.OnPropertyChanged("Deck");
     viewer.OnPropertyChanged("SelectedCard");
     Task.Factory.StartNew(
         () =>
         {
             Thread.Sleep(0);
             viewer.Dispatcher.BeginInvoke(new Action(
                 () =>
                 {
                     viewer.FilterChanged(viewer._filter);
                 }));
         });
     
 }
Example #7
1
        private static void OnPanelContentPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            try
            {
                ParentPanel item = d as ParentPanel;
                ICleanup oldValue = e.OldValue as ICleanup;

                if (oldValue != null)
                {
                    oldValue.Cleanup();
                    oldValue = null;
                }
                if (e.NewValue != null)
                {
                    item.ParentContent.Content = null;

                    item.ParentContent.Content = e.NewValue;

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    private static void OnIsPivotAnimatedChanged(DependencyObject d, DependencyPropertyChangedEventArgs args)
    {
      ItemsControl list = d as ItemsControl;

      list.Loaded += (s2, e2) =>
        {
          // locate the pivot control that this list is within
          Pivot pivot = list.Ancestors<Pivot>().Single() as Pivot;

          // and its index within the pivot
          int pivotIndex = pivot.Items.IndexOf(list.Ancestors<PivotItem>().Single());

          bool selectionChanged = false;

          pivot.SelectionChanged += (s3, e3) =>
            {
              selectionChanged = true;
            };

          // handle manipulation events which occur when the user
          // moves between pivot items
          pivot.ManipulationCompleted += (s, e) =>
            {
              if (!selectionChanged)
                return;

              selectionChanged = false;

              if (pivotIndex != pivot.SelectedIndex)
                return;
              
              // determine which direction this tab will be scrolling in from
              bool fromRight = e.TotalManipulation.Translation.X <= 0;

              // locate the stack panel that hosts the items
              VirtualizingStackPanel vsp = list.Descendants<VirtualizingStackPanel>().First() as VirtualizingStackPanel;

              // iterate over each of the items in view
              int firstVisibleItem = (int)vsp.VerticalOffset;
              int visibleItemCount = (int)vsp.ViewportHeight;
              for (int index = firstVisibleItem; index <= firstVisibleItem + visibleItemCount; index++)
              {
                // find all the item that have the AnimationLevel attached property set
                var lbi = list.ItemContainerGenerator.ContainerFromIndex(index);
                if (lbi == null)
                  continue;

                vsp.Dispatcher.BeginInvoke(() =>
                  {
                    var animationTargets = lbi.Descendants().Where(p => ListAnimation.GetAnimationLevel(p) > -1);
                    foreach (FrameworkElement target in animationTargets)
                    {
                      // trigger the required animation
                      GetAnimation(target, fromRight).Begin();
                    }
                  });
              };
            };
        };
    }
        private static void OnGroupNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //Add an entry to the group name collection
            var menuItem = d as MenuItem;

            if (menuItem != null)
            {
                String newGroupName = e.NewValue.ToString();
                String oldGroupName = e.OldValue.ToString();
                if (String.IsNullOrEmpty(newGroupName))
                {
                    //Removing the toggle button from grouping
                    RemoveCheckboxFromGrouping(menuItem);
                }
                else
                {
                    //Switching to a new group
                    if (newGroupName != oldGroupName)
                    {
                        if (!String.IsNullOrEmpty(oldGroupName))
                        {
                            //Remove the old group mapping
                            RemoveCheckboxFromGrouping(menuItem);
                        }
                        ElementToGroupNames.Add(menuItem, e.NewValue.ToString());
                        menuItem.Checked += MenuItemChecked;
                    }
                }
            }
        }
Example #10
1
        /// <summary>
        /// Wird bei Seitenwechsel aufgerufen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void KPage_VisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (!((KPage)sender).IsVisible)     // Beim Verlassen der Seite nichts machen
                return;

            refreshDataGrid();
        }
Example #11
1
 private static void OnTransformChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.SetValue(UIElement.RenderTransformProperty, e.NewValue);
     if (TrackableRenderTransform.TransformChanged == null)
         return;
     TrackableRenderTransform.TransformChanged(d, e);
 }
Example #12
1
 static void OnScrollOnTextChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
 {
     var textBox = dependencyObject as TextBox;
     if (textBox == null)
     {
         return;
     }
     bool oldValue = (bool)e.OldValue, newValue = (bool)e.NewValue;
     if (newValue == oldValue)
     {
         return;
     }
     if (newValue)
     {
         textBox.Loaded += TextBoxLoaded;
         textBox.Unloaded += TextBoxUnloaded;
     }
     else
     {
         textBox.Loaded -= TextBoxLoaded;
         textBox.Unloaded -= TextBoxUnloaded;
         if (_associations.ContainsKey(textBox))
         {
             _associations[textBox].Dispose();
         }
     }
 }
Example #13
1
        private static void AnnotationsGroupChanged(DependencyObject target, DependencyPropertyChangedEventArgs args)
        {
            RadCartesianChart chart = target as RadCartesianChart;
            if (chart == null)
            {
                return;
            }

            string group = (string)args.NewValue;
            if (group != null && !attachedCharts.Contains(chart))
            {
                attachedCharts.Add(chart);
                chart.MouseMove += Chart_MouseMove;
                chart.MouseLeave += Chart_MouseLeave;
            }
            else if (group == null)
            {
                chart.MouseMove -= Chart_MouseMove;
                attachedCharts.Remove(chart);
                chart.MouseLeave -= Chart_MouseLeave;

                if (lastMouseOveredChart == chart)
                {
                    lastMouseOveredChart = null;
                }
            }
        }
 /// <summary>
 /// Provides derived classes an opportunity to handle changes to the Model property.
 /// </summary>
 protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e)
 {
     if (Model != null)
         SetLayoutItem(Model.Root.Manager.GetLayoutItemFromModel(Model));
     else
         SetLayoutItem(null);
 }
        private static void AttachmentChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var item = d as AttachmentListBoxItem;

            if (item == null)
                return;

            if (File.Exists(item.Attachment))
            {
                item.ShortName = Path.GetFileName(item.Attachment);

                var icon = Icon.ExtractAssociatedIcon(item.Attachment);

                if (icon == null)
                    return;

                item.FileIcon = Imaging.CreateBitmapSourceFromHIcon(icon.Handle, Int32Rect.Empty, 
                      BitmapSizeOptions.FromEmptyOptions());

                icon.Dispose();
                GC.Collect(1);

                item.UpdateLayout();
            }
        }
Example #16
1
 private static void BusyCountChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (0.Equals(e.NewValue))
         SetIsBusy(d, false);
     else
         SetIsBusy(d, true);
 }
Example #17
1
 private static void IsReadOnlyPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
 {
     if (e.OldValue != e.NewValue && e.NewValue != null) {
         var numUpDown = (NumericUpDown)dependencyObject;
         numUpDown.ToggleReadOnlyMode((bool)e.NewValue);
     }
 }
Example #18
1
 /// <summary>
 /// ValidSpinDirectionProperty property changed handler.
 /// </summary>
 /// <param name="d">ButtonSpinner that changed its ValidSpinDirection.</param>
 /// <param name="e">Event arguments.</param>
 private static void OnValidSpinDirectionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     Spinner source = (Spinner)d;
     ValidSpinDirections oldvalue = (ValidSpinDirections)e.OldValue;
     ValidSpinDirections newvalue = (ValidSpinDirections)e.NewValue;
     source.OnValidSpinDirectionChanged(oldvalue, newvalue);
 }
Example #19
1
 private static void TextboxInlinesPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     var textBlock = d as TextBlock;
     if (textBlock == null)
         return;
     SetTextBlockInlines(textBlock, e.NewValue as IEnumerable<Inline>);
 }
Example #20
1
        /// <summary>
        /// Provides derived classes an opportunity to handle changes to the Source property.
        /// </summary>
        protected virtual void OnSourceChanged(DependencyPropertyChangedEventArgs e)
        {
            ClearAnimation();

            var source = e.NewValue as BitmapImage;
            if(source == null) {
                Uri uri = e.NewValue as Uri;

                if(uri == null) {
                    var bitmapframe = e.NewValue as BitmapFrame;

                    if(bitmapframe == null) {
                        var imgsrc = e.NewValue as ImageSource;
                        base.Source = imgsrc;
                        return;
                    }

                    uri = new Uri(e.NewValue.ToString());
                }

                source = new BitmapImage();
                source.BeginInit();
                source.UriSource = uri;
                source.CacheOption = BitmapCacheOption.OnLoad;
                source.EndInit();
            }

            if(!IsAnimatedGifImage(source)) {
                base.Source = source;
                return;
            }

            PrepareAnimation(source);
        }
        /// <summary>
        ///     Called when HeaderProperty is invalidated on "d."
        /// </summary>
        private static void OnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            HeaderedContentControl ctrl = (HeaderedContentControl) d;

            ctrl.SetValue(HasHeaderPropertyKey, (e.NewValue != null) ? BooleanBoxes.TrueBox : BooleanBoxes.FalseBox);
            ctrl.OnHeaderChanged(e.OldValue, e.NewValue);
        }
        private static void OnBindPasswordChanged(DependencyObject dp, DependencyPropertyChangedEventArgs e)
        {
            // when the BindPassword attached property is set on a PasswordBox,
            // start listening to its PasswordChanged event

            PasswordBox box = dp as PasswordBox;

            if (box == null)
            {
                return;
            }

            bool wasBound = (bool)(e.OldValue);
            bool needToBind = (bool)(e.NewValue);

            if (wasBound)
            {
                box.PasswordChanged -= HandlePasswordChanged;
            }

            if (needToBind)
            {
                box.PasswordChanged += HandlePasswordChanged;
            }
        }
Example #23
1
 private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
 {
     var view = dependencyObject as PNSearchView;
       if (view != null && e.NewValue != e.OldValue && (bool)e.NewValue && view.searchTextBox.Focusable) {
     view.searchTextBox.Focus();
       }
 }
Example #24
0
 private async void UserControl_IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if (this.Visibility == System.Windows.Visibility.Visible)
     {
         await((GanttViewModel)this.DataContext).Inicializar();
     }
 }
Example #25
0
 private void DbLoginView_IsEnabledChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if ((bool)e.NewValue == false)
     {
         Hide();
     }
 }
Example #26
0
        void HandlePositionChanged(object sender, sw.DependencyPropertyChangedEventArgs e)
        {
            if (PositionChangedEnabled > 0)
            {
                return;
            }
            // we use actual width vs. width itself, so we have to use the value passed in
            var old = position;
            var pos = (sw.GridLength)e.NewValue;

            if (pos.GridUnitType == sw.GridUnitType.Pixel)
            {
                var newPosition = (int)pos.Value;
                if (newPosition != Position)
                {
                    var args = new SplitterPositionChangingEventArgs(newPosition);
                    Callback.OnPositionChanging(Widget, args);
                    if (args.Cancel)
                    {
                        return;
                    }
                }
                position = newPosition;
            }
            Callback.OnPositionChanged(Widget, EventArgs.Empty);
            position = old;
        }
Example #27
0
 void HandleIsOpenChanged(object sender, sw.DependencyPropertyChangedEventArgs e)
 {
     if (!Control.IsOpen)
     {
         Callback.OnClosing(Widget, EventArgs.Empty);
     }
 }
Example #28
0
 protected override void OnIsKeyboardFocusWithinChanged(System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if (IsFocused == false)
     {
         base.OnIsKeyboardFocusWithinChanged(e);
     }
 }
 static void onFuncNameRightChanged(DependencyObject obj,DependencyPropertyChangedEventArgs e)
 {
     SFPCircleWidthBlackLid sl = obj as SFPCircleWidthBlackLid;
     if (sl == null)
         return;
     sl.FuncNameRight_Label.Content = sl.FuncNameRight;
 }
 private void AvaloniaHwndHost_DataContextChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if (Content != null)
     {
         Content.DataContext = e.NewValue;
     }
 }
Example #31
0
 private void AniGraphIsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     for (var n = 0; n < 4; n++)
     {
         _aniScale[n] = 0.0;
     }
 }
        public static void ChartViewModelChanged(System.Windows.DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e)
        {
            var control = d as ChartControl;

            if (d == null)
            {
                throw new Exception("Unknown control type");
            }

            var old = e.OldValue as ChartViewModel;

            if (old != null)
            {
                old.ValidChartDataFound -= control.ChartViewModel_ValidChartDataFound;
                old.StartRefreshing     -= control.ChartViewModel_StartRefreshing;
            }

            var newV = e.NewValue as ChartViewModel;

            if (newV != null)
            {
                newV.ValidChartDataFound          += control.ChartViewModel_ValidChartDataFound;
                newV.StartRefreshing              += control.ChartViewModel_StartRefreshing;
                control.MainChart.DataContext      = newV;
                control.ButtonPallette.DataContext = newV;
                if (control.Visibility == Visibility.Visible)
                {
                    control.Activate();
                }
            }
        }
 private void UserControl_IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if (this.Visibility == Visibility.Visible)
     {
         this.DataContext = new UCAsignarNivelesViewModel();
     }
 }
Example #34
0
 void MessageBoxWindow_DataContextChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if (e.NewValue.GetType().Equals(typeof(MessageBoxViewModel)))
     {
         this.ViewModel = e.NewValue as MessageBoxViewModel;
     }
 }
 private void Participants_DataContextChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     DataContextChanged     -= Participants_DataContextChanged;
     _participantDataSummary = ((DataSummaryViewModel)DataContext).ParticipantData;
     AddPartCols();
     _participantDataSummary.ColHeaders.CollectionChanged += ColHeaders_CollectionChanged;
 }
Example #36
0
 private void Page_IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if ((bool)e.NewValue == true)
     {
         _viewModel.RefreshAllData();
     }
 }
Example #37
0
 private void GroupBox_IsVisibleChanged_2(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if (((Control)sender).IsVisible)
     {
         FreeTag.BackgroundFocus();
     }
 }
Example #38
0
 private void UserControl_IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if (this.IsVisible)
     {
         DiscordRPCHelper.WhatAmIDoing("About Page");
     }
 }
        private void ItemBackground_DataContextChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
        {
            Grid         cb = ((Grid)sender);
            CombatHotKey hk = (CombatHotKey)cb.DataContext;

            UpdateBackground(cb, hk);
        }
 private static void OnAutoSizeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
 {
     var behavior = GetOrSetBehavior(sender);
     var element = (FrameworkElement)sender;
     behavior._owner = sender;
     element.Loaded += behavior.Element_Loaded;
 }
Example #41
0
 private void Window_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if ((bool)e.NewValue == false)
     {
         Close();
     }
 }
Example #42
0
 private void RichTextBoxIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (richTextBox.IsVisible)
     {
         richTextBox.Focus();
     }
 }
        private static void OnScrollGroupChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
            var scrollViewer = d as ScrollViewer;
            if (scrollViewer != null) {
                if (!string.IsNullOrEmpty((string)e.OldValue)) {
                    // Remove scrollviewer
                    if (scrollViewers.ContainsKey(scrollViewer)) {
                        scrollViewer.ScrollChanged -=
                          new ScrollChangedEventHandler(ScrollViewer_ScrollChanged);
                        scrollViewers.Remove(scrollViewer);
                    }
                }

                if (!string.IsNullOrEmpty((string)e.NewValue)) {
                    if (verticalScrollOffsets.Keys.Contains((string)e.NewValue)) {
                        scrollViewer.ScrollToVerticalOffset(verticalScrollOffsets[(string)e.NewValue]);
                    } else {
                        verticalScrollOffsets.Add((string)e.NewValue, scrollViewer.VerticalOffset);
                    }

                    // Add scrollviewer
                    scrollViewers.Add(scrollViewer, (string)e.NewValue);
                    scrollViewer.ScrollChanged += new ScrollChangedEventHandler(ScrollViewer_ScrollChanged);
                }
            }
        }
        protected virtual void OnPanelDesignerChanged(DependencyPropertyChangedEventArgs e)
        {
            var panelDesigner = e.OldValue as PanelDesigner;
            if (panelDesigner != null)
            {
                panelDesigner.ContentChanged -= panelDesigner_ContentChanged;
                panelDesigner.DesignModeChanged -= panelDesigner_DesignModeChanged;
                panelDesigner.SelectedElementChanged -= panelDesigner_SelectedElementChanged;
                PanelDesigner.SelectedPanelChanged -= panelDesigner_SelectedPanelChanged;
            }

            panelDesigner = e.NewValue as PanelDesigner;
            if (panelDesigner == null && panelDesigner.Content == null)
            {
                treeView.IsEnabled = false;
                treeView.ItemsSource = null;
                return;
            }

            panelDesigner.ContentChanged += panelDesigner_ContentChanged;
            panelDesigner.DesignModeChanged += panelDesigner_DesignModeChanged;
            panelDesigner.SelectedElementChanged += panelDesigner_SelectedElementChanged;
            panelDesigner.SelectedPanelChanged += panelDesigner_SelectedPanelChanged;

            treeView.IsEnabled = panelDesigner.DesignMode;
            if (panelDesigner.Content != null)
                treeView.ItemsSource = new ObservableCollection<OutlineViewItem> { new OutlineViewItem(panelDesigner.Content as FrameworkElement) };
        }
Example #45
0
        private static void HandleIsEnabledChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            var textBlock = source as TextBlock;
            if (textBlock == null)
            {
                return;
            }

            if ((bool)e.OldValue)
            {
                var fader = GetFader(textBlock);
                if (fader != null)
                {
                    fader.Detach();
                    SetFader(textBlock, null);
                }

                textBlock.Loaded -= HandleTextBlockLoaded;
                textBlock.Unloaded -= HandleTextBlockUnloaded;
            }

            if ((bool)e.NewValue)
            {
                textBlock.Loaded += HandleTextBlockLoaded;
                textBlock.Unloaded += HandleTextBlockUnloaded;

                var fader = new Fader(textBlock);
                SetFader(textBlock, fader);
                fader.Attach();
            }
        }
Example #46
0
 protected override void OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if (e.Property.Name == "Value")
     {
         if (e.NewValue == null)
         {
             Image.Source = null;
         }
         else
         {
             try
             {
                 BitmapImage bitmap = new BitmapImage();
                 bitmap.BeginInit();
                 bitmap.StreamSource = new System.IO.MemoryStream((byte[])e.NewValue);
                 bitmap.EndInit();
                 Image.Source = bitmap;
             }
             catch
             {
                 Image.Source = null;
                 Value        = null;
             }
         }
     }
     base.OnPropertyChanged(e);
 }
Example #47
0
        private void UserControl_IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
        {
            if (((System.Windows.UIElement)sender).IsVisible)
            {
                if (MainWindow.GlobalTradeOperations.Count() == 0)
                {
                    return;
                }
                //ShipList.Clear();
                //FilteredList.Clear();
                //int QtdTradedValue = 0;
                //int ValueTotalTradedValue = 0;
                Total total = new Total();
                {
                    total.TotalItemsTraded    = MainWindow.GlobalTradeOperations.Sum(x => x.Quantity).ToString();
                    total.TotalMoneyCollected = MainWindow.GlobalTradeOperations.Sum(x => x.Money).ToString();
                    double minTime = MainWindow.GlobalTradeOperations.Min(x => x.Time);
                    double maxTime = MainWindow.GlobalTradeOperations.Max(x => x.Time);
                    total.TimeInService = (maxTime - minTime).ToString();
                }

                FillInShipList();
                //IQueryable<TradeOperation> queriableList = MainWindow.GlobalTradeOperations.AsQueryable<TradeOperation>();
                //foreach (TradeOperation tradeOp in MainWindow.GlobalTradeOperations.OrderBy(i => i.Time))
                //{
                //    QtdTradedValue = QtdTradedValue + tradeOp.Quantity;
                //    ValueTotalTradedValue = ValueTotalTradedValue + tradeOp.Money;
                //    total.TotalMoneyCollected = ValueTotalTradedValue.ToString();
                //    total.TotalItemsTraded = QtdTradedValue.ToString();
                //    FilteredList.Add(tradeOp);
                //    FullList.Add(tradeOp);
                //}
                //foreach (Ship ship in MainWindow.ShipsWithTradeOperations)
                //{
                //    ShipList.Add(tradeOp);
                //}
                //if (ShipList.Count == 0)
                //{
                //    ShipList.Add(new TradeOperation(0, "Please load the XML", "", "", 0, "", "", "", "", 0));
                //}
                //shipList.ItemsSource = ShipList.OrderBy(i => i.OurShip.ShipName);
                //TradeOpGrid.ItemsSource = FilteredList;
                //double minTime = 0;
                //double maxTime = 0;
                //if (FilteredList.Count > 0)
                //{
                //    minTime = FilteredList.ToList().Min(x => x.Time);
                //    maxTime = FilteredList.ToList().Max(x => x.Time);
                //    total.TimeInService = (maxTime - minTime).ToString();
                //}
                //else
                //{
                //    total.TimeInService = "0";
                //}
                TradeOpGrid.ItemsSource = TradeOperations.OrderBy(x => x.Time);
                this.DataContext        = total;
                Console.WriteLine("Tab");
            }
        }
Example #48
0
 private void EhFontDepth_SelectionChangeCommitted(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if (FontX != null)
     {
         FontX3D = FontX3D.WithDepth(_cbFontDepth.SelectedQuantityAsValueInPoints);
         OnSelectedFontChanged();
     }
 }
 protected override void OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if (e.Property == PrintTemplateItemViewModelCommon.FormatProperty)
     {
         this.PreviewValue = e.NewValue.ToString();
     }
     base.OnPropertyChanged(e);
 }
            private void RaiseDataContextChanged(object sender, EventType args)
            {
                var handler = ValueChanged;

                if (handler != null)
                {
                    handler(this, EventArgs.Empty);
                }
            }
Example #51
0
        private void detailsButton_ColorSchemeChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
        {
            if (init)
            {
                return;
            }

            ti.ColorScheme = ColorScheme;
        }
Example #52
0
        private static void OnColorChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
        {
            ColorSelector colorSelector = sender as ColorSelector;

            if (colorSelector != null && !colorSelector.IsUpdatingColor)
            {
                colorSelector.UpdateSliders(colorSelector.Color.Color);
            }
        }
 // A propertyChangedCallback is necessary because it catches all manners in which the property value can be changed, including SetValue
 static void OnIdChanged(Windows.DependencyObject target, Windows.DependencyPropertyChangedEventArgs e)
 {
     if (e.NewValue is string id && !string.IsNullOrEmpty(id))
     {
         DependencyObjectExtensions.TemplatedParent = (target as Windows.FrameworkElement)?.TemplatedParent;
         try { delegates[id](target); }
         finally { DependencyObjectExtensions.TemplatedParent = null; }
     }
 }
Example #54
0
        private static void ReportSourceChanged(System.Windows.DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e)
        {
            var crviewer = d as SAPBusinessObjects.WPF.Viewer.CrystalReportsViewer;

            if (crviewer != null)
            {
                crviewer.ViewerCore.ReportSource = e.NewValue;
            }
        }
Example #55
0
 private void UserControl_IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if ((bool)e.NewValue == true && !listLoaded)
     {
         presenter.Token = Token;
         presenter.Initialize();
         listLoaded = true;
     }
 }
Example #56
0
        private void content_ContentChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
        {
            DataContext = (content.Content as FrameworkElement)?.DataContext;

            content.ContentChanged += (s, args) =>
            {
                DataContext = (content.Content as FrameworkElement)?.DataContext;
            };
        }
Example #57
0
 private void VMixControlMoveThumb_DataContextChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if (e.NewValue is vMixControl ctrl)
     {
         Locked = ctrl.Locked;
         ctrl.PropertyChanged += Ctrl_PropertyChanged;
     }
     PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Locked"));
 }
Example #58
0
 private void UserControl_IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if (this.Visibility == Visibility.Visible)
     {
         InicializarControl();
     }
     else
     {
         LimpiarControl();
     }
 }
 private void SpindleControl_DataContextChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if (e.OldValue != null && e.OldValue is INotifyPropertyChanged)
     {
         ((INotifyPropertyChanged)e.OldValue).PropertyChanged -= OnDataContextPropertyChanged;
     }
     if (e.NewValue != null && e.NewValue is INotifyPropertyChanged)
     {
         ((INotifyPropertyChanged)e.NewValue).PropertyChanged += OnDataContextPropertyChanged;
     }
 }
Example #60
0
 void OnVisiblityChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     if ((bool)e.NewValue)
     {
         this.EnteredTime = DateTime.Now;
     }
     else if (EnteredTime != null && this.EnteredTime != DateTime.MinValue)
     {
         this.TimeSpentHere += (DateTime.Now - this.EnteredTime).TotalSeconds;
     }
 }