コード例 #1
0
        /// <summary>
        /// Method is invoked when the nofitivation dependency property is changed.
        /// This requires changing event hook-up on attached viewmodel to enable
        /// notification event conversion from viewmodel into view.
        /// </summary>
        /// <param name="oldValue"></param>
        /// <param name="newValue"></param>
        private void OnNofitivationChange(INotifyableViewModel oldValue, INotifyableViewModel newValue)
        {
            if (this.mViewModel != null)
            {
                // Remove old link for showing notification pop-up message event
                this.mViewModel.ShowNotificationMessage -= ViewModel_ShowNotificationMessage;
            }

            this.mViewModel = newValue;

            if (this.mViewModel != null)
            {
                // Establish new link to show notification pop-up message event
                this.mViewModel.ShowNotificationMessage += ViewModel_ShowNotificationMessage;
            }
        }
コード例 #2
0
        /// <summary>
        /// Method is invoked when the datacontext is changed.
        /// This requires changing event hook-up on attached viewmodel to enable
        /// notification event conversion from viewmodel into view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void MsgBoxView_DataContextChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
        {
            if (this.mAttachedNotificationEvent == true)
            {
                this.mViewModel.ShowNotificationMessage -= ViewModel_ShowNotificationMessage;
            }

            this.mViewModel = e.NewValue as INotifyableViewModel;

            if (this.mViewModel != null)
            {
                this.mViewModel.ShowNotificationMessage += ViewModel_ShowNotificationMessage;
                this.mAttachedNotificationEvent          = true;
            }
            else
            {
                this.mAttachedNotificationEvent = false;
            }
        }