Exemplo n.º 1
0
        private static void mediaCollectionViewChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MediaStateInfoView view = (MediaStateInfoView)d;

            if (e.OldValue != null)
            {
                MediaStateCollectionView oldState = (MediaStateCollectionView)e.OldValue;

                WeakEventManager <MediaViewer.Model.Media.Base.State.MediaState, PropertyChangedEventArgs> .RemoveHandler(oldState.MediaState, "PropertyChanged", view.mediaState_PropertyChanged);

                WeakEventManager <INotifyPropertyChanged, PropertyChangedEventArgs> .RemoveHandler(oldState.MediaState.UIMediaCollection, "PropertyChanged", view.uiMediaCollection_PropertyChanged);

                WeakEventManager <MediaStateCollectionView, EventArgs> .RemoveHandler(oldState, "SelectionChanged", view.selectionChanged);
            }

            if (e.NewValue != null)
            {
                MediaStateCollectionView newState = (MediaStateCollectionView)e.NewValue;

                WeakEventManager <MediaViewer.Model.Media.Base.State.MediaState, PropertyChangedEventArgs> .AddHandler(newState.MediaState, "PropertyChanged", view.mediaState_PropertyChanged);

                WeakEventManager <INotifyPropertyChanged, PropertyChangedEventArgs> .AddHandler(newState.MediaState.UIMediaCollection, "PropertyChanged", view.uiMediaCollection_PropertyChanged);

                WeakEventManager <MediaStateCollectionView, EventArgs> .AddHandler(newState, "SelectionChanged", view.selectionChanged);

                view.initialize(newState.MediaState);
            }
        }
Exemplo n.º 2
0
        private static void isFlatModeChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MediaStateInfoView infoView = d as MediaStateInfoView;

            if ((bool)e.NewValue == true)
            {
                infoView.dateTimeLabel.SetValue(Grid.RowProperty, 0);
                infoView.dateTimeLabel.SetValue(Grid.ColumnProperty, 2);
                infoView.dateTimeLabel.FontWeight = FontWeights.Normal;
                infoView.dateTimeLabel.FontSize   = infoView.infoLabel.FontSize;
            }
            else
            {
                infoView.dateTimeLabel.SetValue(Grid.RowProperty, 1);
                infoView.dateTimeLabel.SetValue(Grid.ColumnProperty, 0);
                infoView.dateTimeLabel.FontWeight = FontWeights.Bold;
                infoView.dateTimeLabel.FontSize   = 8;
            }
        }