コード例 #1
0
ファイル: DebuggerService.cs プロジェクト: dox0/DotNet471RS3
        private void SetPropertyValue(ModelItem oldModelItem, AttachedProperty property, ModelItem newModelItem)
        {
            // update the previous ModelItem (what was current before)
            if (oldModelItem != null)
            {
                property.NotifyPropertyChanged(oldModelItem);
            }

            // update the current Modelitem
            if (newModelItem != null)
            {
                property.NotifyPropertyChanged(newModelItem);
            }
        }
コード例 #2
0
        void OnItemSelected(Selection newSelection)
        {
            Fx.Assert(newSelection != null, "newSelection is null");
            IList <ModelItem> newSelectionObjects = newSelection.SelectedObjects as IList <ModelItem>;
            IList <ModelItem> oldSelectionObjects = oldSelection.SelectedObjects as IList <ModelItem>;

            //Call notifyPropertyChanged for IsPrimarySelection attached property.
            if (newSelection.PrimarySelection != null && !newSelection.PrimarySelection.Equals(oldSelection.PrimarySelection))
            {
                isPrimarySelectionProperty.NotifyPropertyChanged(oldSelection.PrimarySelection);
                isPrimarySelectionProperty.NotifyPropertyChanged(newSelection.PrimarySelection);
            }
            else if (newSelection.PrimarySelection == null)
            {
                isPrimarySelectionProperty.NotifyPropertyChanged(oldSelection.PrimarySelection);
            }


            //call NotifyPropertyChanged for IsSelection property on ModelItems that were added or removed from selection.
            HashSet <ModelItem> selectionChangeSet = new HashSet <ModelItem>(oldSelectionObjects);

            selectionChangeSet.SymmetricExceptWith(newSelectionObjects);
            foreach (ModelItem selectionChangeMI in selectionChangeSet)
            {
                isSelectionProperty.NotifyPropertyChanged(selectionChangeMI);
            }

            if (helpService != null)
            {
                if (oldSelection.PrimarySelection != null)
                {
                    helpService.RemoveContextAttribute(string.Empty, GetF1HelpTypeKeyword(oldSelection.PrimarySelection.ItemType));
                }

                if (newSelection.PrimarySelection != null)
                {
                    helpService.AddContextAttribute(string.Empty, GetF1HelpTypeKeyword(newSelection.PrimarySelection.ItemType), HelpKeywordType.F1Keyword);
                }
            }
            oldSelection = newSelection;
        }
コード例 #3
0
            void ModelChanged(object sender, ModelChangedEventArgs e)
            {
                ModelChangeInfo changeInfo = e.ModelChangeInfo;

                if (changeInfo != null && changeInfo.ModelChangeType == ModelChangeType.PropertyChanged)
                {
                    Type propertyType = changeInfo.Subject.ItemType;
                    if (changeInfo.PropertyName == "Name")
                    {
                        if (propertyType.Equals(typeof(ActivityBuilder)))
                        {
                            activityBuilderDisplayNameProperty.NotifyPropertyChanged(changeInfo.Subject);
                        }
                        else if (propertyType.Equals(typeof(ActivityTemplateFactoryBuilder)))
                        {
                            activityTemplateFactoryBuilderDisplayNameProperty.NotifyPropertyChanged(changeInfo.Subject);
                        }
                    }
                }
            }