From ca5104094c0ee0be6524e1a0b880b84da1180ffd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexander=20K=C3=B6plinger?= Date: Tue, 10 Jan 2017 16:29:59 +0100 Subject: [PATCH] [bcl] Remove System.Activities.Presentation folder from referencesource We won't import it into Mono anytime soon and the long paths cause issues when checking out Mono on Windows. --- .../Presentation/ExpressionSettingHelper.cs | 58 - .../Presentation/FrameworkNameConstants.cs | 21 - .../Presentation/FrameworkNameExtensions.cs | 46 - .../Activities/Presentation/TypeNameHelper.cs | 106 - .../Xaml/ActivityBuilderExtensions.cs | 43 - .../ActivityTemplateFactoryBuilderReader.cs | 284 --- .../ActivityTemplateFactoryBuilderWriter.cs | 331 --- ...tivityTemplateFactoryBuilderXamlMembers.cs | 51 - .../Presentation/Xaml/AttributeConverter.cs | 68 - .../Presentation/Xaml/AttributeInfo.cs | 36 - .../Presentation/Xaml/AttributeXamlType.cs | 45 - .../Xaml/DefaultValueAttributeInfo.cs | 50 - .../Presentation/Xaml/DesignTimeXamlWriter.cs | 314 --- .../Xaml/DesignerAttributeInfo.cs | 28 - .../Presentation/Xaml/EditorAttributeInfo.cs | 28 - ...kflowDesignerXamlHelperExecutionContext.cs | 32 - .../Presentation/Xaml/ImportAttributeInfo.cs | 90 - .../Xaml/ImportManyAttributeInfo.cs | 93 - .../Presentation/Xaml/LineColumnPair.cs | 27 - .../Xaml/MultiTargetingTypeResolver.cs | 86 - .../Presentation/Xaml/NameSpaces.cs | 22 - .../Xaml/ObjectReferenceEqualityComparer.cs | 43 - .../Presentation/Xaml/ResolverCache.cs | 49 - .../Presentation/Xaml/ResolverResult.cs | 48 - .../Presentation/Xaml/SourceTextScanner.cs | 193 -- .../Presentation/Xaml/ViewStateIdManager.cs | 68 - .../Presentation/Xaml/ViewStateXamlHelper.cs | 866 ------- .../Xaml/WorkflowDesignerXamlHelper.cs | 701 ------ .../Xaml/WorkflowDesignerXamlSchemaContext.cs | 274 --- .../Presentation/Xaml/XamlNamespaceHelper.cs | 35 - .../Xaml/XamlObjectReaderWithSequence.cs | 167 -- .../Presentation/Xaml/XamlTypeKind.cs | 15 - .../Xaml/XamlTypeWithExplicitNamespace.cs | 25 - .../XamlTypeWithExtraPropertiesRemoved.cs | 49 - .../Presentation/Xaml/XamlWriterExtensions.cs | 110 - .../Microsoft/Tools/Common/Win32Interop.cs | 118 - .../System.Activities.Presentation/README.md | 4 + .../AssemblyInfo.cs | 26 - .../Activities/Presentation/SharedFx.cs | 27 - .../Presentation/SharedSR.Designer.cs | 72 - .../SR.Designer.cs | 1174 --------- .../Presentation/ActivityDelegateInfo.cs | 43 - .../ActivityDelegateInfoPresenter.xaml.cs | 54 - .../Presentation/ActivityDelegatePresenter.cs | 196 -- .../Presentation/ActivityDelegateUtilities.cs | 131 - .../Presentation/ActivityDesigner.cs | 357 --- .../ActivityDesignerOptionsAttribute.cs | 40 - .../Annotations/AdornerLocation.cs | 17 - .../Presentation/Annotations/Annotation.cs | 73 - .../Annotations/AnnotationAdorner.cs | 175 -- .../Annotations/AnnotationAdornerService.cs | 15 - .../Annotations/AnnotationManager.cs | 574 ----- .../Annotations/AnnotationStatus.cs | 15 - .../Annotations/DockedAnnotationView.xaml.cs | 79 - .../FloatingAnnotationView.xaml.cs | 95 - .../Annotations/IAnnotationIndicator.cs | 25 - .../Annotations/IAnnotationVisualProvider.cs | 17 - .../Annotations/IDockedAnnotation.cs | 27 - .../Annotations/IFloatingAnnotation.cs | 46 - ...fyArgumentVariableAnnotationTextChanged.cs | 47 - .../UIElementToAnnotationIndicatorAdapter.cs | 58 - .../WorkflowAnnotationAdornerService.cs | 110 - .../Presentation/ArgumentAccessor.cs | 26 - .../Presentation/Base/Core/ContextItem.cs | 57 - .../Base/Core/ContextItemManager.cs | 337 --- .../Presentation/Base/Core/EditingContext.cs | 783 ------ .../Presentation/Base/Core/EnumValidator.cs | 26 - .../Core/GenericTypeParameterConverter.cs | 150 -- .../Core/Internal/Metadata/AttributeData.cs | 100 - .../Internal/Metadata/AttributeDataCache.cs | 272 --- .../Metadata/MutableAttributeTable.cs | 621 ----- .../Automation/AutomatedChoiceEditor.cs | 59 - .../Automation/AutomatedComboBox.cs | 38 - .../Automation/AutomatedListBox.cs | 38 - .../AutomatedListBoxItemAutomationPeer.cs | 32 - .../CategoryContainerAutomationPeer.cs | 660 ----- .../Automation/CategoryListAutomationPeer.cs | 120 - .../HiddenUIElementAutomationPeer.cs | 22 - .../IAutomationFocusChangedEventSource.cs | 15 - .../PropertyContainerAutomationPeer.cs | 206 -- .../PropertyInspectorAutomationPeer.cs | 145 -- .../SubPropertyEditorAutomationPeer.cs | 156 -- .../Automation/TextFormatConverter.cs | 50 - .../Internal/PropertyEditing/CategoryList.cs | 1224 ---------- .../PropertyEditing/CategoryNameMap.cs | 52 - .../PropertyEditing/CiderCategoryContainer.cs | 363 --- .../CiderCategoryLayoutContainer.cs | 35 - .../CiderStandardCategoryLayout.cs | 102 - .../ContainerGeneratedEventArgs.cs | 40 - .../EditModeSwitchButtonKeyboardFix.cs | 155 -- .../PropertyEditing/Editors/BoolViewEditor.cs | 19 - .../Editors/EditorUtilities.cs | 111 - .../Editors/FlagEditor.xaml.cs | 138 -- .../PropertyEditing/Editors/FlagPanel.cs | 121 - .../Editors/FlagStringConverter.cs | 75 - .../Editors/ImageSourceToImageConverter.cs | 47 - ...mFactoryTypeModelToDisplayNameConverter.cs | 62 - .../Editors/NonZeroToBoolConverter.cs | 49 - .../PropertyValueToDisplayNameConverter.cs | 107 - .../PropertyValueToStandardValuesConverter.cs | 146 -- .../Editors/RTLValueConverter.cs | 58 - .../Editors/SubPropertyEditor.cs | 630 ----- .../Editors/SubPropertyViewEditor.cs | 46 - .../Editors/ValueToToolTipConverter.cs | 35 - ...itemfactorytypemodeltotypenameconverter.cs | 41 - .../Editors/quickitemtemplateselector.cs | 63 - .../PropertyEditing/ExtensibilityAccessor.cs | 941 ------- .../Diagnostics/AutomationId.cs | 45 - .../Framework/Controls/WorkaroundPopup.cs | 142 -- .../Framework/Data/AppendSuffixConverter.cs | 55 - .../Framework/Data/BoolToDoubleConverter.cs | 81 - .../BoolToVisibilityCollpasedConverter.cs | 61 - .../Data/BoolToVisibilityHiddenConverter.cs | 56 - .../Framework/Data/ComposingConverter.cs | 45 - .../Framework/Data/DelegateCommand.cs | 49 - .../Framework/Data/EqualsConverter.cs | 35 - .../Data/IntegerToVisibilityConverter.cs | 62 - .../Framework/Data/IsNullConverter.cs | 32 - .../Framework/Data/NotConverter.cs | 34 - .../Framework/Data/NullToBoolConverter.cs | 39 - .../Framework/Data/ObservableCollection.cs | 70 - .../Framework/Data/SwitchConverter.cs | 107 - .../Framework/Data/ValueConverters.cs | 100 - .../Framework/Data/VisibilityOrConverter.cs | 40 - .../Framework/ExceptionStringTable.cs | 44 - .../Framework/IMessageLogger.cs | 17 - .../FromExpression/Framework/MixedProperty.cs | 19 - .../PropertyInspector/CategoryBase.cs | 317 --- .../CategoryContainer.xaml.cs | 629 ----- .../CategoryContainerCommands.cs | 40 - .../CategoryLayoutContainer.cs | 33 - .../ExtensibilityMetadataHelper.cs | 113 - .../PropertyInspector/IPropertyInspector.cs | 90 - .../NewItemFactoryTypeModel.cs | 103 - .../PropertyContainerPopupHelper.cs | 74 - .../StandardCategoryLayout.cs | 40 - .../FromExpression/Framework/Tolerances.cs | 30 - .../Framework/UIThreadDispatcher.cs | 100 - .../UserInterface/FocusScopeManager.cs | 448 ---- .../Framework/ValueEditors/ChoiceEditor.cs | 1236 ---------- .../Framework/ValueEditors/RenderUtils.cs | 54 - .../Framework/ValueEditors/StringEditor.cs | 376 --- .../ValueEditors/ValueEditorUtils.cs | 87 - .../ValueEditors/ValueToIconConverter.cs | 51 - .../PropertyEditing/IStateContainer.cs | 26 - .../KeyboardEnabledRadioButton.cs | 28 - .../Metadata/PropertyInspectorMetadata.cs | 70 - .../Model/ModelCategoryEntry.cs | 331 --- .../Model/ModelPropertyEntry.cs | 1387 ----------- .../Model/ModelPropertyEntryBase.cs | 175 -- .../Model/ModelPropertyEntryCollection.cs | 177 -- .../Model/ModelPropertyIndexer.cs | 375 --- .../Model/ModelPropertyMerger.cs | 303 --- .../Model/ModelPropertyValue.cs | 429 ---- .../Model/ModelPropertyValueCollection.cs | 530 ---- .../PropertyEditing/Model/ModelUtilities.cs | 258 -- .../Model/PropertyEntryNameComparer.cs | 57 - .../PropertyEntryPropertyOrderComparer.cs | 89 - .../PropertyEditing/PropertyInspector.xaml.cs | 1052 -------- ...PropertyInspectorFontAndColorDictionary.cs | 70 - .../PropertyInspectorMergedResources.cs | 202 -- .../Internal/PropertyEditing/PropertyPanel.cs | 308 --- .../PropertyEditing/PropertySelectionMode.cs | 19 - .../PropertyEditing/PropertyToolBar.cs | 335 --- .../PropertyValueDialogControl.xaml.cs | 151 -- .../PropertyValueDialogHost.cs | 195 -- .../PropertyValueEditorCommandHandler.cs | 215 -- .../Resources/PropertyInspectorResources.cs | 104 - .../Resources/ResourceUtilities.cs | 45 - .../PropertyEditing/SearchDirection.cs | 15 - ...tegoryContainerSelectionPathInterpreter.cs | 102 - .../CategoryEditorSelectionPathInterpreter.cs | 81 - .../Selection/CategoryEditorSelectionStop.cs | 82 - .../Selection/CategorySelectionStop.cs | 93 - .../Selection/ISelectionPathInterpreter.cs | 34 - .../Selection/ISelectionStop.cs | 45 - .../Selection/PropertySelection.cs | 703 ------ .../PropertySelectionPathInterpreter.cs | 122 - .../Selection/PropertySelectionStop.cs | 81 - .../Selection/SelectionPath.cs | 72 - .../Selection/SelectionPathResolver.cs | 77 - ...SharedPropertyValueColumnWidthContainer.cs | 210 -- .../State/AggregateStateContainer.cs | 59 - .../PropertyEditing/State/CategoryState.cs | 122 - .../State/CategoryStateContainer.cs | 47 - .../PropertyEditing/State/PersistedState.cs | 44 - .../State/PersistedStateContainer.cs | 122 - .../State/PersistedStateUtilities.cs | 71 - .../PropertyActiveEditModeStateContainer.cs | 104 - .../PropertyEditing/State/PropertyState.cs | 106 - .../State/PropertyStateContainer.cs | 72 - .../PropertyViewManagerStateContainer.cs | 179 -- .../Views/AlphabeticalViewManager.cs | 166 -- .../Views/ByCategoryViewManager.cs | 227 -- .../Views/IPropertyViewManager.cs | 80 - .../PropertyEditing/VisualTreeUtils.cs | 359 --- .../Base/Core/Internal/manifestimages.cs | 321 --- .../Base/Core/Metadata/AttributeCallback.cs | 17 - .../Core/Metadata/AttributeCallbackBuilder.cs | 146 -- .../Base/Core/Metadata/AttributeTable.cs | 195 -- .../Core/Metadata/AttributeTableBuilder.cs | 266 -- .../AttributeTableValidationException.cs | 147 -- .../Base/Core/Metadata/IRegisterMetadata.cs | 28 - .../Base/Core/Metadata/MetadataStore.cs | 2006 --------------- .../Presentation/Base/Core/OrderToken.cs | 143 -- .../Base/Core/OrderTokenConflictResolution.cs | 28 - .../Base/Core/OrderTokenPrecedence.cs | 21 - .../Core/Properties/Resources.Designer.cs | 775 ------ .../Core/PropertyEditing/CategoryEditor.cs | 84 - .../DependencyPropertyValueSource.cs | 220 -- .../DialogPropertyValueEditor.cs | 66 - .../PropertyEditing/EditModeSwitchButton.cs | 249 -- .../PropertyEditing/EditorReuseAttribute.cs | 21 - .../Core/PropertyEditing/EnumValidator.cs | 21 - .../ExtendedPropertyValueEditor.cs | 51 - .../PropertyEditing/IPropertyFilterTarget.cs | 34 - .../Core/PropertyEditing/PropertyContainer.cs | 804 ------ .../PropertyContainerEditMode.cs | 27 - .../Core/PropertyEditing/PropertyFilter.cs | 103 - .../PropertyFilterAppliedEventArgs.cs | 28 - .../PropertyFilterPredicate.cs | 46 - .../Core/PropertyEditing/PropertyMarker.cs | 14 - .../Core/PropertyEditing/PropertyOrder.cs | 70 - .../PropertyEditing/PropertyOrderAttribute.cs | 35 - .../Core/PropertyEditing/PropertyValue.cs | 406 --- .../PropertyValueCollection.cs | 115 - .../PropertyEditing/PropertyValueEditor.cs | 85 - .../PropertyValueEditorCommands.cs | 126 - .../PropertyValueExceptionEventArgs.cs | 63 - .../PropertyValueExceptionSource.cs | 18 - .../PropertyEditing/PropertyValueSource.cs | 10 - .../Core/PropertyEditing/categoryentry.cs | 120 - .../Core/PropertyEditing/newitemfactory.cs | 90 - .../PropertyEditing/newitemtypesattribute.cs | 122 - .../Core/PropertyEditing/propertyentry.cs | 217 -- .../propertyentrycollection.cs | 61 - .../Base/Core/PublishServiceCallback.cs | 21 - .../Presentation/Base/Core/ServiceManager.cs | 427 ---- .../Base/Core/SubscribeContextCallback.cs | 23 - .../Base/Core/SubscribeServiceCallback.cs | 19 - .../Base/Documents/ViewManager.cs | 49 - .../Base/Documents/ViewManagerAttribute.cs | 55 - .../Base/Interaction/Model/CreateOptions.cs | 27 - .../Base/Interaction/Model/EnumValidator.cs | 22 - .../Interaction/Model/ModelEditingScope.cs | 223 -- .../Base/Interaction/Model/ModelFactory.cs | 113 - .../Base/Interaction/Model/ModelItem.cs | 265 -- .../Interaction/Model/ModelItemCollection.cs | 375 --- .../Interaction/Model/ModelItemDictionary.cs | 477 ---- .../Model/ModelMemberCollection.cs | 123 - .../Base/Interaction/Model/ModelProperty.cs | 231 -- .../Model/ModelPropertyCollection.cs | 24 - .../Interaction/Services/ModelChangeInfo.cs | 46 - .../Services/ModelChangeInfoImpl.cs | 90 - .../Interaction/Services/ModelChangeType.cs | 49 - .../Services/ModelChangedEventArgs.cs | 51 - .../Base/Interaction/Services/ViewService.cs | 52 - .../Base/Shared/Internal/EqualityArray.cs | 36 - .../Presentation/BookmarkUndoUnit.cs | 76 - .../CachedResourceDictionaryExtension.cs | 34 - .../Activities/Presentation/ClipboardData.cs | 26 - .../Presentation/ContextMenuUtilities.cs | 161 -- ...ActivityActionSearchableStringConverter.cs | 22 - .../ArgumentSearchableStringConverter.cs | 21 - .../ArgumentToExpressionConverter.cs | 104 - .../ArgumentToExpressionModelItemConverter.cs | 82 - .../EmptySearchableStringConverter.cs | 19 - .../EncodingSearchableStringConverter.cs | 25 - .../ModelItemToAnnotationEnabledConverter.cs | 35 - .../ModelPropertyEntryToModelItemConverter.cs | 191 -- ...elPropertyEntryToOwnerActivityConverter.cs | 64 - .../Converters/ModelToObjectValueConverter.cs | 37 - .../Converters/ObjectToModelValueConverter.cs | 48 - .../Converters/OutlineViewTextConverter.cs | 53 - .../Converters/SearchableStringConverter.cs | 13 - .../SearchableStringConverterAttribute.cs | 24 - .../TypeSearchableStringConverter.cs | 23 - .../Converters/VBIdentifierTrimConverter.cs | 28 - ...sualBasicValueSearchableStringConverter.cs | 29 - .../XNameSearchableStringConverter.cs | 22 - .../Presentation/CutCopyPasteHelper.cs | 781 ------ .../Debugger/AllowBreakpointAttribute.cs | 23 - .../Presentation/Debugger/BreakpointType.cs | 15 - .../Presentation/Debugger/DebuggerService.cs | 867 ------- .../Debugger/IDesignerDebugView.cs | 52 - .../DefaultCommandExtensionCallback.cs | 205 -- .../DefaultTypeArgumentAttribute.cs | 30 - .../Activities/Presentation/DeleteHelper.cs | 87 - .../Presentation/DesignObjectWrapper.cs | 844 ------- .../DesignTimeValidationFeature.cs | 40 - .../DesignerConfigurationService.cs | 538 ---- .../DesignerConfigurationServiceUtilities.cs | 37 - .../Presentation/DesignerMetadata.cs | 105 - .../Presentation/DesignerPerfEventProvider.cs | 319 --- .../Presentation/DesignerPerfEvents.cs | 44 - .../Activities/Presentation/DialogWindow.cs | 94 - .../Presentation/DictionaryItemsCollection.cs | 129 - .../Presentation/DockedAnnotationDecorator.cs | 37 - .../Activities/Presentation/DragDropHelper.cs | 938 ------- .../Presentation/DropAnimation.xaml.cs | 16 - .../DynamicActivityPropertyUtilities.cs | 28 - .../Presentation/EditingContextUtilities.cs | 38 - .../Presentation/EditingScopeUndoUnit.cs | 71 - .../Presentation/EditorOptionAttribute.cs | 70 - .../Activities/Presentation/ErrorActivity.cs | 89 - .../Activities/Presentation/ErrorItem.cs | 23 - .../Activities/Presentation/ErrorReporting.cs | 229 -- .../ExpandButtonVisibilityConverter.cs | 53 - .../ExpandCollapseIsCheckedConverter.cs | 31 - .../Presentation/ExpressionHelper.cs | 234 -- .../Presentation/ExpressionSelection.cs | 36 - .../Expressions/CreateExpressionFromString.cs | 15 - .../Expressions/ExpressionActivityEditor.cs | 202 -- .../Expressions/ExpressionMorphHelper.cs | 19 - .../ExpressionMorphHelperAttribute.cs | 38 - .../Expressions/TextualExpressionEditor.cs | 135 - .../System/Activities/Presentation/Feature.cs | 11 - .../Presentation/FeatureAttribute.cs | 40 - .../Activities/Presentation/FeatureManager.cs | 48 - .../FreeFormEditing/AutoConnectAdorner.cs | 229 -- .../FreeFormEditing/AutoConnectDirections.cs | 40 - .../FreeFormEditing/AutoConnectHelper.cs | 321 --- .../FreeFormEditing/AutoSplitAdorner.cs | 32 - .../FreeFormEditing/AutoSplitAlignment.cs | 29 - .../FreeFormEditing/AutoSplitHelper.cs | 169 -- .../FreeFormEditing/ConnectionPoint.cs | 217 -- .../ConnectionPointConverter.cs | 43 - .../FreeFormEditing/ConnectionPointKind.cs | 13 - .../ConnectionPointsAdorner.cs | 70 - .../Presentation/FreeFormEditing/Connector.cs | 317 --- .../ConnectorCreationAdorner.cs | 39 - .../FreeFormEditing/ConnectorEditor.cs | 620 ----- .../ConnectorIdentityConverter.cs | 28 - .../ConnectorLabelMarginConverter.cs | 48 - .../ConnectorLabelVisibilityConverter.cs | 42 - .../ConnectorMovedEventArgs.cs | 29 - .../ConnectorMovedEventHandler.cs | 8 - .../ConnectorPointsToArrowMarginConverter.cs | 57 - ...onnectorPointsToArrowTransformConverter.cs | 69 - .../ConnectorPointsToSegmentsConverter.cs | 65 - .../FreeFormEditing/ConnectorRouter.cs | 1515 ------------ .../ConnectorStartDotConverter.cs | 42 - .../ConnectorWithStartDot.xaml.cs | 65 - .../ConnectorWithoutStartDot.xaml.cs | 21 - .../FreeFormEditing/DesignerGeometryHelper.cs | 81 - .../FreeFormEditing/DoubleExtensions.cs | 27 - .../FreeFormEditing/FreeFormPanel.cs | 630 ----- .../FreeFormEditing/IAutoConnectContainer.cs | 20 - .../FreeFormEditing/IAutoSplitContainer.cs | 20 - .../INestedFreeFormPanelContainer.cs | 12 - .../LocationChangedEventArgs.cs | 28 - .../LocationChangedEventHandler.cs | 8 - .../FreeFormEditing/PointExtensions.cs | 16 - .../RequiredSizeChangedEventArgs.cs | 23 - .../RequiredSizeChangedEventHandler.cs | 8 - .../GenericTypeParameterConverter.cs | 47 - .../Activities/Presentation/HelpKeywords.cs | 25 - .../Presentation/Hosting/ICommandService.cs | 29 - .../Hosting/IDocumentPersistenceService.cs | 23 - .../Hosting/IMultiTargetingSupportService.cs | 23 - .../IWorkflowCommandExtensionCallback.cs | 36 - .../Hosting/MultiTargetingSupportService.cs | 48 - .../Hosting/WindowHelperService.cs | 185 -- .../Hosting/WorkflowCommandExtensionItem.cs | 36 - .../Presentation/IActivityDelegateFactory.cs | 15 - .../Presentation/IActivityToolboxService.cs | 19 - .../Activities/Presentation/ICompositeView.cs | 24 - .../Presentation/ICompositeViewEvents.cs | 19 - .../Activities/Presentation/IExpandChild.cs | 16 - .../Presentation/IIntegratedHelpService.cs | 19 - .../Activities/Presentation/IModalService.cs | 11 - .../IMultipleDragEnabledCompositeView.cs | 36 - .../Presentation/IUndoEngineOperations.cs | 13 - .../IWorkflowDesignerStorageService.cs | 20 - .../Presentation/IXamlLoadErrorService.cs | 13 - .../Metadata/ActivityArgumentHelper.cs | 404 --- .../ActivityDelegateArgumentDirection.cs | 14 - .../ActivityDelegateArgumentMetadata.cs | 29 - .../Metadata/ActivityDelegateMetadata.cs | 16 - .../MiniMap/MiniMapControl.xaml.cs | 514 ---- .../Model/AttachablePropertyChange.cs | 60 - .../Model/AttachedPropertiesService.cs | 52 - .../Presentation/Model/AttachedProperty.cs | 117 - .../Model/AttachedPropertyDescriptor.cs | 96 - .../Model/AttachedPropertyInfo.cs | 40 - .../Presentation/Model/BackPointer.cs | 21 - .../Activities/Presentation/Model/Change.cs | 17 - .../Presentation/Model/CollectionChange.cs | 107 - .../Presentation/Model/DictionaryChange.cs | 116 - .../Model/DictionaryEditChange.cs | 72 - .../Activities/Presentation/Model/Edge.cs | 21 - .../Presentation/Model/EditingScope.cs | 287 --- .../Model/EditingScopeEventArgs.cs | 17 - .../Presentation/Model/FakeModelItemImpl.cs | 54 - .../Model/FakeModelPropertyImpl.cs | 185 -- .../Model/GenericArgumentsUpdater.cs | 90 - .../Presentation/Model/GraphManager.cs | 279 --- .../Presentation/Model/IItemsCollection.cs | 18 - .../Presentation/Model/IModelTreeItem.cs | 53 - .../Model/ImmediateEditingScope.cs | 46 - .../Activities/Presentation/Model/LinkBase.cs | 43 - .../Activities/Presentation/Model/LinkType.cs | 14 - .../Presentation/Model/ModelChange.cs | 14 - .../Model/ModelChangedEventArgsImpl.cs | 67 - .../Model/ModelItemCollectionImpl.cs | 696 ------ .../Model/ModelItemDictionaryImpl.cs | 1288 ---------- .../Presentation/Model/ModelItemExtensions.cs | 1028 -------- .../Presentation/Model/ModelItemHelper.cs | 67 - .../Presentation/Model/ModelItemImpl.cs | 560 ----- .../Model/ModelItemsAddedEventArgs.cs | 23 - .../Model/ModelItemsRemovedEventArgs.cs | 22 - .../Model/ModelPropertyCollectionImpl.cs | 127 - .../Model/ModelPropertyDescriptor.cs | 147 -- .../Presentation/Model/ModelPropertyImpl.cs | 249 -- .../Presentation/Model/ModelSearchService.cs | 43 - .../Model/ModelSearchServiceImpl.cs | 778 ------ .../Presentation/Model/ModelService.cs | 193 -- .../Presentation/Model/ModelServiceImpl.cs | 151 -- .../Presentation/Model/ModelTreeItemHelper.cs | 44 - .../Presentation/Model/ModelTreeManager.cs | 1349 ---------- .../Presentation/Model/ModelTypeConverter.cs | 225 -- .../ModelTypeDescriptorContextWrapper.cs | 157 -- .../Presentation/Model/ModelUtilities.cs | 122 - .../Presentation/Model/MorphHelper.cs | 152 -- .../Presentation/Model/PropertyChange.cs | 64 - .../Model/PropertyReferenceChange.cs | 48 - .../PropertyReferenceChangedEventArgs.cs | 24 - .../Presentation/Model/SearchableEntry.cs | 17 - .../Model/SearchableEntryOption.cs | 14 - .../Presentation/Model/TextImage.cs | 21 - .../Presentation/Model/WeakKeyDictionary.cs | 424 ---- .../Model/WeakKeyDictionary.cs.back | 424 ---- .../Presentation/Model/XamlUtilities.cs | 82 - .../Presentation/ModelItemKeyValuePair.cs | 67 - .../Presentation/NamespaceHelper.cs | 181 -- .../Presentation/NamespaceHelper.cs.back | 181 -- .../Presentation/NamespaceListProperty.cs | 594 ----- .../NamespaceListProperty.cs.back | 594 ----- .../Presentation/NamespaceSettingsHandler.cs | 187 -- .../NonTextualExpressionMorphHelper.cs | 51 - .../Activities/Presentation/NotConverter.cs | 25 - .../Presentation/NullToBooleanConverter.cs | 24 - .../Presentation/ObjectReferenceService.cs | 241 -- .../VersionPropertyValueEditor.cs | 19 - .../PropertyReferenceUtilities.cs | 76 - .../Activities/Presentation/ReadOnlyState.cs | 21 - .../Presentation/RetriableClipboard.cs | 84 - .../Presentation/SQM/ActivityUsageCounter.cs | 143 -- .../Presentation/SQM/DataPointIds.cs | 17 - .../Presentation/SQM/FeatureUsageCounter.cs | 35 - .../Presentation/SQM/IVSSqmService.cs | 32 - .../ShowExpandedMultiValueConverter.cs | 56 - .../SourceLocationUpdatedEventArgs.cs | 43 - .../TargetFrameworkPropertyFilter.cs | 44 - .../Activities/Presentation/TaskDispatcher.cs | 34 - .../Presentation/TextFormattingConverter.cs | 33 - .../ActivityTemplateFactory.Generic.cs | 54 - .../Toolbox/ActivityTemplateFactory.cs | 52 - .../Toolbox/ActivityTemplateFactoryBuilder.cs | 48 - .../ActivityTemplateFactoryExtension.cs | 35 - .../Toolbox/IActivityTemplateFactory.cs | 18 - .../Toolbox/ToolCreatedEventArgs.cs | 33 - .../Toolbox/ToolCreatedEventHandler.cs | 10 - .../Presentation/Toolbox/ToolboxCategory.cs | 232 -- .../Toolbox/ToolboxCategoryItems.cs | 216 -- .../Presentation/Toolbox/ToolboxControl.cs | 407 ---- .../Toolbox/ToolboxItemImageConverter.cs | 47 - .../Presentation/Toolbox/ToolboxItemLoader.cs | 167 -- .../Toolbox/ToolboxItemWrapper.cs | 423 ---- .../Toolbox/TreeViewContainerStyleSelector.cs | 177 -- .../Toolbox/TreeViewTemplateSelector.cs | 38 - .../Presentation/TypeNameConverter.cs | 37 - .../TypeResolvingOptionsAttribute.cs | 36 - .../Activities/Presentation/TypeUtilities.cs | 125 - .../Activities/Presentation/UndoEngine.cs | 343 --- .../Activities/Presentation/UndoUnit.cs | 52 - .../Presentation/UndoUnitEventArgs.cs | 17 - .../Presentation/UpdatableGenericsFeature.cs | 23 - .../Presentation/Utility/IconHelper.cs | 109 - .../BackgroundValidationSynchronizer.cs | 373 --- .../ForegroundValidationSynchronizer.cs | 44 - .../Validation/IValidationErrorService.cs | 13 - .../IValidationErrorSourceLocator.cs | 19 - .../Validation/ValidationErrorInfo.cs | 48 - .../Validation/ValidationReason.cs | 14 - .../Presentation/Validation/ValidationRoot.cs | 57 - .../Validation/ValidationService.cs | 1034 -------- .../Validation/ValidationState.cs | 40 - .../Validation/ValidationSynchronizer.cs | 15 - .../ValidationErrorSourceLocatorFeature.cs | 26 - .../VariableExpressionConverter.cs | 36 - .../Presentation/VerticalConnector.xaml.cs | 50 - .../View/ActivityTypeDesigner.xaml.cs | 143 -- .../View/ActivityTypeResolver.xaml.cs | 290 --- .../View/AnnotationDialog.xaml.cs | 64 - .../View/ArgumentDesigner.xaml.cs | 1581 ------------ .../View/AssemblyContextControlItem.cs | 134 - .../Presentation/View/AutoScrollHelper.cs | 96 - .../View/BreadCrumbTextConverter.cs | 63 - .../View/CanExpandCollapseAllConverter.cs | 29 - .../Presentation/View/DataGridHelper.cs | 1566 ------------ .../View/DesignerView.Commands.cs | 1767 -------------- .../Presentation/View/DesignerView.xaml.cs | 1772 -------------- .../Presentation/View/DesignerWithHeader.cs | 24 - .../Presentation/View/EditorResources.cs | 42 - .../Presentation/View/ErrorView.xaml.cs | 72 - .../View/ExpressionTextBox.xaml.cs | 855 ------- .../View/ExpressionTextBoxAutomationPeer.cs | 34 - .../View/ExpressionValueEditor.cs | 107 - .../Presentation/View/ExtensionSurface.cs | 514 ---- .../Presentation/View/ExtensionWindow.cs | 581 ----- .../ExtensionWindowClosingRoutedEventArgs.cs | 24 - .../View/ExtensionWindowHeader.cs | 133 - .../View/ExtensionWindowResizeGrip.cs | 85 - .../Presentation/View/FilterableData.cs | 66 - .../View/GenericActivityTypeDesigner.xaml.cs | 52 - .../Presentation/View/HandleValueEditor.cs | 17 - .../View/IExpressionEditorInstance.cs | 59 - .../View/IExpressionEditorService.cs | 24 - .../Presentation/View/IVersionEditor.cs | 13 - .../Presentation/View/ImportDesigner.xaml.cs | 786 ------ .../View/ImportedNamespaceContextItem.cs | 54 - .../ModelPropertyPathExpanderConverter.cs | 54 - .../View/NamespaceDisplay.xaml.cs | 66 - .../View/NamespaceDisplayAutomationPeer.cs | 35 - .../Presentation/View/NoContextMenuGrid.cs | 18 - .../HidePropertyInOutlineViewAttribute.cs | 18 - .../OutlineView/ShowInOutlineViewAttribute.cs | 23 - ...PropertyInOutlineViewAsSiblingAttribute.cs | 18 - .../ShowPropertyInOutlineViewAttribute.cs | 41 - .../Presentation/View/ParserContext.cs | 295 --- .../PropertyEntryToEditingContextConverter.cs | 34 - .../PropertyEntryToEditorOptionConverter.cs | 66 - .../Activities/Presentation/View/QuadTree.cs | 653 ----- .../Presentation/View/RubberBandSelector.cs | 339 --- .../Presentation/View/ScrollViewerPanner.cs | 327 --- .../Presentation/View/SearchToolTipAdorner.cs | 66 - .../Activities/Presentation/View/Selection.cs | 367 --- .../View/SpacerPlaceholder.xaml.cs | 40 - .../TreeView/ChangeNotificationTracker.cs | 170 -- .../TreeView/DesignerTreeAutoExpandHelper.cs | 135 - .../View/TreeView/DesignerTreeView.xaml.cs | 88 - .../View/TreeView/DesignerTreeViewItem.cs | 204 -- .../TreeView/ITreeViewItemSelectionHandler.cs | 15 - ...eViewItemKeyValuePairModelItemViewModel.cs | 90 - .../TreeViewItemModelItemViewModel.cs | 514 ---- .../TreeViewItemModelPropertyViewModel.cs | 126 - .../View/TreeView/TreeViewItemViewModel.cs | 699 ------ .../View/TreeView/UniqueModelItemHelper.cs | 213 -- .../Presentation/View/TypeBrowser.xaml.cs | 857 ------- .../Presentation/View/TypeKeyValue.cs | 196 -- .../Presentation/View/TypePresenter.xaml.cs | 912 ------- .../Presentation/View/TypePropertyEditor.cs | 22 - .../Presentation/View/TypeResolvingOptions.cs | 169 -- .../View/TypeToArgumentTypeConverter.cs | 36 - .../View/TypeToStringValueConverter.cs | 60 - .../View/VBIdentifierDesigner.xaml.cs | 212 -- .../Presentation/View/VBIdentifierName.cs | 147 -- .../View/VBIdentifierNameEditor.cs | 18 - .../View/VariableDesigner.xaml.cs | 1572 ------------ .../Presentation/View/VersionEditor.xaml.cs | 74 - .../View/VersionEditorViewModel.cs | 96 - .../Presentation/View/ViewCreatedEventArgs.cs | 40 - .../View/ViewStateChangedEventArgs.cs | 59 - .../View/ViewStateChangedEventHandler.cs | 8 - .../Presentation/View/ViewStateService.cs | 20 - .../Presentation/View/ViewUtilities.cs | 283 --- .../View/VirtualizedContainerService.cs | 520 ---- .../View/VisualBasicEditor.xaml.cs | 2167 ----------------- .../View/VisualBasicEditorAutomationPeer.cs | 35 - .../VisualBasicReferenceValidationFeature.cs | 32 - .../View/VisualBasicValueValidationFeature.cs | 32 - .../View/WindowExtensionMethods.cs | 106 - .../Presentation/View/WorkflowViewManager.cs | 161 -- .../Presentation/View/WorkflowViewService.cs | 241 -- .../View/WorkflowViewStateService.cs | 216 -- .../Activities/Presentation/ViewModel.cs | 23 - .../Presentation/ViewState/ViewStateData.cs | 28 - .../ViewState/ViewStateManager.cs | 44 - .../ViewState/WorkflowViewState.cs | 82 - .../ViewStateAttachedPropertyFeature.cs | 96 - .../VisualBasicExpressionMorphHelper.cs | 63 - .../Presentation/WorkflowDesigner.Debugger.cs | 93 - .../Presentation/WorkflowDesigner.Helpers.cs | 174 -- .../WorkflowDesigner.SerializationHelpers.cs | 166 -- .../Presentation/WorkflowDesigner.cs | 670 ----- .../Presentation/WorkflowDesignerColors.cs | 597 ----- .../Presentation/WorkflowDesignerIcons.cs | 1538 ------------ .../Presentation/WorkflowElementDialog.cs | 179 -- .../WorkflowElementDialogWindow.xaml.cs | 91 - .../Presentation/WorkflowFileItem.cs | 20 - .../Presentation/WorkflowItemPresenter.cs | 1203 --------- .../Presentation/WorkflowItemsPresenter.cs | 961 -------- .../Presentation/WorkflowViewElement.cs | 1152 --------- .../Activities/Presentation/XNameConverter.cs | 49 - .../Xaml/ActivityBuilderHelper.cs | 91 - .../Xaml/ErrorTolerantObjectWriter.cs | 1268 ---------- .../Xaml/MultiTargetingXamlSchemaContext.cs | 38 - .../Xaml/ObjectToSourceLocationMapping.cs | 257 -- .../Presentation/Xaml/ShimAsPublicXamlType.cs | 23 - .../Xaml/SourceLocationExtensions.cs | 27 - .../Presentation/XamlLoadErrorInfo.cs | 29 - 602 files changed, 4 insertions(+), 107315 deletions(-) delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/ExpressionSettingHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/FrameworkNameConstants.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/FrameworkNameExtensions.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/TypeNameHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ActivityBuilderExtensions.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ActivityTemplateFactoryBuilderReader.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ActivityTemplateFactoryBuilderWriter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ActivityTemplateFactoryBuilderXamlMembers.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/AttributeConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/AttributeInfo.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/AttributeXamlType.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/DefaultValueAttributeInfo.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/DesignTimeXamlWriter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/DesignerAttributeInfo.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/EditorAttributeInfo.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/IWorkflowDesignerXamlHelperExecutionContext.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ImportAttributeInfo.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ImportManyAttributeInfo.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/LineColumnPair.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/MultiTargetingTypeResolver.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/NameSpaces.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ObjectReferenceEqualityComparer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ResolverCache.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ResolverResult.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/SourceTextScanner.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ViewStateIdManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ViewStateXamlHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/WorkflowDesignerXamlHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/WorkflowDesignerXamlSchemaContext.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlNamespaceHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlObjectReaderWithSequence.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlTypeKind.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlTypeWithExplicitNamespace.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlTypeWithExtraPropertiesRemoved.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlWriterExtensions.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Tools/Common/Win32Interop.cs create mode 100644 mcs/class/referencesource/System.Activities.Presentation/README.md delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/AssemblyInfo.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/Microsoft/Activities/Presentation/SharedFx.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/Microsoft/Activities/Presentation/SharedSR.Designer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/SR.Designer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegateInfo.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegateInfoPresenter.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegatePresenter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegateUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDesigner.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDesignerOptionsAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AdornerLocation.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/Annotation.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationAdorner.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationAdornerService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationStatus.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/DockedAnnotationView.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/FloatingAnnotationView.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IAnnotationIndicator.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IAnnotationVisualProvider.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IDockedAnnotation.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IFloatingAnnotation.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/NotifyArgumentVariableAnnotationTextChanged.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/UIElementToAnnotationIndicatorAdapter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/WorkflowAnnotationAdornerService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ArgumentAccessor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/ContextItem.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/ContextItemManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/EditingContext.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/EnumValidator.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/GenericTypeParameterConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/Metadata/AttributeData.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/Metadata/AttributeDataCache.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/Metadata/MutableAttributeTable.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedChoiceEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedComboBox.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedListBox.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedListBoxItemAutomationPeer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/CategoryContainerAutomationPeer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/CategoryListAutomationPeer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/HiddenUIElementAutomationPeer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/IAutomationFocusChangedEventSource.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/PropertyContainerAutomationPeer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/PropertyInspectorAutomationPeer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/SubPropertyEditorAutomationPeer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/TextFormatConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CategoryList.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CategoryNameMap.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CiderCategoryContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CiderCategoryLayoutContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CiderStandardCategoryLayout.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/ContainerGeneratedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/EditModeSwitchButtonKeyboardFix.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/BoolViewEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/EditorUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/FlagEditor.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/FlagPanel.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/FlagStringConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/ImageSourceToImageConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/NewItemFactoryTypeModelToDisplayNameConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/NonZeroToBoolConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/PropertyValueToDisplayNameConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/PropertyValueToStandardValuesConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/RTLValueConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/SubPropertyEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/SubPropertyViewEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/ValueToToolTipConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/newitemfactorytypemodeltotypenameconverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/quickitemtemplateselector.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/ExtensibilityAccessor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Diagnostics/AutomationId.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Controls/WorkaroundPopup.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/AppendSuffixConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/BoolToDoubleConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/BoolToVisibilityCollpasedConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/BoolToVisibilityHiddenConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/ComposingConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/DelegateCommand.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/EqualsConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/IntegerToVisibilityConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/IsNullConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/NotConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/NullToBoolConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/ObservableCollection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/SwitchConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/ValueConverters.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/VisibilityOrConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ExceptionStringTable.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/IMessageLogger.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/MixedProperty.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryBase.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryContainer.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryContainerCommands.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryLayoutContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/ExtensibilityMetadataHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/IPropertyInspector.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/NewItemFactoryTypeModel.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/PropertyContainerPopupHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/StandardCategoryLayout.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Tolerances.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/UIThreadDispatcher.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/UserInterface/FocusScopeManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/ChoiceEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/RenderUtils.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/StringEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/ValueEditorUtils.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/ValueToIconConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/IStateContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/KeyboardEnabledRadioButton.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Metadata/PropertyInspectorMetadata.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelCategoryEntry.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyEntry.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyEntryBase.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyEntryCollection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyIndexer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyMerger.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyValue.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyValueCollection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/PropertyEntryNameComparer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/PropertyEntryPropertyOrderComparer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyInspector.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyInspectorFontAndColorDictionary.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyInspectorMergedResources.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyPanel.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertySelectionMode.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyToolBar.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyValueDialogControl.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyValueDialogHost.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyValueEditorCommandHandler.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Resources/PropertyInspectorResources.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Resources/ResourceUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/SearchDirection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Selection/CategoryContainerSelectionPathInterpreter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Selection/CategoryEditorSelectionPathInterpreter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Selection/CategoryEditorSelectionStop.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Selection/CategorySelectionStop.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Selection/ISelectionPathInterpreter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Selection/ISelectionStop.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Selection/PropertySelection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Selection/PropertySelectionPathInterpreter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Selection/PropertySelectionStop.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Selection/SelectionPath.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Selection/SelectionPathResolver.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/SharedPropertyValueColumnWidthContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/State/AggregateStateContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/State/CategoryState.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/State/CategoryStateContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/State/PersistedState.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/State/PersistedStateContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/State/PersistedStateUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/State/PropertyActiveEditModeStateContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/State/PropertyState.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/State/PropertyStateContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/State/PropertyViewManagerStateContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Views/AlphabeticalViewManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Views/ByCategoryViewManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Views/IPropertyViewManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/VisualTreeUtils.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/manifestimages.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Metadata/AttributeCallback.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Metadata/AttributeCallbackBuilder.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Metadata/AttributeTable.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Metadata/AttributeTableBuilder.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Metadata/AttributeTableValidationException.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Metadata/IRegisterMetadata.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Metadata/MetadataStore.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/OrderToken.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/OrderTokenConflictResolution.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/OrderTokenPrecedence.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Properties/Resources.Designer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/CategoryEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/DependencyPropertyValueSource.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/DialogPropertyValueEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/EditModeSwitchButton.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/EditorReuseAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/EnumValidator.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/ExtendedPropertyValueEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/IPropertyFilterTarget.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyContainerEditMode.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyFilter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyFilterAppliedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyFilterPredicate.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyMarker.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyOrder.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyOrderAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyValue.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyValueCollection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyValueEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyValueEditorCommands.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyValueExceptionEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyValueExceptionSource.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/PropertyValueSource.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/categoryentry.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/newitemfactory.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/newitemtypesattribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/propertyentry.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PropertyEditing/propertyentrycollection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/PublishServiceCallback.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/ServiceManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/SubscribeContextCallback.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/SubscribeServiceCallback.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Documents/ViewManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Documents/ViewManagerAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Model/CreateOptions.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Model/EnumValidator.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Model/ModelEditingScope.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Model/ModelFactory.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Model/ModelItem.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Model/ModelItemCollection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Model/ModelItemDictionary.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Model/ModelMemberCollection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Model/ModelProperty.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Model/ModelPropertyCollection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Services/ModelChangeInfo.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Services/ModelChangeInfoImpl.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Services/ModelChangeType.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Services/ModelChangedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Interaction/Services/ViewService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Shared/Internal/EqualityArray.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/BookmarkUndoUnit.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/CachedResourceDictionaryExtension.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ClipboardData.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ContextMenuUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/ActivityActionSearchableStringConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/ArgumentSearchableStringConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/ArgumentToExpressionConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/ArgumentToExpressionModelItemConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/EmptySearchableStringConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/EncodingSearchableStringConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/ModelItemToAnnotationEnabledConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/ModelPropertyEntryToModelItemConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/ModelPropertyEntryToOwnerActivityConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/ModelToObjectValueConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/ObjectToModelValueConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/OutlineViewTextConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/SearchableStringConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/SearchableStringConverterAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/TypeSearchableStringConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/VBIdentifierTrimConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/VisualBasicValueSearchableStringConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Converters/XNameSearchableStringConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/CutCopyPasteHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Debugger/AllowBreakpointAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Debugger/BreakpointType.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Debugger/DebuggerService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Debugger/IDesignerDebugView.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DefaultCommandExtensionCallback.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DefaultTypeArgumentAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DeleteHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DesignObjectWrapper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DesignTimeValidationFeature.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DesignerConfigurationService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DesignerConfigurationServiceUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DesignerMetadata.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DesignerPerfEventProvider.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DesignerPerfEvents.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DialogWindow.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DictionaryItemsCollection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DockedAnnotationDecorator.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DragDropHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DropAnimation.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/DynamicActivityPropertyUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/EditingContextUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/EditingScopeUndoUnit.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/EditorOptionAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ErrorActivity.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ErrorItem.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ErrorReporting.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ExpandButtonVisibilityConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ExpandCollapseIsCheckedConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ExpressionHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ExpressionSelection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Expressions/CreateExpressionFromString.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Expressions/ExpressionActivityEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Expressions/ExpressionMorphHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Expressions/ExpressionMorphHelperAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Expressions/TextualExpressionEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Feature.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FeatureAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FeatureManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/AutoConnectAdorner.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/AutoConnectDirections.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/AutoConnectHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/AutoSplitAdorner.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/AutoSplitAlignment.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/AutoSplitHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectionPoint.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectionPointConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectionPointKind.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectionPointsAdorner.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/Connector.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorCreationAdorner.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorIdentityConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorLabelMarginConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorLabelVisibilityConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorMovedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorMovedEventHandler.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorPointsToArrowMarginConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorPointsToArrowTransformConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorPointsToSegmentsConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorRouter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorStartDotConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorWithStartDot.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/ConnectorWithoutStartDot.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/DesignerGeometryHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/DoubleExtensions.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/FreeFormPanel.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/IAutoConnectContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/IAutoSplitContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/INestedFreeFormPanelContainer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/LocationChangedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/LocationChangedEventHandler.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/PointExtensions.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/RequiredSizeChangedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/FreeFormEditing/RequiredSizeChangedEventHandler.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/GenericTypeParameterConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/HelpKeywords.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Hosting/ICommandService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Hosting/IDocumentPersistenceService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Hosting/IMultiTargetingSupportService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Hosting/IWorkflowCommandExtensionCallback.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Hosting/MultiTargetingSupportService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Hosting/WindowHelperService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Hosting/WorkflowCommandExtensionItem.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/IActivityDelegateFactory.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/IActivityToolboxService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ICompositeView.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ICompositeViewEvents.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/IExpandChild.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/IIntegratedHelpService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/IModalService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/IMultipleDragEnabledCompositeView.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/IUndoEngineOperations.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/IWorkflowDesignerStorageService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/IXamlLoadErrorService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Metadata/ActivityArgumentHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Metadata/ActivityDelegateArgumentDirection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Metadata/ActivityDelegateArgumentMetadata.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Metadata/ActivityDelegateMetadata.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/MiniMap/MiniMapControl.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/AttachablePropertyChange.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/AttachedPropertiesService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/AttachedProperty.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/AttachedPropertyDescriptor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/AttachedPropertyInfo.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/BackPointer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/Change.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/CollectionChange.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/DictionaryChange.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/DictionaryEditChange.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/Edge.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/EditingScope.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/EditingScopeEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/FakeModelItemImpl.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/FakeModelPropertyImpl.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/GenericArgumentsUpdater.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/GraphManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/IItemsCollection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/IModelTreeItem.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ImmediateEditingScope.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/LinkBase.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/LinkType.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelChange.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelChangedEventArgsImpl.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelItemCollectionImpl.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelItemDictionaryImpl.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelItemExtensions.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelItemHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelItemImpl.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelItemsAddedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelItemsRemovedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelPropertyCollectionImpl.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelPropertyDescriptor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelPropertyImpl.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelSearchService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelSearchServiceImpl.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelServiceImpl.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelTreeItemHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelTreeManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelTypeConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelTypeDescriptorContextWrapper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/ModelUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/MorphHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/PropertyChange.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/PropertyReferenceChange.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/PropertyReferenceChangedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/SearchableEntry.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/SearchableEntryOption.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/TextImage.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/WeakKeyDictionary.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/WeakKeyDictionary.cs.back delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Model/XamlUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ModelItemKeyValuePair.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/NamespaceHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/NamespaceHelper.cs.back delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/NamespaceListProperty.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/NamespaceListProperty.cs.back delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/NamespaceSettingsHandler.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/NonTextualExpressionMorphHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/NotConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/NullToBooleanConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ObjectReferenceService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/PropertyEditing/VersionPropertyValueEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/PropertyReferenceUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ReadOnlyState.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/RetriableClipboard.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/SQM/ActivityUsageCounter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/SQM/DataPointIds.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/SQM/FeatureUsageCounter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/SQM/IVSSqmService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ShowExpandedMultiValueConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/SourceLocationUpdatedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/TargetFrameworkPropertyFilter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/TaskDispatcher.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/TextFormattingConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/ActivityTemplateFactory.Generic.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/ActivityTemplateFactory.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/ActivityTemplateFactoryBuilder.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/ActivityTemplateFactoryExtension.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/IActivityTemplateFactory.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/ToolCreatedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/ToolCreatedEventHandler.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/ToolboxCategory.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/ToolboxCategoryItems.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/ToolboxControl.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/ToolboxItemImageConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/ToolboxItemLoader.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/ToolboxItemWrapper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/TreeViewContainerStyleSelector.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Toolbox/TreeViewTemplateSelector.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/TypeNameConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/TypeResolvingOptionsAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/TypeUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/UndoEngine.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/UndoUnit.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/UndoUnitEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/UpdatableGenericsFeature.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Utility/IconHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Validation/BackgroundValidationSynchronizer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Validation/ForegroundValidationSynchronizer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Validation/IValidationErrorService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Validation/IValidationErrorSourceLocator.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Validation/ValidationErrorInfo.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Validation/ValidationReason.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Validation/ValidationRoot.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Validation/ValidationService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Validation/ValidationState.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Validation/ValidationSynchronizer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ValidationErrorSourceLocatorFeature.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/VariableExpressionConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/VerticalConnector.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ActivityTypeDesigner.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ActivityTypeResolver.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/AnnotationDialog.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ArgumentDesigner.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/AssemblyContextControlItem.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/AutoScrollHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/BreadCrumbTextConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/CanExpandCollapseAllConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/DataGridHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/DesignerView.Commands.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/DesignerView.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/DesignerWithHeader.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/EditorResources.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ErrorView.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ExpressionTextBox.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ExpressionTextBoxAutomationPeer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ExpressionValueEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ExtensionSurface.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ExtensionWindow.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ExtensionWindowClosingRoutedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ExtensionWindowHeader.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ExtensionWindowResizeGrip.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/FilterableData.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/GenericActivityTypeDesigner.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/HandleValueEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/IExpressionEditorInstance.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/IExpressionEditorService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/IVersionEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ImportDesigner.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ImportedNamespaceContextItem.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ModelPropertyPathExpanderConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/NamespaceDisplay.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/NamespaceDisplayAutomationPeer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/NoContextMenuGrid.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/OutlineView/HidePropertyInOutlineViewAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/OutlineView/ShowInOutlineViewAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/OutlineView/ShowPropertyInOutlineViewAsSiblingAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/OutlineView/ShowPropertyInOutlineViewAttribute.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ParserContext.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/PropertyEntryToEditingContextConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/PropertyEntryToEditorOptionConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/QuadTree.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/RubberBandSelector.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ScrollViewerPanner.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/SearchToolTipAdorner.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/Selection.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/SpacerPlaceholder.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TreeView/ChangeNotificationTracker.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TreeView/DesignerTreeAutoExpandHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TreeView/DesignerTreeView.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TreeView/DesignerTreeViewItem.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TreeView/ITreeViewItemSelectionHandler.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TreeView/TreeViewItemKeyValuePairModelItemViewModel.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TreeView/TreeViewItemModelItemViewModel.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TreeView/TreeViewItemModelPropertyViewModel.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TreeView/TreeViewItemViewModel.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TreeView/UniqueModelItemHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TypeBrowser.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TypeKeyValue.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TypePresenter.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TypePropertyEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TypeResolvingOptions.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TypeToArgumentTypeConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/TypeToStringValueConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/VBIdentifierDesigner.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/VBIdentifierName.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/VBIdentifierNameEditor.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/VariableDesigner.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/VersionEditor.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/VersionEditorViewModel.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ViewCreatedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ViewStateChangedEventArgs.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ViewStateChangedEventHandler.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ViewStateService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/ViewUtilities.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/VirtualizedContainerService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/VisualBasicEditor.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/VisualBasicEditorAutomationPeer.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/VisualBasicReferenceValidationFeature.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/VisualBasicValueValidationFeature.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/WindowExtensionMethods.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/WorkflowViewManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/WorkflowViewService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/WorkflowViewStateService.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ViewModel.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ViewState/ViewStateData.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ViewState/ViewStateManager.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ViewState/WorkflowViewState.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ViewStateAttachedPropertyFeature.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/VisualBasicExpressionMorphHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/WorkflowDesigner.Debugger.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/WorkflowDesigner.Helpers.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/WorkflowDesigner.SerializationHelpers.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/WorkflowDesigner.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/WorkflowDesignerColors.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/WorkflowDesignerIcons.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/WorkflowElementDialog.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/WorkflowElementDialogWindow.xaml.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/WorkflowFileItem.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/WorkflowItemPresenter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/WorkflowItemsPresenter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/WorkflowViewElement.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/XNameConverter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Xaml/ActivityBuilderHelper.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Xaml/ErrorTolerantObjectWriter.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Xaml/MultiTargetingXamlSchemaContext.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Xaml/ObjectToSourceLocationMapping.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Xaml/ShimAsPublicXamlType.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Xaml/SourceLocationExtensions.cs delete mode 100644 mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/XamlLoadErrorInfo.cs diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/ExpressionSettingHelper.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/ExpressionSettingHelper.cs deleted file mode 100644 index ff2a8ea1260..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/ExpressionSettingHelper.cs +++ /dev/null @@ -1,58 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace Microsoft.Activities.Presentation -{ - using System.Activities.Expressions; -using System.Activities.Presentation.Expressions; -using System.Activities.Presentation.Model; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Runtime.Versioning; -using Microsoft.VisualBasic.Activities; - - internal static class ExpressionSettingHelper - { - internal static readonly string VBExpressionLanguageName = (new VisualBasicValue() as ITextExpression).Language; - - [SuppressMessage("Reliability", "Reliability101", Justification = "We can't use Fx.Assert here since this is not a framework assembly.")] - internal static string GetRootEditorSetting(ModelTreeManager modelTreeManager, FrameworkName targetFramework) - { - Debug.Assert(modelTreeManager != null, "modelTreeManager is null."); - Debug.Assert(targetFramework != null, "targetFramework is null."); - - string globalEditorSetting = null; - if (Is45OrHigher(targetFramework)) - { - if (modelTreeManager != null) - { - ModelItem rootItem = modelTreeManager.Root; - if (rootItem != null) - { - object root = rootItem.GetCurrentValue(); - globalEditorSetting = ExpressionActivityEditor.GetExpressionActivityEditor(root); - if (string.IsNullOrEmpty(globalEditorSetting)) - { - globalEditorSetting = VBExpressionLanguageName; - } - } - } - } - else - { - // When the target framework is less than 4.5, the root setting is ignored and always return VB - globalEditorSetting = VBExpressionLanguageName; - } - - return globalEditorSetting; - } - - private static bool Is45OrHigher(FrameworkName frameworkName) - { - return frameworkName.Version.Major > 4 || (frameworkName.Version.Major == 4 && frameworkName.Version.Minor >= 5); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/FrameworkNameConstants.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/FrameworkNameConstants.cs deleted file mode 100644 index 78218eac964..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/FrameworkNameConstants.cs +++ /dev/null @@ -1,21 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace Microsoft.Activities.Presentation -{ - using System; - using System.Runtime.Versioning; - - internal static class FrameworkNameConstants - { - public static readonly FrameworkName NetFramework40 = new FrameworkName(NetFramework, new Version(4, 0)); - public static readonly FrameworkName NetFramework45 = new FrameworkName(NetFramework, new Version(4, 5)); - - internal const string NetFramework = ".NETFramework"; - internal const string NetFrameworkWithSpace = ".NET Framework"; - internal const string ClientProfileName = "Client"; - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/FrameworkNameExtensions.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/FrameworkNameExtensions.cs deleted file mode 100644 index d3137dba3a6..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/FrameworkNameExtensions.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation -{ - using System.Runtime.Versioning; - - internal static class FrameworkNameExtensions - { - public static bool Is45OrHigher(this FrameworkName frameworkName) - { - return frameworkName.Version.Major > 4 || (frameworkName.Version.Major == 4 && frameworkName.Version.Minor >= 5); - } - - public static bool IsLessThan45(this FrameworkName frameworkName) - { - return frameworkName.Version.Major < 4 || (frameworkName.Version.Major == 4 && frameworkName.Version.Minor < 5); - } - - public static bool IsLessThan40(this FrameworkName frameworkName) - { - return frameworkName.Version.Major < 4; - } - - public static bool IsProfileSupported(this FrameworkName frameworkName) - { - if (frameworkName.Profile == string.Empty) - { - return true; - } - - if (frameworkName.Profile == FrameworkNameConstants.ClientProfileName) - { - return true; - } - - return false; - } - - public static bool IsFullProfile(this FrameworkName frameworkName) - { - return string.IsNullOrEmpty(frameworkName.Profile); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/TypeNameHelper.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/TypeNameHelper.cs deleted file mode 100644 index 231a93fb8ac..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/TypeNameHelper.cs +++ /dev/null @@ -1,106 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace Microsoft.Activities.Presentation -{ - using System; - using System.Globalization; - using System.Text; - using System.Text.RegularExpressions; - - internal static class TypeNameHelper - { - // note: does not work for nested type when fullName is true - // eg. Namespace.DeclaringType.NestedType will be displayed - // as Namespace.DeclaringType+NestedType - public static string GetDisplayName(Type type, bool fullName) - { - if (type == null) - { - return string.Empty; - } - - if (type.IsGenericParameter) - { - return type.Name; - } - - if (!type.IsGenericType && !type.IsArray) - { - if (fullName) - { - return type.FullName; - } - else - { - return type.Name; - } - } - - // replace `2 with - Regex regex = new Regex("`[0-9]+"); - GenericsMatchEvaluator evaluator = new GenericsMatchEvaluator(type.GetGenericArguments(), fullName); - - // Remove [[fullName1, ..., fullNameX]] - string name; - if (fullName) - { - name = type.FullName; - } - else - { - name = type.Name; - } - - int start = name.IndexOf("[[", StringComparison.Ordinal); - int end = name.LastIndexOf("]]", StringComparison.Ordinal); - if (start > 0 && end > 0) - { - name = name.Substring(0, start) + name.Substring(end + 2); - } - - return regex.Replace(name, evaluator.Evaluate); - } - - private class GenericsMatchEvaluator - { - private Type[] generics = null; - private int index; - private bool fullName; - - public GenericsMatchEvaluator(Type[] generics, bool fullName) - { - this.generics = generics; - this.index = 0; - this.fullName = fullName; - } - - public string Evaluate(Match match) - { - int numberOfParameters = int.Parse(match.Value.Substring(1), CultureInfo.InvariantCulture); - - StringBuilder sb = new StringBuilder(); - - // matched "`N" is replaced by "" - sb.Append("<"); - - for (int i = 0; i < numberOfParameters; i++) - { - if (i > 0) - { - sb.Append(", "); - } - - sb.Append(TypeNameHelper.GetDisplayName(this.generics[this.index++], this.fullName)); - } - - sb.Append(">"); - - return sb.ToString(); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ActivityBuilderExtensions.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ActivityBuilderExtensions.cs deleted file mode 100644 index 4b49258e198..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ActivityBuilderExtensions.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Activities; - using Microsoft.VisualBasic.Activities; - - internal static class ActivityBuilderExtensions - { - internal static DynamicActivity ConvertToDynamicActivity(this ActivityBuilder activityBuilder) - { - DynamicActivity result = new DynamicActivity(); - ActivityBuilderExtensions.ConvertActivityBuilderToDynamicActivity(activityBuilder, result); - return result; - } - - internal static void ConvertActivityBuilderToDynamicActivity(ActivityBuilder activityBuilder, DynamicActivity bodyPlaceholder) - { - bodyPlaceholder.Name = activityBuilder.Name; - bodyPlaceholder.Implementation = () => activityBuilder.Implementation; - - if (activityBuilder.Implementation != null) - { - VisualBasic.SetSettings(bodyPlaceholder, VisualBasic.GetSettings(activityBuilder)); - } - - bodyPlaceholder.Attributes.Clear(); - foreach (Attribute attribute in activityBuilder.Attributes) - { - bodyPlaceholder.Attributes.Add(attribute); - } - - bodyPlaceholder.Properties.Clear(); - foreach (DynamicActivityProperty property in activityBuilder.Properties) - { - bodyPlaceholder.Properties.Add(property); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ActivityTemplateFactoryBuilderReader.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ActivityTemplateFactoryBuilderReader.cs deleted file mode 100644 index dba5836ef8d..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ActivityTemplateFactoryBuilderReader.cs +++ /dev/null @@ -1,284 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Activities.Presentation.Toolbox; - using System.Xaml; - - // ActivityTemplateFactoryBuilderReader is a XamlReader that support )); - } - - private bool IsActivityTemplateFactoryImplementationMember(XamlMember xamlMember) - { - return IsActivityTemplateFactoryType(xamlMember.DeclaringType) && xamlMember == ActivityTemplateFactoryBuilderXamlMembers.ActivityTemplateFactoryImplementationMemberForReader(xamlMember.DeclaringType.UnderlyingType, this.schemaContext); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ActivityTemplateFactoryBuilderWriter.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ActivityTemplateFactoryBuilderWriter.cs deleted file mode 100644 index 7c104241790..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ActivityTemplateFactoryBuilderWriter.cs +++ /dev/null @@ -1,331 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Activities.Presentation.Toolbox; - using System.Xaml; - - // ActivityTemplateFactoryBuilderWriter is a XamlWriter that support -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Activities.Presentation.Toolbox; - using System.Reflection; - using System.Xaml; - - internal static class ActivityTemplateFactoryBuilderXamlMembers - { - private const string ImplementationPropertyName = "Implementation"; - private const string NamePropertyName = "Name"; - private const string TargetTypePropertyName = "TargetType"; - - internal static XamlMember ActivityTemplateFactoryImplementationMemberForReader(Type activityTemplateFactoryType, XamlSchemaContext schemaContext) - { - return new XamlMember(ImplementationPropertyName, new XamlType(activityTemplateFactoryType, schemaContext), false); - } - - internal static XamlMember ActivityTemplateFactoryImplementationMemberForWriter(XamlSchemaContext schemaContext) - { - PropertyInfo implementationPropertyInfo = typeof(ActivityTemplateFactory).GetProperty(ImplementationPropertyName, BindingFlags.Instance | BindingFlags.NonPublic); - SharedFx.Assert(implementationPropertyInfo != null, "ActivityTemplateFactory.Implementation should be defined as a protected property of ActivityTemplateFactory."); - return new XamlMember(implementationPropertyInfo, schemaContext); - } - - internal static XamlMember ActivityTemplateFactoryBuilderNameMember(XamlSchemaContext schemaContext) - { - PropertyInfo namePropertyInfo = typeof(ActivityTemplateFactoryBuilder).GetProperty(NamePropertyName); - SharedFx.Assert(namePropertyInfo != null, "ActivityTemplateFactoryBuilder.Name should be defined as a public property of ActivityTemplateFactoryBuilder."); - return new XamlMember(namePropertyInfo, schemaContext); - } - - internal static XamlMember ActivityTemplateFactoryBuilderTargetTypeMember(XamlSchemaContext schemaContext) - { - PropertyInfo namePropertyInfo = typeof(ActivityTemplateFactoryBuilder).GetProperty(TargetTypePropertyName); - SharedFx.Assert(namePropertyInfo != null, "ActivityTemplateFactoryBuilder.TargetType should be defined as a public property of ActivityTemplateFactoryBuilder."); - return new XamlMember(namePropertyInfo, schemaContext); - } - - internal static XamlMember ActivityTemplateFactoryBuilderImplementationMember(XamlSchemaContext schemaContext) - { - PropertyInfo implementationPropertyInfo = typeof(ActivityTemplateFactoryBuilder).GetProperty(ImplementationPropertyName); - SharedFx.Assert(implementationPropertyInfo != null, "ActivityTemplateFactoryBuilder.Implementation should be defined as a public property of ActivityTemplateFactoryBuilder."); - return new XamlMember(implementationPropertyInfo, schemaContext); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/AttributeConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/AttributeConverter.cs deleted file mode 100644 index 29625d5068c..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/AttributeConverter.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Collections; - using System.ComponentModel; - using System.ComponentModel.Design.Serialization; - using System.Globalization; - using System.Reflection; - - // AttributeConverter is to convert some XAML-unfriendly attributes (without default ctor) to InstanceDescriptor for XAML serialization - internal class AttributeConverter : TypeConverter - where TAttribute : Attribute - where TAttributeInfo : AttributeInfo, new() - { - private static ConstructorInfo attributeConstructor = null; - private TAttributeInfo attributeInfo = new TAttributeInfo(); - - private ConstructorInfo Constructor - { - get - { - // no need to lock here because every thread will generate the same constructor info even in race condition - // and cost to get the constructor is relative small - if (AttributeConverter.attributeConstructor == null) - { - AttributeConverter.attributeConstructor = this.attributeInfo.GetConstructor(); - } - - return AttributeConverter.attributeConstructor; - } - } - - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - if (destinationType == typeof(InstanceDescriptor)) - { - return true; - } - - return base.CanConvertTo(context, destinationType); - } - - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) - { - return false; - } - - public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) - { - if (destinationType != typeof(InstanceDescriptor)) - { - return base.ConvertTo(context, culture, value, destinationType); - } - - TAttribute attribute = value as TAttribute; - - SharedFx.Assert(value != null, "The usage should be guaranteed by the XAML stack"); - - ConstructorInfo constructor = this.Constructor; - ICollection arguments = this.attributeInfo.GetConstructorArguments(attribute, ref constructor); - return new InstanceDescriptor(constructor, arguments, this.attributeInfo.IsComplete); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/AttributeInfo.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/AttributeInfo.cs deleted file mode 100644 index a6b46b40b4f..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/AttributeInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Collections; - using System.Reflection; - using System.Xaml.Schema; - - // AttributeInfo is a helper class to provide type specfic info for each Attribute class - internal abstract class AttributeInfo where TAttribute : Attribute - { - // false if the attribute has additional (mutable) properties that aren't set in the constructor - public virtual bool IsComplete - { - get { return true; } - } - - // whether to use argumented-ctor for serialization even when there's default ctor - public virtual bool LookupConstructionRequiresArguments - { - get { return true; } - } - - public virtual XamlTypeInvoker Invoker - { - get { return null; } - } - - public abstract ConstructorInfo GetConstructor(); - - public abstract ICollection GetConstructorArguments(TAttribute attribute, ref ConstructorInfo constructor); - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/AttributeXamlType.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/AttributeXamlType.cs deleted file mode 100644 index f0bb5c9d542..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/AttributeXamlType.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.ComponentModel; - using System.Xaml; - using System.Xaml.Schema; - - internal class AttributeXamlType : XamlType - where TAttribute : Attribute - where TAttributeInfo : AttributeInfo, new() - { - private TAttributeInfo attributeInfo = new TAttributeInfo(); - - public AttributeXamlType(XamlSchemaContext xamlSchemaContext) - : base(typeof(TAttribute), xamlSchemaContext) - { - } - - protected override XamlValueConverter LookupTypeConverter() - { - return new XamlValueConverter(typeof(AttributeConverter), this); - } - - protected override bool LookupConstructionRequiresArguments() - { - return this.attributeInfo.LookupConstructionRequiresArguments; - } - - protected override XamlTypeInvoker LookupInvoker() - { - if (this.attributeInfo.Invoker != null) - { - return this.attributeInfo.Invoker; - } - else - { - return base.LookupInvoker(); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/DefaultValueAttributeInfo.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/DefaultValueAttributeInfo.cs deleted file mode 100644 index b1c3d3c043f..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/DefaultValueAttributeInfo.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.ComponentModel; - using System.Reflection; - using System.Xaml.Schema; - - internal class DefaultValueAttributeInfo : AttributeInfo - { - public override XamlTypeInvoker Invoker - { - get { return new DefaultValueAttributeInvoker(); } - } - - public override ICollection GetConstructorArguments(DefaultValueAttribute attribute, ref ConstructorInfo constructor) - { - return new List() { attribute.Value }; - } - - public override ConstructorInfo GetConstructor() - { - Type defaultValueAttributeType = typeof(DefaultValueAttribute); - ConstructorInfo constructor = defaultValueAttributeType.GetConstructor(new Type[] { typeof(object) }); - SharedFx.Assert(constructor != null, "designerAttribute has a constructor that takes an argument of type System.Object."); - return constructor; - } - - private class DefaultValueAttributeInvoker : XamlTypeInvoker - { - public override object CreateInstance(object[] arguments) - { - if (arguments != null && arguments.Length == 1) - { - // This helps to disambiguate the different constructors when arguments[0] is null. - return new DefaultValueAttribute(arguments[0]); - } - else - { - return base.CreateInstance(arguments); - } - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/DesignTimeXamlWriter.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/DesignTimeXamlWriter.cs deleted file mode 100644 index 2229b2450fa..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/DesignTimeXamlWriter.cs +++ /dev/null @@ -1,314 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Activities; - using System.Activities.Debugger.Symbol; - using System.Collections.Generic; - using System.Globalization; - using System.IO; - using System.ServiceModel.Activities; - using System.Xaml; - using System.Xml; - - class DesignTimeXamlWriter : XamlXmlWriter - { - //namespaces to ignore (don't load assembilies for) at root node - HashSet namespacesToIgnore; - - //namespaces we've seen at root level, we use this to figure out appropriate alias for MC namespace - HashSet rootLevelNamespaces; - - // for duplicate namespace filtering (happens if we're using the local assembly to compile itself) - HashSet emittedNamespacesInLocalAssembly; - - //For namespace defined in local assembly with assembly info in namespace declaration, we'll strip out the assembly info - //and hold the namespace temporarily. Before writing the start object, we'll check whether the short version gets written - //as a separate declaration, if not, we write it out. - List localNamespacesWithAssemblyInfo; - - WorkflowDesignerXamlSchemaContext schemaContext; - - int currentDepth; - int debugSymbolDepth; - bool writeDebugSymbol; - bool debugSymbolNamespaceAdded; - bool isWritingElementStyleString; - internal static readonly string EmptyWorkflowSymbol = (new WorkflowSymbol() { FileName = @"C:\Empty.xaml" }).Encode(); - private bool shouldWriteDebugSymbol; - - public DesignTimeXamlWriter(TextWriter textWriter, WorkflowDesignerXamlSchemaContext context, bool shouldWriteDebugSymbol) - : this(new NamespaceIndentingXmlWriter(textWriter), context, shouldWriteDebugSymbol) - { - } - - DesignTimeXamlWriter(NamespaceIndentingXmlWriter underlyingWriter, WorkflowDesignerXamlSchemaContext context, bool shouldWriteDebugSymbol) - : base(underlyingWriter, context, - // Setting AssumeValidInput to true allows to save a document even if it has duplicate members - new XamlXmlWriterSettings { AssumeValidInput = true }) - { - underlyingWriter.Parent = this; - this.namespacesToIgnore = new HashSet(); - this.rootLevelNamespaces = new HashSet(); - this.schemaContext = context; - this.currentDepth = 0; - this.shouldWriteDebugSymbol = shouldWriteDebugSymbol; - } - - public override void WriteNamespace(NamespaceDeclaration namespaceDeclaration) - { - if (this.currentDepth == 0) - { - //we need to track every namespace alias appeared in root element to figure out right alias for MC namespace - this.rootLevelNamespaces.Add(namespaceDeclaration.Prefix); - - //Remember namespaces needed to be ignored at top level so we will add ignore attribute for them when we write start object - if (NameSpaces.ShouldIgnore(namespaceDeclaration.Namespace)) - { - this.namespacesToIgnore.Add(namespaceDeclaration.Prefix); - } - - if (namespaceDeclaration.Namespace == NameSpaces.DebugSymbol) - { - debugSymbolNamespaceAdded = true; - } - } - - EmitNamespace(namespaceDeclaration); - } - - void EmitNamespace(NamespaceDeclaration namespaceDeclaration) - { - // Write the namespace, filtering for duplicates in the local assembly because VS might be using it to compile itself. - - if (schemaContext.IsClrNamespaceWithNoAssembly(namespaceDeclaration.Namespace)) - { - // Might still need to trim a semicolon, even though it shouldn't strictly be there. - string nonassemblyQualifedNamespace = namespaceDeclaration.Namespace; - if (nonassemblyQualifedNamespace[nonassemblyQualifedNamespace.Length - 1] == ';') - { - nonassemblyQualifedNamespace = nonassemblyQualifedNamespace.Substring(0, nonassemblyQualifedNamespace.Length - 1); - namespaceDeclaration = new NamespaceDeclaration(nonassemblyQualifedNamespace, namespaceDeclaration.Prefix); - } - EmitLocalNamespace(namespaceDeclaration); - } - else if (schemaContext.IsClrNamespaceInLocalAssembly(namespaceDeclaration.Namespace)) - { - string nonassemblyQualifedNamespace = schemaContext.TrimLocalAssembly(namespaceDeclaration.Namespace); - namespaceDeclaration = new NamespaceDeclaration(nonassemblyQualifedNamespace, namespaceDeclaration.Prefix); - if (this.localNamespacesWithAssemblyInfo == null) - { - this.localNamespacesWithAssemblyInfo = new List(); - } - this.localNamespacesWithAssemblyInfo.Add(namespaceDeclaration); - } - else - { - base.WriteNamespace(namespaceDeclaration); - } - } - - void EmitLocalNamespace(NamespaceDeclaration namespaceDeclaration) - { - if (this.emittedNamespacesInLocalAssembly == null) // lazy initialization - { - this.emittedNamespacesInLocalAssembly = new HashSet(); - } - - // Write the namespace only once. Add() returns false if it was already there. - if (this.emittedNamespacesInLocalAssembly.Add(namespaceDeclaration.Namespace)) - { - base.WriteNamespace(namespaceDeclaration); - } - } - - public override void WriteStartObject(XamlType type) - { - if (type.UnderlyingType == typeof(string)) - { - isWritingElementStyleString = true; - } - // this is the top-level object - if (this.currentDepth == 0) - { - if (!this.debugSymbolNamespaceAdded) - { - string sadsNamespaceAlias = GenerateNamespaceAlias(NameSpaces.DebugSymbolPrefix); - this.WriteNamespace(new NamespaceDeclaration(NameSpaces.DebugSymbol, sadsNamespaceAlias)); - this.debugSymbolNamespaceAdded = true; - } - - // we need to write MC namespace if any namespaces need to be ignored - if (this.namespacesToIgnore.Count > 0) - { - string mcNamespaceAlias = GenerateNamespaceAlias(NameSpaces.McPrefix); - this.WriteNamespace(new NamespaceDeclaration(NameSpaces.Mc, mcNamespaceAlias)); - } - - - if (this.localNamespacesWithAssemblyInfo != null) - { - foreach (NamespaceDeclaration xamlNamespace in this.localNamespacesWithAssemblyInfo) - { - if ((this.emittedNamespacesInLocalAssembly == null) || (!this.emittedNamespacesInLocalAssembly.Contains(xamlNamespace.Namespace))) - { - base.WriteNamespace(xamlNamespace); - } - } - } - - if ((type.UnderlyingType == typeof(Activity)) || - (type.IsGeneric && type.UnderlyingType != null && type.UnderlyingType.GetGenericTypeDefinition() == typeof(Activity<>)) || - (type.UnderlyingType == typeof(WorkflowService))) - { // Exist ActivityBuilder, DebugSymbolObject will be inserted at the depth == 1. - debugSymbolDepth = 1; - } - else - { - debugSymbolDepth = 0; - } - } - - if (this.currentDepth == debugSymbolDepth) - { - if (type.UnderlyingType != null && type.UnderlyingType.IsSubclassOf(typeof(Activity)) && this.shouldWriteDebugSymbol) - { - this.writeDebugSymbol = true; - } - } - - base.WriteStartObject(type); - - if (this.currentDepth == 0) - { - // we need to add Ignore attribute for all namespaces which we don't want to load assemblies for - // this has to be done after WriteStartObject - if (this.namespacesToIgnore.Count > 0) - { - string nsString = null; - foreach (string ns in this.namespacesToIgnore) - { - if (nsString == null) - { - nsString = ns; - } - else - { - nsString += " " + ns; - } - } - - XamlDirective ignorable = new XamlDirective(NameSpaces.Mc, "Ignorable"); - base.WriteStartMember(ignorable); - base.WriteValue(nsString); - base.WriteEndMember(); - this.namespacesToIgnore.Clear(); - } - } - - ++this.currentDepth; - - } - - public override void WriteGetObject() - { - ++this.currentDepth; - base.WriteGetObject(); - } - - public override void WriteEndObject() - { - --this.currentDepth; - SharedFx.Assert(this.currentDepth >= 0, "Unmatched WriteEndObject"); - if (this.currentDepth == this.debugSymbolDepth && this.writeDebugSymbol) - { - base.WriteStartMember(new XamlMember(DebugSymbol.SymbolName.MemberName, - this.SchemaContext.GetXamlType(typeof(DebugSymbol)), true)); - base.WriteValue(EmptyWorkflowSymbol); - base.WriteEndMember(); - this.writeDebugSymbol = false; - } - base.WriteEndObject(); - isWritingElementStyleString = false; - } - - string GenerateNamespaceAlias(string prefix) - { - string aliasPostfix = string.Empty; - //try "mc"~"mc1000" first - for (int i = 1; i <= 1000; i++) - { - string mcAlias = prefix + aliasPostfix; - if (!this.rootLevelNamespaces.Contains(mcAlias)) - { - return mcAlias; - } - aliasPostfix = i.ToString(CultureInfo.InvariantCulture); - } - - //roll the dice - return prefix + Guid.NewGuid().ToString(); - } - - class NamespaceIndentingXmlWriter : XmlTextWriter - { - int currentDepth; - TextWriter textWriter; - - public NamespaceIndentingXmlWriter(TextWriter textWriter) - : base(textWriter) - { - this.textWriter = textWriter; - this.Formatting = Formatting.Indented; - } - - public DesignTimeXamlWriter Parent { get; set; } - - public override void WriteStartElement(string prefix, string localName, string ns) - { - base.WriteStartElement(prefix, localName, ns); - this.currentDepth++; - } - - public override void WriteStartAttribute(string prefix, string localName, string ns) - { - if (prefix == "xmlns" && (this.currentDepth == 1)) - { - this.textWriter.Write(new char[] { '\r', '\n' }); - } - base.WriteStartAttribute(prefix, localName, ns); - } - - public override void WriteEndElement() - { - if (this.Parent.isWritingElementStyleString) - { - base.WriteRaw(string.Empty); - } - base.WriteEndElement(); - this.currentDepth--; - } - - public override void WriteStartDocument() - { - // No-op to avoid XmlDeclaration from being written. - // Overriding this is equivalent of XmlWriterSettings.OmitXmlDeclaration = true. - } - - public override void WriteStartDocument(bool standalone) - { - // No-op to avoid XmlDeclaration from being written. - // Overriding this is equivalent of XmlWriterSettings.OmitXmlDeclaration = true. - } - - public override void WriteEndDocument() - { - // No-op to avoid end of XmlDeclaration from being written. - // Overriding this is equivalent of XmlWriterSettings.OmitXmlDeclaration = true. - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/DesignerAttributeInfo.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/DesignerAttributeInfo.cs deleted file mode 100644 index 57580e0bf3b..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/DesignerAttributeInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.ComponentModel; - using System.Reflection; - - class DesignerAttributeInfo : AttributeInfo - { - public override ICollection GetConstructorArguments(DesignerAttribute attribute, ref ConstructorInfo constructor) - { - return new List() { Type.GetType(attribute.DesignerTypeName) }; - } - - public override ConstructorInfo GetConstructor() - { - Type designerAttributeType = typeof(DesignerAttribute); - ConstructorInfo constructor = designerAttributeType.GetConstructor(new Type[] { typeof(Type) }); - SharedFx.Assert(constructor != null, "designerAttribute has a constructor that takes an argument of type System.Type."); - return constructor; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/EditorAttributeInfo.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/EditorAttributeInfo.cs deleted file mode 100644 index b5a9922268c..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/EditorAttributeInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.ComponentModel; - using System.Reflection; - - class EditorAttributeInfo : AttributeInfo - { - public override ICollection GetConstructorArguments(EditorAttribute attribute, ref ConstructorInfo constructor) - { - return new List() { Type.GetType(attribute.EditorTypeName), Type.GetType(attribute.EditorBaseTypeName) }; - } - - public override ConstructorInfo GetConstructor() - { - Type editorAttributeType = typeof(EditorAttribute); - ConstructorInfo constructor = editorAttributeType.GetConstructor(new Type[] { typeof(Type), typeof(Type) }); - SharedFx.Assert(constructor != null, "designerAttribute has a constructor that takes two argument of type System.Type and System.Type."); - return constructor; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/IWorkflowDesignerXamlHelperExecutionContext.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/IWorkflowDesignerXamlHelperExecutionContext.cs deleted file mode 100644 index 70ade3a1fa9..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/IWorkflowDesignerXamlHelperExecutionContext.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System.Activities.Debugger; - using System.Activities.Debugger.Symbol; - using System.Collections.Generic; - using System.Runtime.Versioning; - - internal interface IWorkflowDesignerXamlHelperExecutionContext - { - FrameworkName FrameworkName { get; } - - WorkflowDesignerXamlSchemaContext XamlSchemaContext { get; } - - ViewStateIdManager IdManager { get; } - - WorkflowSymbol LastWorkflowSymbol { get; set; } - - string LocalAssemblyName { get; } - - void OnSerializationCompleted(Dictionary sourceLocationObjectToModelItemObjectMapping); - - void OnBeforeDeserialize(); - - void OnSourceLocationFound(object target, SourceLocation sourceLocation); - - void OnAfterDeserialize(Dictionary viewStateDataSourceLocationMapping); - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ImportAttributeInfo.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ImportAttributeInfo.cs deleted file mode 100644 index 96fd0739bbd..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ImportAttributeInfo.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Collections; - using System.ComponentModel.Composition; - using System.Reflection; - - class ImportAttributeInfo : AttributeInfo - { - static ConstructorInfo nameConstructor; - static ConstructorInfo typeConstructor; - static ConstructorInfo nameAndTypeConstructor; - - public override bool IsComplete - { - get { return false; } - } - - public override ICollection GetConstructorArguments(ImportAttribute attribute, ref ConstructorInfo constructor) - { - if (attribute.ContractName != null) - { - if (attribute.ContractType != null) - { - constructor = NameAndTypeConstructor; - return new object[] { attribute.ContractName, attribute.ContractType }; - } - else - { - constructor = NameConstructor; - return new object[] { attribute.ContractName }; - } - } - else if (attribute.ContractType != null) - { - constructor = TypeConstructor; - return new object[] { attribute.ContractType }; - } - else - { - return new object[] { }; - } - } - - public override ConstructorInfo GetConstructor() - { - return typeof(ImportAttribute).GetConstructor(Type.EmptyTypes); - } - - static ConstructorInfo NameConstructor - { - get - { - if (nameConstructor == null) - { - nameConstructor = typeof(ImportAttribute).GetConstructor(new Type[] { typeof(string) }); - } - return nameConstructor; - } - } - - static ConstructorInfo NameAndTypeConstructor - { - get - { - if (nameAndTypeConstructor == null) - { - nameAndTypeConstructor = typeof(ImportAttribute).GetConstructor(new Type[] { typeof(string), typeof(Type) }); - } - return nameAndTypeConstructor; - } - } - - static ConstructorInfo TypeConstructor - { - get - { - if (typeConstructor == null) - { - typeConstructor = typeof(ImportAttribute).GetConstructor(new Type[] { typeof(Type) }); - } - return typeConstructor; - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ImportManyAttributeInfo.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ImportManyAttributeInfo.cs deleted file mode 100644 index aa2b2459521..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ImportManyAttributeInfo.cs +++ /dev/null @@ -1,93 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Collections; - using System.ComponentModel.Composition; - using System.Reflection; - - class ImportManyAttributeInfo : AttributeInfo - { - static ConstructorInfo nameConstructor; - static ConstructorInfo typeConstructor; - static ConstructorInfo nameAndTypeConstructor; - - public override bool IsComplete - { - get - { - return false; - } - } - - public override ICollection GetConstructorArguments(ImportManyAttribute attribute, ref ConstructorInfo constructor) - { - if (attribute.ContractName != null) - { - if (attribute.ContractType != null) - { - constructor = NameAndTypeConstructor; - return new object[] { attribute.ContractName, attribute.ContractType }; - } - else - { - constructor = NameConstructor; - return new object[] { attribute.ContractName }; - } - } - else if (attribute.ContractType != null) - { - constructor = TypeConstructor; - return new object[] { attribute.ContractType }; - } - else - { - return new object[] { }; - } - } - - public override ConstructorInfo GetConstructor() - { - return typeof(ImportManyAttribute).GetConstructor(Type.EmptyTypes); - } - - static ConstructorInfo NameConstructor - { - get - { - if (nameConstructor == null) - { - nameConstructor = typeof(ImportManyAttribute).GetConstructor(new Type[] { typeof(string) }); - } - return nameConstructor; - } - } - - static ConstructorInfo NameAndTypeConstructor - { - get - { - if (nameAndTypeConstructor == null) - { - nameAndTypeConstructor = typeof(ImportManyAttribute).GetConstructor(new Type[] { typeof(Type) }); - } - return nameAndTypeConstructor; - } - } - - static ConstructorInfo TypeConstructor - { - get - { - if (typeConstructor == null) - { - typeConstructor = typeof(ImportManyAttribute).GetConstructor(new Type[] { typeof(string), typeof(Type) }); - } - return typeConstructor; - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/LineColumnPair.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/LineColumnPair.cs deleted file mode 100644 index 087446a2085..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/LineColumnPair.cs +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - - internal class LineColumnPair : Tuple - { - internal LineColumnPair(int item1, int item2) - : base(item1, item2) - { - SharedFx.Assert(item1 > 0 && item2 > 0, "item1 > 0&& item2 > 0"); - } - - internal int LineNumber - { - get { return this.Item1; } - } - - internal int ColumnNumber - { - get { return this.Item2; } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/MultiTargetingTypeResolver.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/MultiTargetingTypeResolver.cs deleted file mode 100644 index be55a92c9ad..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/MultiTargetingTypeResolver.cs +++ /dev/null @@ -1,86 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Activities.Presentation.Hosting; - using System.Collections.Generic; - using System.Reflection; - using System.Xaml; - - internal static class MultiTargetingTypeResolver - { - public static ResolverResult Resolve(MultiTargetingSupportService multiTargetingService, Type type) - { - SharedFx.Assert(multiTargetingService != null, "multiTargetingService should not be null"); - SharedFx.Assert(type != null, "type should not be null"); - - if (!multiTargetingService.IsSupportedType(type)) - { - return ResolverResult.Unknown; - } - - ResolverResult result; - - Type reflectionType = multiTargetingService.GetReflectionType(type); - - PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty); - PropertyInfo[] targetProperties = reflectionType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty); - - List newProperties = new List(); - - // Assume we don't remove properties in newer framework - // We only compare property name here - if (properties.Length > targetProperties.Length) - { - foreach (PropertyInfo propertyInfo in properties) - { - bool found = false; - foreach (PropertyInfo targetProperty in targetProperties) - { - if (targetProperty.Name == propertyInfo.Name) - { - found = true; - break; - } - } - - if (!found) - { - newProperties.Add(propertyInfo.Name); - } - } - - result = new ResolverResult(newProperties); - } - else - { - result = ResolverResult.FullySupported; - } - - return result; - } - - public static XamlType GetXamlType(ResolverResult resolverResult, XamlType oldXamlType) - { - SharedFx.Assert(oldXamlType != null, "oldXamlType should not be null"); - - switch (resolverResult.Kind) - { - case XamlTypeKind.FullySupported: - return oldXamlType; - - case XamlTypeKind.PartialSupported: - return new XamlTypeWithExtraPropertiesRemoved(oldXamlType.UnderlyingType, oldXamlType.SchemaContext, resolverResult.NewProperties); - - default: - SharedFx.Assert(resolverResult.Kind == XamlTypeKind.Unknown, "resolverResult.Kind should be XamlTypeKind.Unknown."); - return null; - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/NameSpaces.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/NameSpaces.cs deleted file mode 100644 index 5a5e0175f49..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/NameSpaces.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -internal static class NameSpaces -{ - public const string Mc = "http://schemas.openxmlformats.org/markup-compatibility/2006"; - public const string Design = "http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"; - public const string Design2010 = "http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"; - public const string Toolbox = "http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation/toolbox"; - public const string Activities = "http://schemas.microsoft.com/netfx/2009/xaml/activities"; - public const string DebugSymbol = "http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"; - public const string DesignPrefix = "sap"; - public const string Design2010Prefix = "sap2010"; - public const string McPrefix = "mc"; - public const string DebugSymbolPrefix = "sads"; - - public static bool ShouldIgnore(string ns) - { - return ns == Design2010 || ns == DebugSymbol || ns == Design; - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ObjectReferenceEqualityComparer.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ObjectReferenceEqualityComparer.cs deleted file mode 100644 index 778ca70310b..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ObjectReferenceEqualityComparer.cs +++ /dev/null @@ -1,43 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System.Collections.Generic; - using System.Runtime.CompilerServices; - - internal sealed class ObjectReferenceEqualityComparer : IEqualityComparer where T : class - { - private static ObjectReferenceEqualityComparer defaultComparer; - - private ObjectReferenceEqualityComparer() - { - } - - public static ObjectReferenceEqualityComparer Default - { - get - { - if (defaultComparer == null) - { - defaultComparer = new ObjectReferenceEqualityComparer(); - } - - return defaultComparer; - } - } - - public bool Equals(T x, T y) - { - return object.ReferenceEquals(x, y); - } - - public int GetHashCode(T obj) - { - return RuntimeHelpers.GetHashCode(obj); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ResolverCache.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ResolverCache.cs deleted file mode 100644 index eab7fee98c1..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ResolverCache.cs +++ /dev/null @@ -1,49 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Collections.Generic; - - internal class ResolverCache - { - private Dictionary cache; - - public ResolverCache() - { - this.cache = new Dictionary(); - } - - public void Update(Type type, ResolverResult result) - { - SharedFx.Assert(type != null, "type should not be null"); - SharedFx.Assert(result != null, "result should not be null"); - - if (this.cache.ContainsKey(type)) - { - this.cache[type] = new WeakReference(result); - } - else - { - this.cache.Add(type, new WeakReference(result)); - } - } - - public ResolverResult Lookup(Type type) - { - SharedFx.Assert(type != null, "type should not be null"); - - WeakReference value; - if (this.cache.TryGetValue(type, out value)) - { - return value.Target as ResolverResult; - } - - return null; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ResolverResult.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ResolverResult.cs deleted file mode 100644 index a7a2bd38699..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ResolverResult.cs +++ /dev/null @@ -1,48 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System.Collections.Generic; - - internal class ResolverResult - { - private static ResolverResult unknown = new ResolverResult(XamlTypeKind.Unknown); - private static ResolverResult fullySupported = new ResolverResult(XamlTypeKind.FullySupported); - - public ResolverResult(XamlTypeKind kind) - : this(kind, null) - { - } - - public ResolverResult(ICollection newProperties) - : this(XamlTypeKind.PartialSupported, newProperties) - { - } - - private ResolverResult(XamlTypeKind kind, ICollection newProperties) - { - SharedFx.Assert(kind != XamlTypeKind.PartialSupported || newProperties != null, "newProperties should not be null when kind is XamlTypeKind.PartialSupported"); - - this.Kind = kind; - this.NewProperties = newProperties; - } - - public static ResolverResult Unknown - { - get { return unknown; } - } - - public static ResolverResult FullySupported - { - get { return fullySupported; } - } - - public XamlTypeKind Kind { get; private set; } - - public ICollection NewProperties { get; private set; } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/SourceTextScanner.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/SourceTextScanner.cs deleted file mode 100644 index 2c3b66dc479..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/SourceTextScanner.cs +++ /dev/null @@ -1,193 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Collections.Generic; - using System.Globalization; - - // NOTE: (x, y) denotes line x column y, where x and y are 0 based, - // while the line/column in SourceLocation and LineNumberPair is 1 based. - internal class SourceTextScanner - { - private const char NewLine = '\n'; - - private const char Return = '\r'; - - private string source; - - // - // say a line is "abc\n" - // the length is 4, with '\n' included. - private List> indexCache; - - internal SourceTextScanner(string source) - { - SharedFx.Assert(source != null, "source != null"); - this.source = source; - this.indexCache = new List>(); - } - - internal Tuple SearchCharAfter(LineColumnPair startPoint, params char[] charsToSearch) - { - SharedFx.Assert(startPoint != null, "startPoint != null"); - - int line = startPoint.LineNumber - 1; - int column = startPoint.ColumnNumber - 1; - - HashSet charsToSearchSet = new HashSet(charsToSearch); - int index = this.GetIndex(line, column); - if (index < 0) - { - return null; - } - - bool firstLoop = true; - foreach (Tuple currentPair in this.Scan(index)) - { - if (firstLoop) - { - firstLoop = false; - } - else - { - if (charsToSearchSet.Contains(currentPair.Item1)) - { - LineColumnPair location = this.GetLocation(currentPair.Item2); - SharedFx.Assert(location != null, "invalid location"); - return Tuple.Create(location, currentPair.Item1); - } - } - } - - return null; - } - - private LineColumnPair GetLocation(int index) - { - SharedFx.Assert(index >= 0 && index < this.source.Length, "index out of range"); - - while (!this.IsIndexInScannedLine(index)) - { - this.TryScanNextLine(); - } - - int line = this.indexCache.Count - 1; - for (; line >= 0; --line) - { - if (index >= this.indexCache[line].Item1) - { - break; - } - } - - SharedFx.Assert(line >= 0, "line < this.indexCache.Count"); - int column = index - this.indexCache[line].Item1; - SharedFx.Assert(column < this.indexCache[line].Item2, "Should Not Happen"); - - return new LineColumnPair(line + 1, column + 1); - } - - private int GetIndex(int line, int column) - { - while (this.indexCache.Count <= line) - { - if (!this.TryScanNextLine()) - { - break; - } - } - - if (this.indexCache.Count <= line) - { - SharedFx.Assert(string.Format(CultureInfo.CurrentCulture, "line out of range:({0},{1})", line + 1, column + 1)); - return -1; - } - - if (column >= this.indexCache[line].Item2) - { - SharedFx.Assert(string.Format(CultureInfo.CurrentCulture, "column out of range:({0},{1})", line + 1, column + 1)); - return -1; - } - - return this.indexCache[line].Item1 + column; - } - - private bool IsIndexInScannedLine(int index) - { - SharedFx.Assert(index >= 0 && index < this.source.Length, "invalid index"); - - int last = this.indexCache.Count - 1; - return last >= 0 && index < this.indexCache[last].Item1 + this.indexCache[last].Item2; - } - - // return created - private bool TryScanNextLine() - { - int startIndex = 0; - if (this.indexCache.Count > 0) - { - int tail = this.indexCache.Count - 1; - startIndex = this.indexCache[tail].Item1 + this.indexCache[tail].Item2; - } - - if (startIndex >= this.source.Length) - { - return false; - } - - int lastIndex = -1; - foreach (Tuple currentPair in this.Scan(startIndex)) - { - lastIndex = currentPair.Item2; - if (currentPair.Item1 == NewLine) - { - break; - } - } - - if (lastIndex < 0) - { - SharedFx.Assert("lastIndex < 0"); - return false; - } - - int lineLength = lastIndex - startIndex + 1; - this.indexCache.Add(Tuple.Create(startIndex, lineLength)); - return true; - } - - // Tuple - // this Scan will replace \r\n=>\n \r=>\n - // \r\n return: <\n, \n's index> - // \r return: <\n, \r's index> - private IEnumerable> Scan(int index) - { - if (index < 0 || index >= this.source.Length) - { - SharedFx.Assert("index < 0 || index >= this.source.Length"); - yield break; - } - - while (index < this.source.Length) - { - char currentChar = this.source[index]; - - if (currentChar == Return) - { - if (index + 1 < this.source.Length && this.source[index + 1] == NewLine) - { - ++index; - } - - currentChar = NewLine; - } - - yield return Tuple.Create(currentChar, index); - ++index; - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ViewStateIdManager.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ViewStateIdManager.cs deleted file mode 100644 index 2122c0c1e64..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ViewStateIdManager.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System.Collections.Generic; - - class ViewStateIdManager - { - readonly char separatorChar = '_'; - Dictionary prefixToIntMap = new Dictionary(); - - public void UpdateMap(string id) - { - int separatorLocation = id.LastIndexOf('_'); - - // If the separator is not found or if the separator is the first or last character - // in the id then use id value itself as the prefix. - if (separatorLocation == -1 || separatorLocation == 0 || separatorLocation == id.Length - 1) - { - this.prefixToIntMap[id] = 0; - } - else - { - string[] idParts = new string[2]; - idParts[0] = id.Substring(0, separatorLocation); - idParts[1] = id.Substring(separatorLocation + 1, id.Length - (separatorLocation + 1)); - - int suffix; - if (int.TryParse(idParts[1], out suffix)) - { - int oldValue; - if (this.prefixToIntMap.TryGetValue(idParts[0], out oldValue)) - { - if (suffix > oldValue) - { - this.prefixToIntMap[idParts[0]] = suffix; - } - } - else - { - this.prefixToIntMap[idParts[0]] = suffix; - } - } - else - { - this.prefixToIntMap[id] = 0; - } - } - } - - public string GetNewId(string prefix) - { - int suffix = 0; - this.prefixToIntMap.TryGetValue(prefix, out suffix); - - while (suffix == int.MaxValue) - { - prefix = prefix + this.separatorChar + suffix; - this.prefixToIntMap.TryGetValue(prefix, out suffix); - } - - this.prefixToIntMap[prefix] = ++suffix; - return prefix + this.separatorChar + suffix; - } - }; -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ViewStateXamlHelper.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ViewStateXamlHelper.cs deleted file mode 100644 index fb5266eb131..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ViewStateXamlHelper.cs +++ /dev/null @@ -1,866 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Activities; - using System.Activities.Debugger; - using System.Activities.DynamicUpdate; - using System.Activities.Presentation.View; - using System.Activities.Presentation.ViewState; - using System.Collections.Generic; - using System.Reflection; - using System.Runtime; - using System.Xaml; - - internal static class ViewStateXamlHelper - { - static readonly string ViewStateManager = WorkflowViewState.ViewStateManagerProperty.MemberName; - static readonly string IdRef = WorkflowViewState.IdRefProperty.MemberName; - static readonly MethodInfo GetViewStateManager = typeof(WorkflowViewState).GetMethod("GetViewStateManager"); - static readonly MethodInfo SetViewStateManager = typeof(WorkflowViewState).GetMethod("SetViewStateManager"); - static readonly MethodInfo GetIdRef = typeof(WorkflowViewState).GetMethod("GetIdRef"); - static readonly MethodInfo SetIdRef = typeof(WorkflowViewState).GetMethod("SetIdRef"); - static readonly List SourceLocationNames = new List - { - XamlDebuggerXmlReader.StartLineName.MemberName, - XamlDebuggerXmlReader.StartColumnName.MemberName, - XamlDebuggerXmlReader.EndLineName.MemberName, - XamlDebuggerXmlReader.EndColumnName.MemberName - }; - - // These are used to discover that we have found a DynamicUpdateInfo.OriginalDefintion or OriginalActivityBuilder - // attached property member. We have "hardcoded" the *MemberName" here because DynamicUpdateInfo has the - // AttachableMemberIdentifier properties marked as private. But the DynamicUpdateInfo class itself is public, - // as are the Get and Set methods. - static readonly string DynamicUpdateOriginalDefinitionMemberName = "OriginalDefinition"; - static readonly MethodInfo GetOriginalDefinition = typeof(DynamicUpdateInfo).GetMethod("GetOriginalDefinition"); - static readonly MethodInfo SetOriginalDefinition = typeof(DynamicUpdateInfo).GetMethod("SetOriginalDefinition"); - - static readonly string DynamicUpdateOriginalActivityBuilderMemberName = "OriginalActivityBuilder"; - static readonly MethodInfo GetOriginalActivityBuilder = typeof(DynamicUpdateInfo).GetMethod("GetOriginalActivityBuilder"); - static readonly MethodInfo SetOriginalActivityBuilder = typeof(DynamicUpdateInfo).GetMethod("SetOriginalActivityBuilder"); - - // This method collects view state attached properties and generates a Xaml node stream - // with all view state information appearing within the ViewStateManager node. - // It is called when workflow definition is being serialized to string. - // inputReader - Nodestream with view state information as attached properties on the activity nodes. - // The reader is positioned at the begining of the workflow definition. - // idManager - This component issues running sequence numbers for IdRef. - // Result - Node stream positioned at the begining of the workflow definition with a - // ViewStateManager node containing all view state information. - // Implementation logic: - // 1. Scan the input nodestream Objects for attached properties that need to be converted (VirtualizedContainerService.HintSize and WorkflowViewStateService.ViewState). - // 2. If the Object had a IdRef value then use it otherwise generate a new value. - // 3. Store idRef value and corresponding viewstate related attached property nodes (from step 1) - // in the viewStateInfo dictionary. - // 4. Use the viewStateInfo dictionary to generate ViewStateManager node which is then inserted - // into the end of output nodestream. - public static XamlReader ConvertAttachedPropertiesToViewState(XamlObjectReader inputReader, ViewStateIdManager idManager) - { - // Stack to track StartObject/GetObject and EndObject nodes. - Stack stack = new Stack(); - - XamlMember viewStateManager = new XamlMember(ViewStateManager, GetViewStateManager, SetViewStateManager, inputReader.SchemaContext); - XamlMember idRefMember = new XamlMember(IdRef, GetIdRef, SetIdRef, inputReader.SchemaContext); - - // Xaml member corresponding to x:Class property of the workflow definition. Used to find x:Class value in the node stream. - XamlMember activityBuilderName = new XamlMember(typeof(ActivityBuilder).GetProperty("Name"), inputReader.SchemaContext); - string activityBuilderTypeName = typeof(ActivityBuilder).Name; - - // Dictionary to keep track of IdRefs and corresponding viewstate related - // attached property nodes. - Dictionary viewStateInfo = new Dictionary(); - - // Output node list - XamlNodeList workflowDefinition = new XamlNodeList(inputReader.SchemaContext); - - using (XamlWriter workflowDefinitionWriter = workflowDefinition.Writer) - { - bool design2010NamespaceFound = false; - bool inIdRefMember = false; - bool inxClassMember = false; - bool skipWritingWorkflowDefinition = false; - bool skipReadingWorkflowDefinition = false; - string xClassName = null; - - while (skipReadingWorkflowDefinition || inputReader.Read()) - { - skipWritingWorkflowDefinition = false; - skipReadingWorkflowDefinition = false; - switch (inputReader.NodeType) - { - case XamlNodeType.NamespaceDeclaration: - if (inputReader.Namespace.Namespace.Equals(NameSpaces.Design2010, StringComparison.Ordinal)) - { - design2010NamespaceFound = true; - } - break; - - case XamlNodeType.StartObject: - // Save the Xaml type and clr object on the stack frame. These are used later to generate - // IdRef values and attaching the same to the clr object. - stack.Push(new Frame() { Type = inputReader.Type, InstanceObject = inputReader.Instance }); - - // If the design2010 namespace was not found add the namespace node - // before the start object is written out. - if (!design2010NamespaceFound) - { - workflowDefinitionWriter.WriteNamespace(new NamespaceDeclaration(NameSpaces.Design2010, NameSpaces.Design2010Prefix)); - design2010NamespaceFound = true; - } - break; - - case XamlNodeType.GetObject: - // Push an empty frame to balance the Pop operation when the EndObject node - // is encountered. - stack.Push(new Frame() { Type = null }); - break; - - case XamlNodeType.StartMember: - // Track when we enter IdRef member so that we can save its value. - if (inputReader.Member.Equals(idRefMember)) - { - inIdRefMember = true; - } - // Track when we enter x:Class member so that we can save its value. - else if (inputReader.Member.Equals(activityBuilderName)) - { - inxClassMember = true; - } - // Start of VirtualizedContainerService.HintSize or WorkflowViewStateService.ViewState property. - else if (IsAttachablePropertyForConvert(inputReader)) - { - // The top of stack here corresponds to the activity on which - // the above properties are attached. - if (stack.Peek().AttachedPropertyNodes == null) - { - stack.Peek().AttachedPropertyNodes = new XamlNodeList(inputReader.SchemaContext); - } - - // Write the attached property's xaml nodes into the stack. - XamlReader subTreeReader = inputReader.ReadSubtree(); - XamlWriter attachedPropertyWriter = stack.Peek().AttachedPropertyNodes.Writer; - while (subTreeReader.Read()) - { - attachedPropertyWriter.WriteNode(subTreeReader); - } - - // The subtree reader loop put us at the begining of the next node in the input stream. - // So skip reading/writing it out just yet. - skipReadingWorkflowDefinition = true; - skipWritingWorkflowDefinition = true; - } - break; - - case XamlNodeType.Value: - // Read and save IdRef/x:Class member values. - // Also update idManager to keep track of prefixes and ids seen. - if (inIdRefMember) - { - string idRef = inputReader.Value as string; - stack.Peek().IdRef = idRef; - idManager.UpdateMap(idRef); - } - else if (inxClassMember) - { - xClassName = inputReader.Value as string; - idManager.UpdateMap(xClassName); - } - break; - - case XamlNodeType.EndMember: - // Exit IdRef/x:Class member state. - if (inIdRefMember) - { - inIdRefMember = false; - } - else if (inxClassMember) - { - inxClassMember = false; - } - break; - - case XamlNodeType.EndObject: - // Remove an item from the stack because we encountered the end of an object definition. - Frame frameObject = stack.Pop(); - - // If the object had (viewstate related) attached properties we need to save them - // into the viewStateInfo dictionary. - if (frameObject.AttachedPropertyNodes != null) - { - frameObject.AttachedPropertyNodes.Writer.Close(); - - // If the object didn't have IdRef, generate a new one. - if (string.IsNullOrWhiteSpace(frameObject.IdRef)) - { - // Use the object type name (or x:Class value) to generate a new id. - if (frameObject.Type != null) - { - string prefix = frameObject.Type.Name; - if (frameObject.Type.UnderlyingType != null) - { - prefix = frameObject.Type.UnderlyingType.Name; - } - - if (string.CompareOrdinal(prefix, activityBuilderTypeName) == 0 && !string.IsNullOrWhiteSpace(xClassName)) - { - frameObject.IdRef = idManager.GetNewId(xClassName); - } - else - { - frameObject.IdRef = idManager.GetNewId(prefix); - } - } - else //Fallback to generating a guid value. - { - frameObject.IdRef = Guid.NewGuid().ToString(); - } - - // Since we didn't see a IdRef on this object, insert the generated - // viewstate id into the output Xaml node-stream. - workflowDefinitionWriter.WriteStartMember(idRefMember); - workflowDefinitionWriter.WriteValue(frameObject.IdRef); - workflowDefinitionWriter.WriteEndMember(); - - // Save the generated idRef on the corresponding clr object as well. - if (frameObject.InstanceObject != null) - { - WorkflowViewState.SetIdRef(frameObject.InstanceObject, frameObject.IdRef); - } - } - - viewStateInfo[frameObject.IdRef] = frameObject.AttachedPropertyNodes; - } - - // We're at the end of input nodestream and have collected data in viewStateInfo - // so we need to create and insert the ViewStateManager nodes into the output nodestream. - if (stack.Count == 0 && viewStateInfo.Count > 0) - { - XamlNodeList viewStateManagerNodeList = CreateViewStateManagerNodeList(viewStateInfo, inputReader.SchemaContext); - XamlReader viewStateManagerNodeReader = viewStateManagerNodeList.GetReader(); - - // Insert the ViewStateManager nodes into the output node stream. - workflowDefinitionWriter.WriteStartMember(viewStateManager); - while (viewStateManagerNodeReader.Read()) - { - workflowDefinitionWriter.WriteNode(viewStateManagerNodeReader); - } - workflowDefinitionWriter.WriteEndMember(); // viewStateManager - } - break; - } - - if (!skipWritingWorkflowDefinition) - { - workflowDefinitionWriter.WriteNode(inputReader); - } - } - } - - return workflowDefinition.GetReader(); - } - - // This method converts view state information stored within the ViewStateManager node back as - // attached properties on corresponding activity nodes. - // It is called when workflow definition is being deserialized from a string. - // inputReader - Nodestream that may have all view state information in the ViewStateManager node at the end of workflow definition. - // The reader is positioned at the begining of the workflow definition. - // idManager - This component issues running sequence numbers for IdRef. - // viewStateManager - (output) ViewStateManager object instance deserialized from the workflow definition. - // Result - Node stream positioned at the begining of the workflow definition with view state related information - // appearing as attached properties on activities. The ViewStateManager nodes are removed from the stream. - // Implementation logic: - // 1. Scan the input nodestream for ViewStateManager node. - // 2. If ViewStateManager node is found, store Id and corresponding attached property nodes - // in viewStateInfo dictionary. Otherwise return early. - // 3. Walk activity nodes in the workflow definition and apply viewstate related attached properties (from - // viewStateInfo dictionary) to each node. - // 4. If multiple activities have same IdRef values then corresponding viewstate related attached properties - // (from viewStateInfo dictionary) are applied to the first of those activities. The other activities with duplicate - // IdRef values do not get view state information. - public static XamlReader ConvertViewStateToAttachedProperties(XamlReader inputReader, ViewStateIdManager idManager, out Dictionary viewStateSourceLocationMap) - { - int idRefLineNumber = 0; - int idRefLinePosition = 0; - bool shouldWriteIdRefEndMember = false; - - XamlReader retVal = null; - - // Xaml member definition for IdRef. Used to identify existing IdRef properties in the input nodestream. - XamlMember idRefMember = new XamlMember(IdRef, GetIdRef, SetIdRef, inputReader.SchemaContext); - - // These are used to ignore the IdRef members that are inside a DynamicUpdateInfo.OriginalDefinition/OriginalActivityBuilder attached property. - // We need to ignore these because if we don't, the IdRef values for the objects in the actual workflow defintion will be ignored because of the - // duplicate IdRef value. This causes problems with activity designers that depend on the ViewStateManager data to correctly display the workflow - // on the WorkflowDesigner canvas. - XamlMember originalDefinitionMember = new XamlMember(DynamicUpdateOriginalDefinitionMemberName, GetOriginalDefinition, SetOriginalDefinition, inputReader.SchemaContext); - XamlMember originalActivityBuilderMember = new XamlMember(DynamicUpdateOriginalActivityBuilderMemberName, GetOriginalActivityBuilder, SetOriginalActivityBuilder, inputReader.SchemaContext); - - // insideOriginalDefintion gets set to true when we find a "StartMember" node for either of the above two attached properties. - // originalDefintionMemberCount gets incremented if we find any "StartMember" and insideOriginalDefinition is true. - // originalDefintionMemberCount gets decremented if we find any "EndMember" and insideOriginalDefintion is true. - // insideOriginalDefintion gets set to false when we find an "EndMember" and originalDefinitionMemberCount gets decremented to 0. - // If insideOriginalDefintion is true when we find an "IdRef" member, we do NOT add that IdRef to the idRefsSeen HashSet to avoid - // duplicates being defined by the IdRefs inside of the OriginalDefinition attached properties. - bool insideOriginalDefinition = false; - int originalDefinitionMemberCount = 0; - - // Dictionary containing Ids and corresponding viewstate related - // attached property nodes. Populated by StripViewStateElement method. - Dictionary viewStateInfo = null; - XamlReader workflowDefinition = StripViewStateElement(inputReader, out viewStateInfo, out viewStateSourceLocationMap); - - // This is used to keep track of duplicate IdRefs in the workflow definition. - HashSet idRefsSeen = new HashSet(); - - // If the inputReader did not have a ViewStateManager node (4.0 format) - // return early. - if (viewStateInfo == null) - { - retVal = workflowDefinition; - } - else - { - // Stack to track StartObject/GetObject and EndObject nodes. - Stack stack = new Stack(); - - // Output node list. - XamlNodeList mergedNodeList = new XamlNodeList(workflowDefinition.SchemaContext); - bool inIdRefMember = false; - - using (XamlWriter mergedNodeWriter = mergedNodeList.Writer) - { - IXamlLineInfo lineInfo = workflowDefinition as IXamlLineInfo; - IXamlLineInfoConsumer lineInfoComsumer = mergedNodeWriter as IXamlLineInfoConsumer; - bool shouldPassLineInfo = lineInfo != null && lineInfo.HasLineInfo && lineInfoComsumer != null && lineInfoComsumer.ShouldProvideLineInfo; - - while (workflowDefinition.Read()) - { - bool skipWritingWorkflowDefinition = false; - - switch (workflowDefinition.NodeType) - { - case XamlNodeType.StartObject: - stack.Push(new Frame { Type = workflowDefinition.Type }); - break; - - case XamlNodeType.GetObject: - stack.Push(new Frame { Type = null }); - break; - - case XamlNodeType.StartMember: - // If we find a StartMember for DynamicUpdateInfo.OriginalDefinition or OriginalActivityBuilder, remember that we are - // inside one of those. We don't want to "remember" IdRef values in the idRefsSeen HashSet while inside these attached properties. - if (workflowDefinition.Member.Equals(originalDefinitionMember) || workflowDefinition.Member.Equals(originalActivityBuilderMember)) - { - insideOriginalDefinition = true; - } - - if (insideOriginalDefinition) - { - originalDefinitionMemberCount++; - } - - // Track when the reader enters IdRef. Skip writing the start - // node to the output nodelist until we check for duplicates. - else if (workflowDefinition.Member.Equals(idRefMember)) - { - inIdRefMember = true; - skipWritingWorkflowDefinition = true; - - if (shouldPassLineInfo) - { - idRefLineNumber = lineInfo.LineNumber; - idRefLinePosition = lineInfo.LinePosition; - } - } - break; - - case XamlNodeType.Value: - if (inIdRefMember) - { - // We don't want to deal with the IdRef if we are inside a DynamicUpdateInfo.OriginalDefinition/OriginalActivityBuilder - // attached property. - if (!insideOriginalDefinition) - { - string idRef = workflowDefinition.Value as string; - if (!string.IsNullOrWhiteSpace(idRef)) - { - // If IdRef value is a duplicate then do not associate it with - // the stack frame (top of stack == activity node with IdRef member on it). - if (idRefsSeen.Contains(idRef)) - { - stack.Peek().IdRef = null; - } - // If the IdRef value is unique then associate it with the - // stack frame and also write its value into the output nodestream. - else - { - stack.Peek().IdRef = idRef; - idManager.UpdateMap(idRef); - idRefsSeen.Add(idRef); - - if (shouldPassLineInfo) - { - lineInfoComsumer.SetLineInfo(idRefLineNumber, idRefLinePosition); - } - - mergedNodeWriter.WriteStartMember(idRefMember); - - if (shouldPassLineInfo) - { - lineInfoComsumer.SetLineInfo(lineInfo.LineNumber, lineInfo.LinePosition); - } - - mergedNodeWriter.WriteValue(idRef); - - shouldWriteIdRefEndMember = true; - } - } - } - // Don't need to write IdRef value into the output - // nodestream. If the value was valid, it would have been written above. - skipWritingWorkflowDefinition = true; - } - break; - - case XamlNodeType.EndMember: - // If we are inside an OriginalDefinition/OriginalActivityBuilder attached property, - // decrement the count and if it goes to zero, set insideOriginalDefintion to false - // because we just encountered the EndMember for it. - if (insideOriginalDefinition) - { - originalDefinitionMemberCount--; - if (originalDefinitionMemberCount == 0) - { - insideOriginalDefinition = false; - } - } - - // Exit IdRef node. Skip writing the EndMember node, we would have done - // it as part of reading the IdRef value. - if (inIdRefMember && !insideOriginalDefinition) - { - inIdRefMember = false; - skipWritingWorkflowDefinition = true; - - if (shouldWriteIdRefEndMember) - { - shouldWriteIdRefEndMember = false; - - if (shouldPassLineInfo) - { - lineInfoComsumer.SetLineInfo(lineInfo.LineNumber, lineInfo.LinePosition); - } - - mergedNodeWriter.WriteEndMember(); - } - } - - break; - - case XamlNodeType.EndObject: - Frame frameObject = stack.Pop(); - // Before we exit the end of an object, check if it had IdRef - // associated with it. If it did, look-up viewStateInfo for viewstate - // related attached property nodes and add them to the output nodelist. - if (!string.IsNullOrWhiteSpace(frameObject.IdRef)) - { - XamlNodeList viewStateNodeList; - if (viewStateInfo.TryGetValue(frameObject.IdRef, out viewStateNodeList)) - { - XamlReader viewStateReader = viewStateNodeList.GetReader(); - - IXamlLineInfo viewStateLineInfo = viewStateReader as IXamlLineInfo; - bool viewStateShouldPassLineInfo = viewStateLineInfo != null && viewStateLineInfo.HasLineInfo && lineInfoComsumer != null && lineInfoComsumer.ShouldProvideLineInfo; - - while (viewStateReader.Read()) - { - if (viewStateShouldPassLineInfo) - { - lineInfoComsumer.SetLineInfo(viewStateLineInfo.LineNumber, viewStateLineInfo.LinePosition); - } - - mergedNodeWriter.WriteNode(viewStateReader); - } - } - } - break; - } - if (!skipWritingWorkflowDefinition) - { - if (shouldPassLineInfo) - { - lineInfoComsumer.SetLineInfo(lineInfo.LineNumber, lineInfo.LinePosition); - } - - mergedNodeWriter.WriteNode(workflowDefinition); - } - } - } - - retVal = mergedNodeList.GetReader(); - } - - return retVal; - } - - // This method removes IdRef nodes from the nodestream. This method would be called - // when a 4.5 workflow definition is retargeted to 4.0. - public static XamlReader RemoveIdRefs(XamlObjectReader inputReader) - { - XamlMember idRefMember = new XamlMember(IdRef, GetIdRef, SetIdRef, inputReader.SchemaContext); - - XamlNodeList outputNodeList = new XamlNodeList(inputReader.SchemaContext); - using (XamlWriter outputWriter = outputNodeList.Writer) - { - while (inputReader.Read()) - { - if (inputReader.NodeType == XamlNodeType.StartMember && inputReader.Member.Equals(idRefMember)) - { - // Exhaust the idRefMember sub-tree. - XamlReader idRefReader = inputReader.ReadSubtree(); - while (idRefReader.Read()); - } - outputWriter.WriteNode(inputReader); - } - } - return outputNodeList.GetReader(); - } - - // This is a helper method to output the nodestream sequence for debugging/diagnostic purposes. - public static void NodeLoopTest(XamlReader xamlReader) - { -#if DEBUG - string tabs = ""; - int depth = 1; - while (xamlReader.Read()) - { - switch (xamlReader.NodeType) - { - case XamlNodeType.NamespaceDeclaration: - System.Diagnostics.Debug.WriteLine(tabs + "Namespace declaration: {0}:{1}", xamlReader.Namespace.Prefix, xamlReader.Namespace.Namespace); - break; - case XamlNodeType.StartObject: - tabs = new String(' ', depth++); - System.Diagnostics.Debug.WriteLine(tabs + "Start object: {0}", xamlReader.Type.Name); - break; - case XamlNodeType.GetObject: - tabs = new String(' ', depth++); - System.Diagnostics.Debug.WriteLine(tabs + "Get object"); - break; - case XamlNodeType.StartMember: - tabs = new String(' ', depth++); - System.Diagnostics.Debug.WriteLine(tabs + "Start member: {0}, Attachable: {1}", xamlReader.Member.Name, xamlReader.Member.IsAttachable); - break; - case XamlNodeType.Value: - tabs = new String(' ', depth++); - System.Diagnostics.Debug.WriteLine(tabs + "Value: {0}", xamlReader.Value); - --depth; - break; - case XamlNodeType.EndMember: - tabs = new String(' ', --depth); - System.Diagnostics.Debug.WriteLine(tabs + "End member"); - break; - case XamlNodeType.EndObject: - tabs = new String(' ', --depth); - System.Diagnostics.Debug.WriteLine(tabs + "End object"); - break; - } - } -#endif - } - - // Given the viewStateInfo dictionary, this method returns a xaml node list matching a ViewStateManager - // object. - static XamlNodeList CreateViewStateManagerNodeList(Dictionary viewStateInfo, XamlSchemaContext schemaContext) - { - XamlNodeList viewStateManagerNodeList = new XamlNodeList(schemaContext); - - XamlMember viewStateDataMember = new XamlMember(typeof(ViewStateManager).GetProperty("ViewStateData"), schemaContext); - XamlType viewStateManagerType = new XamlType(typeof(ViewStateManager), schemaContext); - XamlType viewStateDataType = new XamlType(typeof(ViewStateData), schemaContext); - XamlMember idMember = new XamlMember(typeof(ViewStateData).GetProperty("Id"), schemaContext); - - using (XamlWriter viewStateManagerNodeWriter = viewStateManagerNodeList.Writer) - { - viewStateManagerNodeWriter.WriteStartObject(viewStateManagerType); - viewStateManagerNodeWriter.WriteStartMember(viewStateDataMember); - viewStateManagerNodeWriter.WriteGetObject(); - viewStateManagerNodeWriter.WriteStartMember(XamlLanguage.Items); - - foreach (KeyValuePair entry in viewStateInfo) - { - viewStateManagerNodeWriter.WriteStartObject(viewStateDataType); - - viewStateManagerNodeWriter.WriteStartMember(idMember); - viewStateManagerNodeWriter.WriteValue(entry.Key); - viewStateManagerNodeWriter.WriteEndMember(); // idMember - - XamlReader viewStateValueReader = entry.Value.GetReader(); - while (viewStateValueReader.Read()) - { - viewStateManagerNodeWriter.WriteNode(viewStateValueReader); - } - - viewStateManagerNodeWriter.WriteEndObject(); // viewStateDataType - } - - viewStateManagerNodeWriter.WriteEndMember(); // XamlLanguage.Items - viewStateManagerNodeWriter.WriteEndObject(); // GetObject - viewStateManagerNodeWriter.WriteEndMember(); // viewStateDataMember - viewStateManagerNodeWriter.WriteEndObject(); // viewStateManagerType - viewStateManagerNodeWriter.Close(); - } - - return viewStateManagerNodeList; - } - - // Checks if the Xaml reader is on one of WorkflowViewStateService.ViewState or - // VirtualizedContainerService.HintSize members in the nodestream. These - // members need to be moved into the ViewStateManager node during the conversion. - static bool IsAttachablePropertyForConvert(XamlReader reader) - { - if (reader.NodeType == XamlNodeType.StartMember) - { - XamlMember member = reader.Member; - if (member.IsAttachable) - { - if (member.DeclaringType.UnderlyingType == typeof(WorkflowViewStateService) && member.Name.Equals("ViewState", StringComparison.Ordinal)) - { - return true; - } - else if (member.DeclaringType.UnderlyingType == typeof(VirtualizedContainerService) && member.Name.Equals("HintSize", StringComparison.Ordinal)) - { - return true; - } - } - } - return false; - } - - // This method reads ViewStateManager nodes from the xaml nodestream and outputs that in the - // viewStateInfo dictionary. The input reader is positioned at the begining of the workflow definition. - // The method returns a reader positioned at the begining of the workflow definition with the ViewStateManager - // nodes removed. - static XamlReader StripViewStateElement(XamlReader inputReader, out Dictionary viewStateInfo, out Dictionary viewStateSourceLocationMap) - { - viewStateSourceLocationMap = null; - XamlNodeList strippedNodeList = new XamlNodeList(inputReader.SchemaContext); - XamlMember viewStateManager = new XamlMember(ViewStateManager, GetViewStateManager, SetViewStateManager, inputReader.SchemaContext); - - using (XamlWriter strippedWriter = strippedNodeList.Writer) - { - IXamlLineInfo lineInfo = inputReader as IXamlLineInfo; - IXamlLineInfoConsumer lineInfoComsumer = strippedWriter as IXamlLineInfoConsumer; - bool shouldPassLineInfo = lineInfo != null && lineInfo.HasLineInfo && lineInfoComsumer != null && lineInfoComsumer.ShouldProvideLineInfo; - - viewStateInfo = null; - while (inputReader.Read()) - { - if (inputReader.NodeType == XamlNodeType.StartMember && inputReader.Member.Equals(viewStateManager)) - { - ReadViewStateInfo(inputReader.ReadSubtree(), out viewStateInfo, out viewStateSourceLocationMap); - - } - - if (shouldPassLineInfo) - { - lineInfoComsumer.SetLineInfo(lineInfo.LineNumber, lineInfo.LinePosition); - } - - strippedWriter.WriteNode(inputReader); - } - } - - return strippedNodeList.GetReader(); - } - - // This method reads ViewStateManager nodes from the xaml nodestream and outputs that in the - // viewStateInfo dictionary. The input reader is positioned on the ViewStateManagerNode in the nodestream. - static void ReadViewStateInfo(XamlReader inputReader, out Dictionary viewStateInfo, out Dictionary viewStateSourceLocationMap) - { - XamlType viewStateType = new XamlType(typeof(ViewStateData), inputReader.SchemaContext); - - viewStateInfo = new Dictionary(); - viewStateSourceLocationMap = new Dictionary(); - bool skipReading = false; - while (skipReading || inputReader.Read()) - { - skipReading = false; - if (inputReader.NodeType == XamlNodeType.StartObject && inputReader.Type.Equals(viewStateType)) - { - string id; - XamlNodeList viewStateNodeList; - SourceLocation viewStateSourceLocation = null; - ReadViewState(viewStateType, inputReader.ReadSubtree(), out id, out viewStateNodeList, out viewStateSourceLocation); - if (id != null) - { - viewStateInfo[id] = viewStateNodeList; - viewStateSourceLocationMap[id] = viewStateSourceLocation; - } - - //inputReader will be positioned on the next node so no need to advance it. - skipReading = true; - } - } - } - - // This method reads a ViewStateData node from the xaml nodestream. It outputs the Id property into viewStateId - // and the attached viewstate related properties in viewStateNodes. The input reader is positioned on a - // ViewStateData node within ViewStateManager. - static void ReadViewState(XamlType viewStateType, XamlReader xamlReader, out string viewStateId, out XamlNodeList viewStateNodes, out SourceLocation sourceLocation) - { - int globalMemberLevel = 0; - bool skippingUnexpectedAttachedProperty = false; - int skippingUnexpectedAttachedPropertyLevel = 0; - viewStateId = null; - viewStateNodes = new XamlNodeList(viewStateType.SchemaContext); - sourceLocation = null; - - Stack objectNodes = new Stack(); - XamlMember idMember = new XamlMember(typeof(ViewStateData).GetProperty("Id"), xamlReader.SchemaContext); - int[] viewStateDataSourceLocation = new int[4]; - int sourceLocationIndex = -1; - - IXamlLineInfo lineInfo = xamlReader as IXamlLineInfo; - IXamlLineInfoConsumer lineInfoComsumer = viewStateNodes.Writer as IXamlLineInfoConsumer; - bool shouldPassLineInfo = lineInfo != null && lineInfo.HasLineInfo && lineInfoComsumer != null && lineInfoComsumer.ShouldProvideLineInfo; - - while (xamlReader.Read()) - { - bool skipWritingToNodeList = false; - switch (xamlReader.NodeType) - { - case XamlNodeType.StartObject: - if (xamlReader.Type.Equals(viewStateType)) - { - skipWritingToNodeList = true; - } - objectNodes.Push(new Frame { Type = xamlReader.Type }); - break; - - case XamlNodeType.GetObject: - objectNodes.Push(new Frame { Type = null }); - break; - - case XamlNodeType.StartMember: - globalMemberLevel++; - if (xamlReader.Member.Equals(idMember)) - { - XamlReader idNode = xamlReader.ReadSubtree(); - while (idNode.Read()) - { - if (idNode.NodeType == XamlNodeType.Value) - { - viewStateId = idNode.Value as string; - } - } - } - // The xamlReader.ReadSubtree and subsequent while loop to get the Id member - // has moved the xamlReader forward to the next member. We need to check to see - // if it is an Attached Property that we care about. If it isn't then we need to - // skip it and not put it in the resulting XamlNodeList. - if (globalMemberLevel == 1 && !IsAttachablePropertyForConvert(xamlReader)) - { - skippingUnexpectedAttachedProperty = true; - } - if (skippingUnexpectedAttachedProperty) - { - skippingUnexpectedAttachedPropertyLevel++; - } - - sourceLocationIndex = GetViewStateDataSourceLocationIndexFromCurrentReader(xamlReader); - break; - - case XamlNodeType.EndMember: - globalMemberLevel--; - if (skippingUnexpectedAttachedProperty) - { - skippingUnexpectedAttachedPropertyLevel--; - } - break; - case XamlNodeType.Value: - if (xamlReader.Value is int - && sourceLocationIndex >= 0 - && sourceLocationIndex < viewStateDataSourceLocation.Length) - { - viewStateDataSourceLocation[sourceLocationIndex] = (int)xamlReader.Value; - } - - break; - case XamlNodeType.EndObject: - Frame objectNode = objectNodes.Pop(); - if (objectNode.Type != null && objectNode.Type.Equals(viewStateType)) - { - skipWritingToNodeList = true; - // The ViewStateData's source location should be valid, because - // before each EndObject, its SourceLocation is injected. - // If not, an exception will be thrown from constructor - // of SourceLocation. - sourceLocation = new SourceLocation(null, - viewStateDataSourceLocation[0], - viewStateDataSourceLocation[1], - viewStateDataSourceLocation[2], - viewStateDataSourceLocation[3] - ); - } - - Array.Clear(viewStateDataSourceLocation, 0, viewStateDataSourceLocation.Length); - break; - }; - - if (!skipWritingToNodeList && !skippingUnexpectedAttachedProperty) - { - if (shouldPassLineInfo) - { - lineInfoComsumer.SetLineInfo(lineInfo.LineNumber, lineInfo.LinePosition); - } - - viewStateNodes.Writer.WriteNode(xamlReader); - } - - if (skippingUnexpectedAttachedPropertyLevel == 0) - { - skippingUnexpectedAttachedProperty = false; - } - } - viewStateNodes.Writer.Close(); - } - - private static int GetViewStateDataSourceLocationIndexFromCurrentReader(XamlReader xamlReader) - { - if (xamlReader.NodeType != XamlNodeType.StartMember - || xamlReader.Member == null - || xamlReader.Member.UnderlyingMember == null - || xamlReader.Member.UnderlyingMember.DeclaringType != typeof(XamlDebuggerXmlReader)) - { - return -1; - } - - // if UnderlineType is XamlDebuggerXmlReader, see if it - // is one of {StartLine, StartColumn, EndLine, EndColumn} - return SourceLocationNames.IndexOf(xamlReader.Member.Name); - } - - // This class is used for tracking Xaml nodestream data. - class Frame - { - // IdRef value if any associated with the node. - public string IdRef { get; set; } - - // XamlType of the node. Helps generating IdRef values. - public XamlType Type { get; set; } - - // XamlNodes corresponding to viewstate related attached property nodes. - public XamlNodeList AttachedPropertyNodes { get; set; } - - // Underlying CLR object. Used to attach generated IdRef values - // when serializing workflow definition. - public object InstanceObject { get; set; } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/WorkflowDesignerXamlHelper.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/WorkflowDesignerXamlHelper.cs deleted file mode 100644 index a6c511cbcbe..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/WorkflowDesignerXamlHelper.cs +++ /dev/null @@ -1,701 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Activities; - using System.Activities.Debugger; - using System.Activities.Debugger.Symbol; - using System.Activities.Presentation; - using System.Activities.Presentation.ViewState; - using System.Activities.Presentation.Xaml; - using System.Activities.XamlIntegration; - using System.Collections; - using System.Collections.Generic; - using System.Diagnostics; - using System.Globalization; - using System.IO; - using System.Runtime.Versioning; - using System.Xaml; - - internal class WorkflowDesignerXamlHelper - { - private IWorkflowDesignerXamlHelperExecutionContext executionContext; - - private XamlMember dynamicActivityPropertyNameMember; - - private XamlMember dynamicActivityPropertyValueMember; - - internal WorkflowDesignerXamlHelper(IWorkflowDesignerXamlHelperExecutionContext executionContext) - { - this.executionContext = executionContext; - SharedFx.Assert(this.executionContext != null, "this.executionContext != null"); - SharedFx.Assert(this.executionContext.XamlSchemaContext != null, "this.executionContext.XamlSchemaContext != null"); - - this.dynamicActivityPropertyNameMember = new XamlMember(typeof(DynamicActivityProperty).GetProperty("Name"), this.XamlSchemaContext); - this.dynamicActivityPropertyValueMember = new XamlMember(typeof(DynamicActivityProperty).GetProperty("Value"), this.XamlSchemaContext); - } - - private delegate void SourceLocationFoundCallback(object obj, SourceLocation sourceLocation); - - internal enum DeserializationMode - { - Default, - ErrorTolerant, - } - - public FrameworkName FrameworkName - { - get { return this.executionContext.FrameworkName; } - } - - public WorkflowDesignerXamlSchemaContext XamlSchemaContext - { - get { return this.executionContext.XamlSchemaContext; } - } - - public ViewStateIdManager IdManager - { - get { return this.executionContext.IdManager; } - } - - public WorkflowSymbol LastWorkflowSymbol - { - get - { - return this.executionContext.LastWorkflowSymbol; - } - - set - { - this.executionContext.LastWorkflowSymbol = value; - } - } - - public string LocalAssemblyName - { - get { return this.executionContext.LocalAssemblyName; } - } - - public void OnSerializationCompleted(Dictionary sourceLocationObjectToModelItemObjectMapping) - { - this.executionContext.OnSerializationCompleted(sourceLocationObjectToModelItemObjectMapping); - } - - public void OnBeforeDeserialize() - { - this.executionContext.OnBeforeDeserialize(); - } - - public void OnSourceLocationFound(object target, SourceLocation sourceLocation) - { - this.executionContext.OnSourceLocationFound(target, sourceLocation); - } - - public void OnAfterDeserialize(Dictionary viewStateDataSourceLocationMapping) - { - this.executionContext.OnAfterDeserialize(viewStateDataSourceLocationMapping); - } - - // Get root Activity. Currently only handle when the object is ActivityBuilder or Activity. - // May return null if it does not know how to get the root activity. - internal static Activity GetRootWorkflowElement(object rootModelObject) - { - SharedFx.Assert(rootModelObject != null, "Cannot pass null as rootModelObject"); - Activity rootWorkflowElement; - IDebuggableWorkflowTree debuggableWorkflowTree = rootModelObject as IDebuggableWorkflowTree; - if (debuggableWorkflowTree != null) - { - rootWorkflowElement = debuggableWorkflowTree.GetWorkflowRoot(); - } - else - { - // Loose xaml case. - rootWorkflowElement = rootModelObject as Activity; - } - - return rootWorkflowElement; - } - - internal static Activity GetRootElementForSymbol(object rootInstance, Activity documentRootElement) - { - ActivityBuilder activityBuilder = rootInstance as ActivityBuilder; - if (activityBuilder != null) - { - documentRootElement = activityBuilder.ConvertToDynamicActivity(); - } - - return documentRootElement; - } - - // Copy the root namespaces from a reader to a writer. - // DesignTimeXamlWriter follows proper XAML convention by omitting the assembly name from - // clr-namespaces in the local assembly. However, VB Expressions aren't local-assembly-aware, - // and require an assembly name. So for every clr-namespace with no assembly name, we add an - // additional namespace record with an assembly name, to support VB. - // We only do this at the root level, since the designer only writes out namespaces at the root level. - internal void CopyNamespacesAndAddLocalAssembly(System.Xaml.XamlReader activityBuilderReader, System.Xaml.XamlWriter objectWriter) - { - // Designer loads alwas provide line info - IXamlLineInfo lineInfo = (IXamlLineInfo)activityBuilderReader; - IXamlLineInfoConsumer lineInfoConsumer = (IXamlLineInfoConsumer)objectWriter; - HashSet definedPrefixes = new HashSet(); - List localAsmNamespaces = null; - - while (activityBuilderReader.Read()) - { - lineInfoConsumer.SetLineInfo(lineInfo.LineNumber, lineInfo.LinePosition); - - if (activityBuilderReader.NodeType == XamlNodeType.NamespaceDeclaration) - { - definedPrefixes.Add(activityBuilderReader.Namespace.Prefix); - if (this.XamlSchemaContext.IsClrNamespaceWithNoAssembly(activityBuilderReader.Namespace.Namespace)) - { - if (localAsmNamespaces == null) - { - localAsmNamespaces = new List(); - } - - localAsmNamespaces.Add(activityBuilderReader.Namespace); - } - - objectWriter.WriteNode(activityBuilderReader); - } - else - { - if (localAsmNamespaces != null) - { - foreach (NamespaceDeclaration ns in localAsmNamespaces) - { - string prefix = null; - int i = 0; - do - { - i++; - prefix = ns.Prefix + i.ToString(CultureInfo.InvariantCulture); - } - while (definedPrefixes.Contains(prefix)); - string fullNs = this.XamlSchemaContext.AddLocalAssembly(ns.Namespace); - objectWriter.WriteNamespace(new NamespaceDeclaration(fullNs, prefix)); - definedPrefixes.Add(prefix); - } - } - - objectWriter.WriteNode(activityBuilderReader); - return; - } - } - } - - internal string SerializeToString(object obj, string fileName) - { - FrameworkName targetFramework = this.FrameworkName; - - string sourceFile = null; - Activity rootWorkflowElement = GetRootWorkflowElement(obj); - Dictionary modelItemObjectSequence = null; - - // If the current target is 4.5 or Higher, let us not write the filename attribute as DebugSymbol eliminates the need for it. - // We will serialize without the Filename by removing it from the element and adding it back after serialization - if (targetFramework.Is45OrHigher()) - { - if (AttachablePropertyServices.TryGetProperty(rootWorkflowElement, XamlDebuggerXmlReader.FileNameName, out sourceFile)) - { - AttachablePropertyServices.RemoveProperty(rootWorkflowElement, XamlDebuggerXmlReader.FileNameName); - } - } - - TextWriter textWriter = new StringWriter(CultureInfo.InvariantCulture); - - WorkflowDesignerXamlSchemaContext schemaContext = obj is ActivityBuilder ? this.XamlSchemaContext : new WorkflowDesignerXamlSchemaContext(null); - - bool shouldWriteDebugSymbol = true; - if (targetFramework.IsLessThan45()) - { - shouldWriteDebugSymbol = false; - } - - System.Xaml.XamlReader outerReader; - XamlObjectReaderWithSequence innerReader; - - using (textWriter) - { - UsingXamlWriter( - new DesignTimeXamlWriter(textWriter, schemaContext, shouldWriteDebugSymbol), - delegate(DesignTimeXamlWriter designTimeXamlWriter) - { - UsingXamlWriter( - ActivityXamlServices.CreateBuilderWriter(designTimeXamlWriter), - delegate(System.Xaml.XamlWriter activityBuilderWriter) - { - UsingXamlWriter( - new ActivityTemplateFactoryBuilderWriter(activityBuilderWriter, schemaContext), - delegate(System.Xaml.XamlWriter writer) - { - // If ViewStateManager property is attached, remove it. It needs to be regenerated if we target 4.5. - // It should be removed if we're targeting 4.0. - AttachablePropertyServices.RemoveProperty(obj, WorkflowViewState.ViewStateManagerProperty); - - this.CreateXamlObjectReaders(obj, schemaContext, out outerReader, out innerReader); - - using (innerReader) - { - using (outerReader) - { -#if ERROR_TOLERANT_SUPPORT - if (ErrorActivity.GetHasErrorActivities(obj)) - { - ErrorTolerantObjectWriter.TransformAndStripErrors(outerReader, writer); - } - else - { -#endif - XamlServices.Transform(outerReader, writer); -#if ERROR_TOLERANT_SUPPORT - } -#endif - } - } - - modelItemObjectSequence = innerReader.SequenceNumberToObjectMap; - }); - }); - }); - } - - string retVal = textWriter.ToString(); - - if (targetFramework.IsLessThan45()) - { - if (sourceFile != null) - { - XamlDebuggerXmlReader.SetFileName(rootWorkflowElement, sourceFile); - } - } - - IList loadErrors; - Dictionary sourceLocations; - object deserializedObject = this.DeserializeString(retVal, out loadErrors, out sourceLocations); - - if (!string.IsNullOrEmpty(fileName) && targetFramework.Is45OrHigher()) - { - this.LastWorkflowSymbol = this.GetWorkflowSymbol(fileName, deserializedObject, sourceLocations); - if (this.LastWorkflowSymbol != null) - { - retVal = retVal.Replace(DesignTimeXamlWriter.EmptyWorkflowSymbol, this.LastWorkflowSymbol.Encode()); - } - } - - // The symbol is actually removed in GetAttachedWorkflowSymbol() after deserialization completes. - System.Xaml.AttachablePropertyServices.RemoveProperty(GetRootWorkflowElement(deserializedObject), DebugSymbol.SymbolName); - this.CreateXamlObjectReaders(deserializedObject, schemaContext, out outerReader, out innerReader); - Dictionary sourceLocationObjectToModelItemObjectMapping = new Dictionary(ObjectReferenceEqualityComparer.Default); - using (innerReader) - { - using (outerReader) - { - while (outerReader.Read()) - { - } - - Dictionary sourceLocationObjectSequence = innerReader.SequenceNumberToObjectMap; - foreach (KeyValuePair sourceLocationObjectEntry in sourceLocationObjectSequence) - { - int key = sourceLocationObjectEntry.Key; - object sourceLocationObject = sourceLocationObjectEntry.Value; - object modelItemObject; - - if (modelItemObjectSequence.TryGetValue(key, out modelItemObject)) - { - sourceLocationObjectToModelItemObjectMapping.Add(sourceLocationObject, modelItemObject); - } - } - } - } - - this.OnSerializationCompleted(sourceLocationObjectToModelItemObjectMapping); - return retVal; - } - - internal void CreateXamlObjectReaders(object deserializedObject, XamlSchemaContext schemaContext, out XamlReader newWorkflowReader, out XamlObjectReaderWithSequence deserializedObjectSequenceBuilder) - { - deserializedObjectSequenceBuilder = new XamlObjectReaderWithSequence(deserializedObject, schemaContext); - if (this.FrameworkName.Is45OrHigher()) - { - newWorkflowReader = ViewStateXamlHelper.ConvertAttachedPropertiesToViewState(deserializedObjectSequenceBuilder, this.IdManager); - } - else - { - newWorkflowReader = ViewStateXamlHelper.RemoveIdRefs(deserializedObjectSequenceBuilder); - } - } - - internal object DeserializeString(string text) - { - IList loadErrors; - Dictionary sourceLocations; - return this.DeserializeString(text, out loadErrors, out sourceLocations); - } - - internal object DeserializeString(string text, out IList loadErrors, out Dictionary sourceLocations) - { - try - { - return this.DeserializeString(text, DeserializationMode.Default, out loadErrors, out sourceLocations); - } - catch (XamlObjectWriterException) - { - // Fall back to error-tolerant path. We don't do this by default for perf reasons. - return this.DeserializeString(text, DeserializationMode.ErrorTolerant, out loadErrors, out sourceLocations); - } - } - - //// XAML writer may throw exception during dispose, therefore the following code will cause exception masking - //// - //// using (XamlWriter xamlWriter) - //// { - //// ... - //// } - //// - //// If there are any exception A thrown within the block, and if xamlWriter.Dispose() throws an exception B - //// The exception B will mask exception A and the exception is the ErrorTolerant scenario will be broken. - //// - //// The fix to this problem is to ---- any XamlException thrown during Dispose(), we are in general not - //// interested in those exceptions. - private static void UsingXamlWriter(T xamlWriter, Action work) where T : XamlWriter - { - if (xamlWriter != null) - { - try - { - work(xamlWriter); - } - finally - { - try - { - xamlWriter.Close(); - } - catch (XamlException e) - { - // ignore any XAML exception during closing a XamlWriter - Trace.WriteLine(e.Message); - } - } - } - } - - // there are two kind of attribute: - // 1) in lined : argument="some value" - // 2) - // - // - // here, for (1) return the source location of "some value". - // for (2) return null - private static SourceLocation GetInlineAttributeValueLocation(LineColumnPair startPoint, SourceTextScanner sourceTextScanner) - { - const char SingleQuote = '\''; - const char DoubleQuote = '"'; - const char StartAngleBracket = '<'; - Tuple start = sourceTextScanner.SearchCharAfter(startPoint, SingleQuote, DoubleQuote, StartAngleBracket); - if (start == null) - { - return null; - } - - if (start.Item2 == StartAngleBracket) - { - return null; - } - - Tuple end = sourceTextScanner.SearchCharAfter(start.Item1, start.Item2); - if (end == null) - { - SharedFx.Assert("end of SourceLocation is not found"); - return null; - } - - return new SourceLocation(null, start.Item1.LineNumber, start.Item1.ColumnNumber, end.Item1.LineNumber, end.Item1.ColumnNumber); - } - - private WorkflowSymbol GetWorkflowSymbol(string fileName, object deserializedObject, Dictionary sourceLocations) - { - if (deserializedObject != null) - { - Activity deserializedRootElement = GetRootWorkflowElement(deserializedObject); - if (deserializedRootElement != null) - { - try - { - deserializedRootElement = GetRootElementForSymbol(deserializedObject, deserializedRootElement); - return new WorkflowSymbol - { - FileName = fileName, - Symbols = SourceLocationProvider.GetSymbols(deserializedRootElement, sourceLocations) - }; - } - catch (Exception ex) - { - if (SharedFx.IsFatal(ex)) - { - throw; - } - - // This happens when the workflow is invalid so GetSymbols fails. - // ---- exception here. - } - } - } - - return null; - } - - private object DeserializeString(string text, DeserializationMode mode, out IList loadErrors, out Dictionary sourceLocations) - { - object result = null; - loadErrors = null; - Dictionary collectingSourceLocations = new Dictionary(ObjectReferenceEqualityComparer.Default); - SourceLocationFoundCallback sourceLocationFoundCallback = new SourceLocationFoundCallback((obj, sourceLocation) => - { - // If an object appear more than once in the XAML stream (e.g. System.Type, which is cached by reflection) - // we count the first occurrence. - if (!collectingSourceLocations.ContainsKey(obj)) - { - collectingSourceLocations.Add(obj, sourceLocation); - } - - this.OnSourceLocationFound(obj, sourceLocation); - }); - - this.XamlSchemaContext.ContainsConversionRequiredType = false; - Dictionary viewStateDataSourceLocationMapping = null; - using (XamlDebuggerXmlReader debuggerReader = new XamlDebuggerXmlReader(new StringReader(text), this.XamlSchemaContext)) - { - using (System.Xaml.XamlReader activityBuilderReader = ActivityXamlServices.CreateBuilderReader(debuggerReader)) - { - using (System.Xaml.XamlReader activityTemplateFactoryBuilderReader = new ActivityTemplateFactoryBuilderReader(activityBuilderReader, this.XamlSchemaContext)) - { - debuggerReader.SourceLocationFound += delegate(object sender, SourceLocationFoundEventArgs args) - { - sourceLocationFoundCallback(args.Target, args.SourceLocation); - }; - - this.OnBeforeDeserialize(); - debuggerReader.CollectNonActivitySourceLocation = this.FrameworkName.Is45OrHigher(); - - using (System.Xaml.XamlReader reader = ViewStateXamlHelper.ConvertViewStateToAttachedProperties(activityTemplateFactoryBuilderReader, this.IdManager, out viewStateDataSourceLocationMapping)) - { - switch (mode) - { -#if ERROR_TOLERANT_SUPPORT - case DeserializationMode.ErrorTolerant: - { - ErrorTolerantObjectWriter tolerantWriter = new ErrorTolerantObjectWriter(reader.SchemaContext); - tolerantWriter.LocalAssemblyName = this.LocalAssemblyName; - XamlServices.Transform(reader, tolerantWriter); - loadErrors = this.CheckFileFormatError(tolerantWriter.LoadErrors); - result = tolerantWriter.Result; - ErrorActivity.SetHasErrorActivities(result, true); - } - - break; -#endif - case DeserializationMode.Default: - { - result = this.TransformAndGetPropertySourceLocation(reader, new SourceTextScanner(text), sourceLocationFoundCallback); - - loadErrors = this.CheckFileFormatError(loadErrors); - } - - break; - } - } - } - } - } - - sourceLocations = collectingSourceLocations; - this.OnAfterDeserialize(viewStateDataSourceLocationMapping); - return result; - } - - // For dynamic activity property, we needs to collect the source location of - // its default value when the value is inlined. - private KeyValuePair TransformDynamicActivityProperty( - XamlReader reader, - XamlObjectWriter objectWriter, - SourceTextScanner sourceTextScanner) - { - // (Number of SM -Number of EM) since SM DAP.Name is read. - // SO DAP ---nameReadingLevel=0 - // SM NAME ---nameReadingLevel=1 - // SO String ---nameReadingLevel=1 - // SM Initialize ---nameReadingLevel=2 - // VA StringValue ---nameReadingLevel=2 - // EM ---nameReadingLevel=1 - // SO ---nameReadingLevel=1 - // EM ---nameReadingLevel=0 - // EO ---nameReadingLevel=0 - int nameReadingLevel = 0; - - IXamlLineInfo lineInfo = (IXamlLineInfo)reader; - SourceLocation defaultValueLocation = null; - string propertyName = null; - - while (reader.Read()) - { - switch (reader.NodeType) - { - case XamlNodeType.StartMember: - if (nameReadingLevel > 0 - || reader.Member == this.dynamicActivityPropertyNameMember) - { - ++nameReadingLevel; - } - else if (reader.Member == this.dynamicActivityPropertyValueMember) - { - LineColumnPair startPoint = new LineColumnPair(lineInfo.LineNumber, lineInfo.LinePosition); - defaultValueLocation = GetInlineAttributeValueLocation(startPoint, sourceTextScanner); - } - - break; - - case XamlNodeType.EndMember: - if (nameReadingLevel > 0) - { - --nameReadingLevel; - } - - break; - - case XamlNodeType.Value: - if (nameReadingLevel > 0) - { - propertyName = reader.Value as string; - } - - break; - } - - objectWriter.WriteNode(reader); - } - - if (propertyName != null && defaultValueLocation != null) - { - return new KeyValuePair(propertyName, defaultValueLocation); - } - - return new KeyValuePair(); - } - - private object TransformAndGetPropertySourceLocation(XamlReader reader, SourceTextScanner sourceTextScanner, SourceLocationFoundCallback sourceLocationFoundCallback) - { - // - Dictionary propertyValueLocationMapping = new Dictionary(); - - object deserializedObject = null; - object earlyResult = null; - - UsingXamlWriter( - new XamlObjectWriter(reader.SchemaContext), - delegate(XamlObjectWriter objectWriter) - { - if (this.XamlSchemaContext.HasLocalAssembly) - { - this.CopyNamespacesAndAddLocalAssembly(reader, objectWriter); - } - - if (!(reader is IXamlLineInfo)) - { - XamlServices.Transform(reader, objectWriter); - earlyResult = objectWriter.Result; - return; - } - - XamlType dynamicActivityPropertyType = this.XamlSchemaContext.GetXamlType(typeof(DynamicActivityProperty)); - while (reader.Read()) - { - // read SubTree will moves the reader pointed to - // element after its EO. So, we need to use a while - while (!reader.IsEof && reader.NodeType == XamlNodeType.StartObject - && dynamicActivityPropertyType == reader.Type) - { - KeyValuePair nameSourceLocation = this.TransformDynamicActivityProperty(reader.ReadSubtree(), objectWriter, sourceTextScanner); - if (nameSourceLocation.Key != null && nameSourceLocation.Value != null && !propertyValueLocationMapping.ContainsKey(nameSourceLocation.Key)) - { - propertyValueLocationMapping.Add(nameSourceLocation.Key, nameSourceLocation.Value); - } - } - - if (!reader.IsEof) - { - objectWriter.WriteNode(reader); - } - } - - deserializedObject = objectWriter.Result; - }); - - if (earlyResult != null) - { - return earlyResult; - } - - ActivityBuilder activityBuilder = deserializedObject as ActivityBuilder; - if (activityBuilder == null) - { - return deserializedObject; - } - - foreach (KeyValuePair propertyValueLocation in propertyValueLocationMapping) - { - string propertyName = propertyValueLocation.Key; - SourceLocation propertyLocation = propertyValueLocation.Value; - if (!activityBuilder.Properties.Contains(propertyName)) - { - SharedFx.Assert(string.Format(CultureInfo.CurrentCulture, "no such property:{0}", propertyName)); - continue; - } - - DynamicActivityProperty property = activityBuilder.Properties[propertyName]; - - if (property == null || property.Value == null) - { - SharedFx.Assert(string.Format(CultureInfo.CurrentCulture, "no such property value:{0}", propertyName)); - continue; - } - - object expression = (property.Value is Argument) ? ((Argument)property.Value).Expression : null; - if (expression != null) - { - sourceLocationFoundCallback(expression, propertyLocation); - } - else - { - sourceLocationFoundCallback(property.Value, propertyLocation); - } - } - - return deserializedObject; - } - - private IList CheckFileFormatError(IList loadErrors) - { - IList result = loadErrors; - - if (this.XamlSchemaContext.ContainsConversionRequiredType) - { - if (result == null) - { - result = new List(); - } - - result.Add(new XamlLoadErrorInfo(SharedSR.FileFormatError, 0, 0)); - } - - return result; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/WorkflowDesignerXamlSchemaContext.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/WorkflowDesignerXamlSchemaContext.cs deleted file mode 100644 index 6eff79e501c..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/WorkflowDesignerXamlSchemaContext.cs +++ /dev/null @@ -1,274 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Activities.Presentation; - using System.Activities.Presentation.Hosting; - using System.Activities.Presentation.Xaml; - using System.Collections.Generic; - using System.ComponentModel; - using System.ComponentModel.Composition; - using System.Diagnostics.CodeAnalysis; - using System.Linq; - using System.Reflection; - using System.Runtime.CompilerServices; - using System.Runtime.Versioning; - using System.Xaml; - using Microsoft.Activities.Presentation; - - class WorkflowDesignerXamlSchemaContext : XamlSchemaContext - { - //post fix for xml namespace defined by CLR namespace in local assembly - readonly string localAssemblyNsPostfix; - readonly string localAssemblyNsPostfixNoLeadingSemicolon; - // Cache of custom XamlTypes - Dictionary customXamlTypes; - EditingContext editingContext; - bool environmentAssembliesLoaded; - private readonly static FrameworkName CurrentFramework = FrameworkNameConstants.NetFramework45; - private ResolverCache resolverCache; - - private static List supportedTypes; - private static List conversionRequiredTypes; - - [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")] - static WorkflowDesignerXamlSchemaContext() - { - supportedTypes = new List(); - supportedTypes.Add(typeof(System.Activities.Presentation.Expressions.ExpressionActivityEditor)); - supportedTypes.Add(typeof(System.Activities.Presentation.Annotations.Annotation)); - - conversionRequiredTypes = new List(); - conversionRequiredTypes.Add(typeof(System.Activities.Expressions.TextExpression)); - conversionRequiredTypes.Add(typeof(System.Activities.Expressions.AssemblyReference)); - conversionRequiredTypes.Add(typeof(System.Collections.ObjectModel.Collection)); - conversionRequiredTypes.Add(typeof(System.Activities.Debugger.Symbol.DebugSymbol)); - conversionRequiredTypes.Add(typeof(System.Activities.Presentation.ViewState.WorkflowViewState)); - conversionRequiredTypes.Add(typeof(System.Activities.Presentation.ViewState.ViewStateManager)); - conversionRequiredTypes.Add(typeof(System.Activities.Presentation.ViewState.ViewStateData)); - } - - public WorkflowDesignerXamlSchemaContext(string localAssembly) : this(localAssembly, null) - { - } - - public WorkflowDesignerXamlSchemaContext(string localAssembly, EditingContext editingContext) - { - if (!string.IsNullOrEmpty(localAssembly)) - { - this.localAssemblyNsPostfix = XamlNamespaceHelper.ClrNamespaceAssemblyField + localAssembly; - this.localAssemblyNsPostfixNoLeadingSemicolon = localAssemblyNsPostfix.Substring(1); - } - this.editingContext = editingContext; - } - - internal bool ContainsConversionRequiredType { get; set; } - - protected override XamlType GetXamlType(string xamlNamespace, string name, params XamlType[] typeArguments) - { - if (!string.IsNullOrEmpty(this.localAssemblyNsPostfix) - && IsClrNamespaceWithNoAssembly(xamlNamespace)) - { - xamlNamespace = AddLocalAssembly(xamlNamespace); - } - - var xamlType = base.GetXamlType(xamlNamespace, name, typeArguments); - - if (xamlType == null && environmentAssembliesLoaded == false && editingContext != null) - { - // Failed to find the type, this might because the namespace is a custom namespace - // and the dependent assembly hasn't been loaded yet. Load all dependent assemblies - // and try to load the same xaml type again. - AssemblyContextControlItem assemblyItem = this.editingContext.Items.GetValue(); - var environmentAssemblies = assemblyItem.GetEnvironmentAssemblies(null); - if (assemblyItem.LocalAssemblyName != null) - { - AssemblyContextControlItem.GetAssembly(assemblyItem.LocalAssemblyName, null); - } - - environmentAssembliesLoaded = true; - xamlType = base.GetXamlType(xamlNamespace, name, typeArguments); - } - - if (xamlType == null || xamlType.UnderlyingType == null || this.editingContext == null) - { - return xamlType; - } - - MultiTargetingSupportService multiTargetingService = editingContext.Services.GetService() as MultiTargetingSupportService; - DesignerConfigurationService config = editingContext.Services.GetService(); - if (multiTargetingService == null || config == null) - { - return xamlType; - } - - // do not filter out new types and new properties if targeting to current framework and it's a full SKU - if (config.TargetFrameworkName.Version == CurrentFramework.Version && config.TargetFrameworkName.IsFullProfile()) - { - return xamlType; - } - - // Filter out new types and new properties - if (this.resolverCache == null) - { - this.resolverCache = new ResolverCache(); - } - - if (supportedTypes.Contains(xamlType.UnderlyingType)) - { - return xamlType; - } - - // only check if conversion is needed when target framework is less than 4.5 - if (config.TargetFrameworkName.Version < CurrentFramework.Version) - { - if (conversionRequiredTypes.Contains(xamlType.UnderlyingType)) - { - this.ContainsConversionRequiredType = true; - return xamlType; - } - } - - ResolverResult resolverResult = this.resolverCache.Lookup(xamlType.UnderlyingType); - if (resolverResult == null) - { - resolverResult = MultiTargetingTypeResolver.Resolve(multiTargetingService, xamlType.UnderlyingType); - this.resolverCache.Update(xamlType.UnderlyingType, resolverResult); - } - - return MultiTargetingTypeResolver.GetXamlType(resolverResult, xamlType); - } - - public override XamlType GetXamlType(Type type) - { - XamlType xamlType = null; - if (this.customXamlTypes != null && this.customXamlTypes.TryGetValue(type, out xamlType)) - { - return xamlType; - } - bool isCustom = false; - xamlType = GetCustomType(type); - if (xamlType != null) - { - isCustom = true; - } - else - { - xamlType = base.GetXamlType(type); - if (xamlType.GetXamlNamespaces().Any(ns => IsClrNamespaceInLocalAssembly(ns))) - { - isCustom = true; - xamlType = new XamlTypeWithExplicitNamespace(xamlType, xamlType.GetXamlNamespaces().Select(ns => IsClrNamespaceInLocalAssembly(ns) ? TrimLocalAssembly(ns) : ns)); - } - } - if (isCustom) - { - if (this.customXamlTypes == null) - { - this.customXamlTypes = new Dictionary(); - } - this.customXamlTypes[type] = xamlType; - } - return xamlType; - } - - public override IEnumerable GetAllXamlNamespaces() - { - foreach (string ns in base.GetAllXamlNamespaces()) - { - if (IsClrNamespaceInLocalAssembly(ns)) - { - yield return TrimLocalAssembly(ns); - } - else - { - yield return ns; - } - } - } - - internal bool HasLocalAssembly - { - get { return !string.IsNullOrEmpty(this.localAssemblyNsPostfix); } - } - - internal string AddLocalAssembly(string ns) - { - string result = ns; - // clr-namespace:X.Y.Z ==> clr-namespace:X.Y.Z;assembly=MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - if (result[result.Length - 1] != ';') - { - result += this.localAssemblyNsPostfix; - } - else - { - result += this.localAssemblyNsPostfixNoLeadingSemicolon; - } - return result; - } - - internal bool IsClrNamespaceWithNoAssembly(string ns) - { - //could be more sophisticated with a RegEx, but let's keep it simple for now - return ns.StartsWith(XamlNamespaceHelper.ClrNamespacePrefix, StringComparison.OrdinalIgnoreCase) && - ns.IndexOf(XamlNamespaceHelper.ClrNamespaceAssemblyField, StringComparison.OrdinalIgnoreCase) == -1; - } - - internal bool IsClrNamespaceInLocalAssembly(string ns) - { - //could be more sophisticated with a RegEx, but let's keep it simple for now - - return !string.IsNullOrEmpty(this.localAssemblyNsPostfix) && ns.EndsWith(this.localAssemblyNsPostfix, StringComparison.OrdinalIgnoreCase); - } - - internal string TrimLocalAssembly(string ns) - { - return string.IsNullOrEmpty(this.localAssemblyNsPostfix) ? ns : ns.Substring(0, ns.Length - this.localAssemblyNsPostfix.Length); - } - - XamlType GetCustomType(Type type) - { - if (type == typeof(DesignerAttribute)) - { - return new AttributeXamlType(this); - } - if (type == typeof(EditorAttribute)) - { - return new AttributeXamlType(this); - } - if (type == typeof(DefaultValueAttribute)) - { - return new AttributeXamlType(this); - } - if (type.Namespace == "System.ComponentModel.Composition") - { - return GetCustomMefType(type); - } -#if ERROR_TOLERANT_SUPPORT - if (ErrorTolerantObjectWriter.IsErrorActivity(type)) - { - return new ShimAsPublicXamlType(type, this); - } -#endif - return null; - } - - // Avoid loading System.ComponentModel.Composition unless we need it - [MethodImpl(MethodImplOptions.NoInlining)] - XamlType GetCustomMefType(Type type) - { - if (type == typeof(ImportAttribute)) - { - return new AttributeXamlType(this); - } - if (type == typeof(ImportManyAttribute)) - { - return new AttributeXamlType(this); - } - return null; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlNamespaceHelper.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlNamespaceHelper.cs deleted file mode 100644 index 70d08a3ef7a..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlNamespaceHelper.cs +++ /dev/null @@ -1,35 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - - internal class XamlNamespaceHelper - { - internal const string ClrNamespacePrefix = "clr-namespace:"; - internal const string ClrNamespaceAssemblyField = ";assembly="; - - internal static bool TryParseClrNsUri(string xamlNamespace, out string clrNamespace, out string assembly) - { - clrNamespace = null; - assembly = null; - if (!xamlNamespace.StartsWith(ClrNamespacePrefix, StringComparison.Ordinal)) - { - return false; - } - int clrNsIndex = ClrNamespacePrefix.Length; - int assemblyIndex = xamlNamespace.IndexOf(ClrNamespaceAssemblyField, StringComparison.Ordinal); - if (assemblyIndex < clrNsIndex) - { - clrNamespace = xamlNamespace.Substring(clrNsIndex); - return true; - } - clrNamespace = xamlNamespace.Substring(clrNsIndex, assemblyIndex - clrNsIndex); - assemblyIndex += ClrNamespaceAssemblyField.Length; - assembly = xamlNamespace.Substring(assemblyIndex); - return true; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlObjectReaderWithSequence.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlObjectReaderWithSequence.cs deleted file mode 100644 index 05db903f355..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlObjectReaderWithSequence.cs +++ /dev/null @@ -1,167 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System.Activities; - using System.Activities.XamlIntegration; - using System.Collections.Generic; - using System.Reflection; - using System.Xaml; - - internal sealed class XamlObjectReaderWithSequence : XamlObjectReader - { - private int sequenceNumber; - private Dictionary sequenceNumberToObjectMap; - private HashSet visitedObjects; - - private Stack objects = new Stack(); - private XamlMember xamlMember = null; - - public XamlObjectReaderWithSequence(object instance, XamlSchemaContext schemaContext) - : base(instance, schemaContext) - { - } - - public Dictionary SequenceNumberToObjectMap - { - get - { - if (this.sequenceNumberToObjectMap == null) - { - this.sequenceNumberToObjectMap = new Dictionary(); - } - - return this.sequenceNumberToObjectMap; - } - } - - private HashSet VisitedObjects - { - get - { - if (this.visitedObjects == null) - { - this.visitedObjects = new HashSet(); - } - - return this.visitedObjects; - } - } - - public override bool Read() - { - bool readResult = base.Read(); - - if (readResult) - { - switch (this.NodeType) - { - case XamlNodeType.StartObject: - this.objects.Push(this.Instance); - this.MapObjectWithSequenceNumber(this.Instance); - break; - case XamlNodeType.GetObject: - this.objects.Push(this.Instance); - break; - case XamlNodeType.EndObject: - this.objects.Pop(); - break; - case XamlNodeType.StartMember: - this.xamlMember = this.Member; - break; - case XamlNodeType.EndMember: - this.xamlMember = null; - break; - case XamlNodeType.Value: - this.MapObjectWithSequenceNumber(this.GetRealObject()); - break; - } - } - - return readResult; - } - - // Current Node contains the value after original object is serialized to a ValueNode, this method - // try to get the original object before it is serialized. - private object GetRealObject() - { - if (this.Value is string) - { - object parent = this.objects.Peek(); - - if (parent == null) - { - return null; - } - - // handle [expression] - if (this.xamlMember == XamlLanguage.Initialization) - { - Argument argument = parent as Argument; - if (argument != null) - { - return argument.Expression; - } - - return null; - } - - if (this.xamlMember == null || !this.xamlMember.IsNameValid || this.xamlMember.IsAttachable || this.xamlMember.IsDirective) - { - return null; - } - - // handle 1..., type is not limited to x:Int32 - // Here property.DeclaringType would be ArrayExtension, while parent would be a real array (System.Int32[]), - // calling property.GetValue(parent, null) would cause a TargetException since the type and object doesn't match. - // So stop further processing for ArrayExtension. - if (this.xamlMember.DeclaringType == XamlLanguage.Array) - { - // We can get the element type by parent.GetType().GetElementType(), - // but we really don't care about that, so just return null. - return null; - } - - PropertyInfo property = this.xamlMember.UnderlyingMember as PropertyInfo; - - if (property == null || !property.CanRead) - { - return null; - } - - object realObject = property.GetValue(parent, null); - - // NOTE this is to handle argument containing an IValueSerializable expression - // this logic should be kept the same as that in System.Activities.Debugger.XamlDebuggerXmlReader.NotifySourceLocationFound. - Argument argumentObject = realObject as Argument; - if (argumentObject != null && argumentObject.Expression is IValueSerializableExpression) - { - realObject = argumentObject.Expression; - } - - return realObject; - } - - return this.Value; - } - - private void MapObjectWithSequenceNumber(object mappedObject) - { - if (mappedObject == null) - { - return; - } - - if (!this.VisitedObjects.Contains(mappedObject) && !(mappedObject is string)) - { - this.VisitedObjects.Add(mappedObject); - this.SequenceNumberToObjectMap.Add(this.sequenceNumber, mappedObject); - this.sequenceNumber++; - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlTypeKind.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlTypeKind.cs deleted file mode 100644 index bf1bf11343f..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlTypeKind.cs +++ /dev/null @@ -1,15 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace Microsoft.Activities.Presentation.Xaml -{ - internal enum XamlTypeKind - { - Unknown, // I don't understand this type - PartialSupported, // I understand this type if you would like to remove some new properties - FullySupported, // I understand this type - } -} \ No newline at end of file diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlTypeWithExplicitNamespace.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlTypeWithExplicitNamespace.cs deleted file mode 100644 index 45150081e80..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlTypeWithExplicitNamespace.cs +++ /dev/null @@ -1,25 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System.Collections.Generic; - using System.Xaml; - - class XamlTypeWithExplicitNamespace : XamlType - { - List explicitNamespaces; - - public XamlTypeWithExplicitNamespace(XamlType wrapped, IEnumerable explicitNamespaces) : - base(wrapped.UnderlyingType, wrapped.SchemaContext) - { - this.explicitNamespaces = new List(explicitNamespaces); - } - - public override IList GetXamlNamespaces() - { - return this.explicitNamespaces; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlTypeWithExtraPropertiesRemoved.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlTypeWithExtraPropertiesRemoved.cs deleted file mode 100644 index f021f98badd..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlTypeWithExtraPropertiesRemoved.cs +++ /dev/null @@ -1,49 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Xaml; - - internal class XamlTypeWithExtraPropertiesRemoved : XamlType - { - private ICollection propertiesToBeRemoved; - - public XamlTypeWithExtraPropertiesRemoved(Type underlyingType, XamlSchemaContext schemaContext, ICollection propertiesToBeRemoved) - : base(underlyingType, schemaContext) - { - this.propertiesToBeRemoved = propertiesToBeRemoved; - } - - protected override XamlMember LookupMember(string name, bool skipReadOnlyCheck) - { - if (this.propertiesToBeRemoved.Contains(name)) - { - return null; - } - - return base.LookupMember(name, skipReadOnlyCheck); - } - - protected override IEnumerable LookupAllMembers() - { - List members = new List(); - - foreach (XamlMember member in base.LookupAllMembers()) - { - if (!this.propertiesToBeRemoved.Contains(member.Name)) - { - members.Add(member); - } - } - - return members; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlWriterExtensions.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlWriterExtensions.cs deleted file mode 100644 index 8b73e31c731..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/XamlWriterExtensions.cs +++ /dev/null @@ -1,110 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities.Presentation.Xaml -{ - using System.Xaml; - - // - internal static class XamlWriterExtensions - { - public static void PropagateLineInfo(XamlWriter targetWriter, IXamlLineInfo lineInfo) - { - if (lineInfo != null) - { - IXamlLineInfoConsumer consumer = targetWriter as IXamlLineInfoConsumer; - SharedFx.Assert(consumer != null && consumer.ShouldProvideLineInfo, "Should only call this function to write into a XamlNodeQueue.Writer, which is always IXamlLineInfoConsumer"); - consumer.SetLineInfo(lineInfo.LineNumber, lineInfo.LinePosition); - } - } - - public static void PropagateLineInfo(XamlWriter targetWriter, int lineNumber, int linePosition) - { - IXamlLineInfoConsumer consumer = targetWriter as IXamlLineInfoConsumer; - SharedFx.Assert(consumer != null && consumer.ShouldProvideLineInfo, "Should only call this function to write into a XamlNodeQueue.Writer, which is always IXamlLineInfoConsumer"); - consumer.SetLineInfo(lineNumber, linePosition); - } - - // This method is a workaround for TFS bug #788190, since XamlReader.ReadSubtree() should (but doesn't) preserve IXamlLineInfo on the subreader - public static void Transform(XamlReader reader, XamlWriter writer, IXamlLineInfo readerLineInfo, bool closeWriter) - { - IXamlLineInfoConsumer consumer = writer as IXamlLineInfoConsumer; - SharedFx.Assert(consumer != null && consumer.ShouldProvideLineInfo, "Should only call this function to write into a XamlNodeQueue.Writer, which is always IXamlLineInfoConsumer"); - bool shouldPassLineNumberInfo = false; - if (readerLineInfo != null) - { - shouldPassLineNumberInfo = true; - } - - while (reader.Read()) - { - if (shouldPassLineNumberInfo) - { - consumer.SetLineInfo(readerLineInfo.LineNumber, readerLineInfo.LinePosition); - } - - writer.WriteNode(reader); - } - - if (closeWriter) - { - writer.Close(); - } - } - - public static void WriteNode(this XamlWriter writer, XamlReader reader, IXamlLineInfo lineInfo) - { - PropagateLineInfo(writer, lineInfo); - writer.WriteNode(reader); - } - - public static void WriteEndMember(this XamlWriter writer, IXamlLineInfo lineInfo) - { - PropagateLineInfo(writer, lineInfo); - writer.WriteEndMember(); - } - - public static void WriteEndObject(this XamlWriter writer, IXamlLineInfo lineInfo) - { - PropagateLineInfo(writer, lineInfo); - writer.WriteEndObject(); - } - - public static void WriteGetObject(this XamlWriter writer, IXamlLineInfo lineInfo) - { - PropagateLineInfo(writer, lineInfo); - writer.WriteGetObject(); - } - - public static void WriteNamespace(this XamlWriter writer, NamespaceDeclaration namespaceDeclaration, IXamlLineInfo lineInfo) - { - PropagateLineInfo(writer, lineInfo); - writer.WriteNamespace(namespaceDeclaration); - } - - public static void WriteStartMember(this XamlWriter writer, XamlMember xamlMember, IXamlLineInfo lineInfo) - { - PropagateLineInfo(writer, lineInfo); - writer.WriteStartMember(xamlMember); - } - - public static void WriteStartMember(this XamlWriter writer, XamlMember xamlMember, int lineNumber, int linePosition) - { - PropagateLineInfo(writer, lineNumber, linePosition); - writer.WriteStartMember(xamlMember); - } - - public static void WriteStartObject(this XamlWriter writer, XamlType type, IXamlLineInfo lineInfo) - { - PropagateLineInfo(writer, lineInfo); - writer.WriteStartObject(type); - } - - public static void WriteValue(this XamlWriter writer, object value, IXamlLineInfo lineInfo) - { - PropagateLineInfo(writer, lineInfo); - writer.WriteValue(value); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Tools/Common/Win32Interop.cs b/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Tools/Common/Win32Interop.cs deleted file mode 100644 index 7386f8367f5..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Tools/Common/Win32Interop.cs +++ /dev/null @@ -1,118 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- - -namespace Microsoft.Tools.Common -{ - using System; - using System.Runtime.InteropServices; - using System.Diagnostics.CodeAnalysis; - - - internal static class Win32Interop - { - public const int WM_SETICON = 0x80; - public const int WM_NCHITTEST = 0x84; - public const int WM_SYSCOMMAND = 0x0112; - - public const int GWL_STYLE = -16; - public const int WS_MAXIMIZEBOX = 0x00010000; - public const int WS_MINIMIZEBOX = 0x00020000; - public const int WS_CLIPCHILDREN = 0x02000000; - public const int WS_CLIPSIBLINGS = 0x04000000; - - public const int GWL_EXSTYLE = -20; - public const int WS_EX_DLGMODALFRAME = 0x00000001; - public const int WS_EX_CONTEXTHELP = 0x00000400; - - public const int SC_CONTEXTHELP = 0xf180; - - public const int ICON_SMALL = 0; - public const int ICON_BIG = 1; - - - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "This class is shared by various projects and may not be used by a specific project")] - [StructLayout(LayoutKind.Sequential)] - public sealed class POINT - { - public int x; - public int y; - - public POINT() - { - this.x = 0; - this.y = 0; - } - - public POINT(int x, int y) - { - this.x = x; - this.y = y; - } - } - - internal static void MakeWindowClipSiblingsAndChildren(HandleRef hwnd) - { - IntPtr windowStyle = Win32Interop.GetWindowLongPtr(hwnd.Handle, Win32Interop.GWL_STYLE); - if (IntPtr.Size == 4) - { - windowStyle = new IntPtr(windowStyle.ToInt32() | Win32Interop.WS_CLIPSIBLINGS | Win32Interop.WS_CLIPCHILDREN); - } - else - { - windowStyle = new IntPtr(windowStyle.ToInt64() | ((long)Win32Interop.WS_CLIPSIBLINGS) | ((long)Win32Interop.WS_CLIPCHILDREN)); - } - Win32Interop.SetWindowLongPtr(hwnd, Win32Interop.GWL_STYLE, (IntPtr)windowStyle); - } - - // This static method is required because legacy OSes do not support - // SetWindowLongPtr - internal static IntPtr SetWindowLongPtr(HandleRef hWnd, int nIndex, IntPtr dwNewLong) - { - if (IntPtr.Size == 8) - return SetWindowLongPtr64(hWnd, nIndex, dwNewLong); - else - return new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32())); - } - - - // This static method is required because Win32 does not support - // GetWindowLongPtr directly - public static IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex) - { - if (IntPtr.Size == 8) - return GetWindowLongPtr64(hWnd, nIndex); - else - return GetWindowLongPtr32(hWnd, nIndex); - } - - [DllImport("user32.dll", EntryPoint = "SetWindowLong")] - private static extern int SetWindowLong32(HandleRef hWnd, int nIndex, int dwNewLong); - - [DllImport("user32.dll", EntryPoint = "SetWindowLongPtr")] - private static extern IntPtr SetWindowLongPtr64(HandleRef hWnd, int nIndex, IntPtr dwNewLong); - - [SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", MessageId = "return", Justification = "Calling code is expected to handle the different size of IntPtr")] - [DllImport("user32.dll", EntryPoint = "GetWindowLong")] - private static extern IntPtr GetWindowLongPtr32(IntPtr hWnd, int nIndex); - - [DllImport("user32.dll", EntryPoint = "GetWindowLongPtr")] - private static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, int nIndex); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "This function is shared by various projects and may not be used by a specific project")] - [DllImport("user32.dll")] - public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "This function is shared by various projects and may not be used by a specific project")] - [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] - public static extern IntPtr GetActiveWindow(); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "This function is shared by various projects and may not be used by a specific project")] - [System.Runtime.InteropServices.DllImport("gdi32.dll")] - public static extern bool DeleteObject(IntPtr hObject); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "This function is shared by various projects and may not be used by a specific project")] - [DllImport("User32", EntryPoint = "ScreenToClient", SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] - public static extern int ScreenToClient(IntPtr hWnd, [In, Out] POINT pt); - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/README.md b/mcs/class/referencesource/System.Activities.Presentation/README.md new file mode 100644 index 00000000000..a7d7bf795b4 --- /dev/null +++ b/mcs/class/referencesource/System.Activities.Presentation/README.md @@ -0,0 +1,4 @@ +This folder was removed from Mono's copy of referencesource +since the long file/directory paths caused issues on Windows. + +Check the upstream referencesource repo for the original code. diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/AssemblyInfo.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/AssemblyInfo.cs deleted file mode 100644 index ca3227c27a7..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/AssemblyInfo.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.CompilerServices; -using System.Windows; -using System.Windows.Markup; -using System.Diagnostics.CodeAnalysis; - -[assembly: XmlnsDefinition(NameSpaces.Toolbox, "System.Activities.Presentation.Toolbox")] -[assembly: XmlnsDefinition(NameSpaces.Design, "System.Activities.Presentation")] -[assembly: XmlnsDefinition(NameSpaces.Design, "System.Activities.Presentation.View")] -[assembly: XmlnsDefinition(NameSpaces.Design2010, "System.Activities.Presentation.Annotations")] -[assembly: XmlnsDefinition(NameSpaces.Design2010, "System.Activities.Presentation.Expressions")] -[assembly: XmlnsDefinition(NameSpaces.Design2010, "System.Activities.Presentation.ViewState")] -[assembly: XmlnsPrefix(NameSpaces.Design, NameSpaces.DesignPrefix)] -[assembly: XmlnsPrefix(NameSpaces.Design2010, NameSpaces.Design2010Prefix)] -[assembly: XmlnsPrefix(NameSpaces.Mc, NameSpaces.McPrefix)] - -[assembly: InternalsVisibleTo("CIT.System.Activities.Core.Design, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly: InternalsVisibleTo("System.Activities.Core.Presentation, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly: InternalsVisibleTo("System.Activities.Presentation.UnitTest, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] - -[assembly: ThemeInfo(ResourceDictionaryLocation.SourceAssembly, ResourceDictionaryLocation.SourceAssembly)] -[assembly: SuppressMessage("Microsoft.MSInternal", "CA904:DeclareTypesInMicrosoftOrSystemNamespace", Scope = "namespace", Target = "XamlGeneratedNamespace", Justification = "Xaml Generated")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "System.Activities.Presentation.Sqm", Justification = "False positive for SQM")] diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/Microsoft/Activities/Presentation/SharedFx.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/Microsoft/Activities/Presentation/SharedFx.cs deleted file mode 100644 index b070aeaff1e..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/Microsoft/Activities/Presentation/SharedFx.cs +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -namespace Microsoft.Activities -{ - using System; - using System.Runtime; - - internal static class SharedFx - { - internal static bool IsFatal(Exception exception) - { - return Fx.IsFatal(exception); - } - - internal static void Assert(bool condition, string messageText) - { - Fx.Assert(condition, messageText); - } - - internal static void Assert(string messageText) - { - Fx.Assert(messageText); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/Microsoft/Activities/Presentation/SharedSR.Designer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/Microsoft/Activities/Presentation/SharedSR.Designer.cs deleted file mode 100644 index f499130c255..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/Microsoft/Activities/Presentation/SharedSR.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Activities.Presentation { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class SharedSR { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal SharedSR() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Activities.Presentation.Microsoft.Activities.Presentation.SharedSR", typeof(SharedSR).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to The file format is not compatible with current targeting framework. To convert the file format, please explicitly save the file. This error message will go away after you save the file and reopen the designer.. - /// - internal static string FileFormatError { - get { - return ResourceManager.GetString("FileFormatError", resourceCulture); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/SR.Designer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/SR.Designer.cs deleted file mode 100644 index 44e2b3b4ab1..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/SR.Designer.cs +++ /dev/null @@ -1,1174 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.17273 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace System.Activities.Presentation { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class SR { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal SR() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Activities.Presentation.SR", typeof(SR).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Activity could not be loaded because of errors in the XAML.. - /// - internal static string ActivityLoadError { - get { - return ResourceManager.GetString("ActivityLoadError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Add Annotation. - /// - internal static string AddAnnotationDescription { - get { - return ResourceManager.GetString("AddAnnotationDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Add Annotation. - /// - internal static string AddAnnotationTitle { - get { - return ResourceManager.GetString("AddAnnotationTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The Getter method of an Argument Accessor for Activity '{0}' threw an exception: - ///{1}. - /// - internal static string ArgumentAccessorGetterThrewException { - get { - return ResourceManager.GetString("ArgumentAccessorGetterThrewException", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The Setter method of an Argument Accessor for Activity '{0}' threw an exception: - ///{1}. - /// - internal static string ArgumentAccessorSetterThrewException { - get { - return ResourceManager.GetString("ArgumentAccessorSetterThrewException", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Attached property's name should not be empty or null.. - /// - internal static string AttachedPropertyNameShouldNotBeEmpty { - get { - return ResourceManager.GetString("AttachedPropertyNameShouldNotBeEmpty", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Bounds must have non zero width and height.. - /// - internal static string BoundsMustBeNonZero { - get { - return ResourceManager.GetString("BoundsMustBeNonZero", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Cannot construct line segment between point {0} and point {1}.. - /// - internal static string CannotConstructConnectionSegment { - get { - return ResourceManager.GetString("CannotConstructConnectionSegment", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Cannot create an instance of "{0}".. - /// - internal static string CannotCreateInstance { - get { - return ResourceManager.GetString("CannotCreateInstance", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Failed to get Argument Accessors from Activity '{0}' - ///{1}.. - /// - internal static string CannotGetArgumentAccessorsForActivity { - get { - return ResourceManager.GetString("CannotGetArgumentAccessorsForActivity", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Some data would be lost by changing type argument. Do you want to continue?. - /// - internal static string CannotMorphExpression { - get { - return ResourceManager.GetString("CannotMorphExpression", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The default value will be cleared with this change, do you want to continue?. - /// - internal static string CannotPreserveDefaultValue { - get { - return ResourceManager.GetString("CannotPreserveDefaultValue", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Namespace '{0}' cannot be resolved.. - /// - internal static string CannotResolveNamespace { - get { - return ResourceManager.GetString("CannotResolveNamespace", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Cannot enable annotation when target framework is lower than 4.5. - /// - internal static string CantEnableAnnotationBefore45 { - get { - return ResourceManager.GetString("CantEnableAnnotationBefore45", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to One or more children have validation errors or warnings.. - /// - internal static string ChildValidationError { - get { - return ResourceManager.GetString("ChildValidationError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Collection Add. - /// - internal static string CollectionAddEditingScopeDescription { - get { - return ResourceManager.GetString("CollectionAddEditingScopeDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Collection Clear. - /// - internal static string CollectionClearEditingScopeDescription { - get { - return ResourceManager.GetString("CollectionClearEditingScopeDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Collection is read-only.. - /// - internal static string CollectionIsReadOnly { - get { - return ResourceManager.GetString("CollectionIsReadOnly", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Collection Remove. - /// - internal static string CollectionRemoveEditingScopeDescription { - get { - return ResourceManager.GetString("CollectionRemoveEditingScopeDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not change value after initialization.. - /// - internal static string CouldNotChangeValueAfterInitialization { - get { - return ResourceManager.GetString("CouldNotChangeValueAfterInitialization", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not generate view for {0}.. - /// - internal static string CouldNotGenerateView { - get { - return ResourceManager.GetString("CouldNotGenerateView", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to This property could not be set after workflow designer is loaded. To fix the problem, please set this property before loading the workflow designer.. - /// - internal static string CouldNotSetPropertyAfterLoad { - get { - return ResourceManager.GetString("CouldNotSetPropertyAfterLoad", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Activities that cannot be rendered in the designer cannot be cut or copied.. - /// - internal static string CutCopyErrorActivityMessage { - get { - return ResourceManager.GetString("CutCopyErrorActivityMessage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Cut-copy-paste feature requires DesignerView to be present.. - /// - internal static string CutCopyRequiresDesignerView { - get { - return ResourceManager.GetString("CutCopyRequiresDesignerView", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Cut. - /// - internal static string CutOperationEditingScopeDescription { - get { - return ResourceManager.GetString("CutOperationEditingScopeDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to http://msdn.microsoft.com/library/dd489402.aspx. - /// - internal static string DefaultHelpUrl { - get { - return ResourceManager.GetString("DefaultHelpUrl", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Are you sure you want to delete all annotations in the workflow?. - /// - internal static string DeleteAllAnnotationMessage { - get { - return ResourceManager.GetString("DeleteAllAnnotationMessage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Delete All Annotations. - /// - internal static string DeleteAllAnnotationsDescription { - get { - return ResourceManager.GetString("DeleteAllAnnotationsDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Delete Annotation. - /// - internal static string DeleteAnnotationDescription { - get { - return ResourceManager.GetString("DeleteAnnotationDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Delete Annotation. - /// - internal static string DeleteAnnotationTitle { - get { - return ResourceManager.GetString("DeleteAnnotationTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Delete. - /// - internal static string DeleteOperationEditingScopeDescription { - get { - return ResourceManager.GetString("DeleteOperationEditingScopeDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to DesignTimeValidationFeature '{0}' could only apply to type '{1}', not type '{2}'.. - /// - internal static string DesignTimeValidationFeatureOnlyAppliesToType { - get { - return ResourceManager.GetString("DesignTimeValidationFeatureOnlyAppliesToType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Dictionary Add. - /// - internal static string DictionaryAddEditingScopeDescription { - get { - return ResourceManager.GetString("DictionaryAddEditingScopeDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Dictionary Clear. - /// - internal static string DictionaryClearEditingScopeDescription { - get { - return ResourceManager.GetString("DictionaryClearEditingScopeDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Dictionary Edit. - /// - internal static string DictionaryEditEditingScopeDescription { - get { - return ResourceManager.GetString("DictionaryEditEditingScopeDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Dictionary Remove. - /// - internal static string DictionaryRemoveEditingScopeDescription { - get { - return ResourceManager.GetString("DictionaryRemoveEditingScopeDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Multiple items are dragged and dropped. DragDropHelper.SetDragDropMovedViewElements should have been called to indicate the WorkflowViewElements that are moved.. - /// - internal static string DraggingMulitpleItemsError { - get { - return ResourceManager.GetString("DraggingMulitpleItemsError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to There is already an argument named '{0}' defined. Please choose a different name.. - /// - internal static string DuplicateArgumentName { - get { - return ResourceManager.GetString("DuplicateArgumentName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to '{0}' is already declared in this scope. Identifiers are case-insensitive.. - /// - internal static string DuplicateIdentifier { - get { - return ResourceManager.GetString("DuplicateIdentifier", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to An item with the same key has already been added.. - /// - internal static string DuplicateKey { - get { - return ResourceManager.GetString("DuplicateKey", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Member '{0}' has already been set on this object.. - /// - internal static string DuplicateMember { - get { - return ResourceManager.GetString("DuplicateMember", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Duplicate name: '{0}'.. - /// - internal static string DuplicateName { - get { - return ResourceManager.GetString("DuplicateName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to There is already a variable named '{0}' in this scope. Please choose a different name.. - /// - internal static string DuplicateVariableName { - get { - return ResourceManager.GetString("DuplicateVariableName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Edit Annotation. - /// - internal static string EditAnnotationTitle { - get { - return ResourceManager.GetString("EditAnnotationTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Element representation expected. - /// - internal static string ElementRepresentationExpected { - get { - return ResourceManager.GetString("ElementRepresentationExpected", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Element representation expected at {0}, {1}. - /// - internal static string ElementRepresentationExpectedAt { - get { - return ResourceManager.GetString("ElementRepresentationExpectedAt", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Argument cannot have empty name.. - /// - internal static string EmptyArgumentName { - get { - return ResourceManager.GetString("EmptyArgumentName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Variable cannot have empty name.. - /// - internal static string EmptyVariableName { - get { - return ResourceManager.GetString("EmptyVariableName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalidate return value from SortSelectedItems. The items returned must be the same as the items passed in except the order. - /// - internal static string Error_BadOutputFromSortSelectedItems { - get { - return ResourceManager.GetString("Error_BadOutputFromSortSelectedItems", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Trying to sort some item that is not in the view.. - /// - internal static string Error_CantFindItemInWIsP { - get { - return ResourceManager.GetString("Error_CantFindItemInWIsP", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Item '{0}' is not on view.. - /// - internal static string Error_ItemNotOnView { - get { - return ResourceManager.GetString("Error_ItemNotOnView", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Moving more than one items from ICompositeView. Implement OnItemsMoved in ICompositeView.. - /// - internal static string Error_MovingMoreThanOneItemsFromICompositeView { - get { - return ResourceManager.GetString("Error_MovingMoreThanOneItemsFromICompositeView", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to '{0}' doesn't have public default constructor which is required for a valid custom ExpressionActivityEditor.. - /// - internal static string ExpressionActivityEditorRequiresDefaultConstructor { - get { - return ResourceManager.GetString("ExpressionActivityEditorRequiresDefaultConstructor", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Enter a VB expression. - /// - internal static string ExpressionDefaultText { - get { - return ResourceManager.GetString("ExpressionDefaultText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Cannot convert the generated expression from type ‘{0}’ to ‘{1}’.. - /// - internal static string ExpressionTypeDonnotMatch { - get { - return ResourceManager.GetString("ExpressionTypeDonnotMatch", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Parameterless construction is not supported.. - /// - internal static string InvalidConstructorCall { - get { - return ResourceManager.GetString("InvalidConstructorCall", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0} is not a valid expression editor name, which cannot be null or white spaces only.. - /// - internal static string InvalidExpressionEditorName { - get { - return ResourceManager.GetString("InvalidExpressionEditorName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0} is not a valid expression editor name, which cannot be white spaces only.. - /// - internal static string InvalidExpressionEditorNameToSet { - get { - return ResourceManager.GetString("InvalidExpressionEditorNameToSet", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0} is not a valid expression editor type, which must be a derived class of {1}.. - /// - internal static string InvalidExpressionEditorType { - get { - return ResourceManager.GetString("InvalidExpressionEditorType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0} is not a valid type, which must be a derive class of {1}.. - /// - internal static string InvalidExpressionMorphHelperType { - get { - return ResourceManager.GetString("InvalidExpressionMorphHelperType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0} is not a valid value for {1}.. - /// - internal static string InvalidFlagName { - get { - return ResourceManager.GetString("InvalidFlagName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to '{0}' is not a valid identifier. It may contain invalid characters or it is a reserved keyword.. - /// - internal static string InvalidIdentifier { - get { - return ResourceManager.GetString("InvalidIdentifier", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Call to BeginEdit() with shouldApplyChangesImmediately=true cannot be nested inside another EditingScope or another call to BeginEdit().. - /// - internal static string InvalidNestedModelItemBeginEditExceptionMessage { - get { - return ResourceManager.GetString("InvalidNestedModelItemBeginEditExceptionMessage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to '{0}' is not a valid XAML member name.. - /// - internal static string InvalidXamlMemberName { - get { - return ResourceManager.GetString("InvalidXamlMemberName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The given key was not present in the dictionary. - /// - internal static string KeyNotFound { - get { - return ResourceManager.GetString("KeyNotFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Member '{0}' already has content.. - /// - internal static string MemberCanOnlyBeSetOnce { - get { - return ResourceManager.GetString("MemberCanOnlyBeSetOnce", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Incorrect Xaml Encountered. Attachable member '{0}' can only be set on types assignable from '{1}'. - /// - internal static string MemberOnBadTargetType { - get { - return ResourceManager.GetString("MemberOnBadTargetType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to "path" should contain at least one element.. - /// - internal static string ModelItemPathArrayShouldNotBeEmpty { - get { - return ResourceManager.GetString("ModelItemPathArrayShouldNotBeEmpty", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Item Move. - /// - internal static string MoveEditingScopeDescription { - get { - return ResourceManager.GetString("MoveEditingScopeDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Element of NamespaceList must be NamespaceData.. - /// - internal static string NamespaceListArgumentMustBeNamespaceData { - get { - return ResourceManager.GetString("NamespaceListArgumentMustBeNamespaceData", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to NamespaceList could not accept duplicate namespaces.. - /// - internal static string NamespaceListNoDuplicate { - get { - return ResourceManager.GetString("NamespaceListNoDuplicate", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Default parameterless constructor not found.. - /// - internal static string NoDefaultCtorError { - get { - return ResourceManager.GetString("NoDefaultCtorError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Cannot find an expression editor named '{0}'. . - /// - internal static string NonRegisteredExpressionEditor { - get { - return ResourceManager.GetString("NonRegisteredExpressionEditor", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Argument key is not of type string.. - /// - internal static string NonSupportedDynamicArgumentKeyType { - get { - return ResourceManager.GetString("NonSupportedDynamicArgumentKeyType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Argument type of parameters is not supported.. - /// - internal static string NonSupportedDynamicArgumentType { - get { - return ResourceManager.GetString("NonSupportedDynamicArgumentType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Data input of the dialog is neither ModelItemCollection nor ModelItemDictionary.. - /// - internal static string NonSupportedModelItemCollectionOrDictionary { - get { - return ResourceManager.GetString("NonSupportedModelItemCollectionOrDictionary", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to ModelPropertyPathExpanderConverter doesn't support converting path string back to ModelProperty.. - /// - internal static string NonSupportedModelPropertyPathExpanderConverterConvertBack { - get { - return ResourceManager.GetString("NonSupportedModelPropertyPathExpanderConverterConvertBack", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Collection '{0}' does not support text content.. - /// - internal static string NoTextInCollection { - get { - return ResourceManager.GetString("NoTextInCollection", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Type '{0}' is not assignable to type '{1}' of member '{2}' and there is no TypeConverter defined on the member.. - /// - internal static string NoTextInProperty { - get { - return ResourceManager.GetString("NoTextInProperty", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Notify Annotation Text Changed. - /// - internal static string NotifyAnnotationTextChangedDescription { - get { - return ResourceManager.GetString("NotifyAnnotationTextChangedDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The framework identifier '{0}' is not supported in the workflow designer. Please use '.NET Framework' or '.NETFramework' as identifier.. - /// - internal static string NotSupportedFrameworkIdentifier { - get { - return ResourceManager.GetString("NotSupportedFrameworkIdentifier", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The framework profile '{0}' is not supported in the workflow designer. Please use empty or 'Client' as profile value.. - /// - internal static string NotSupportedFrameworkProfile { - get { - return ResourceManager.GetString("NotSupportedFrameworkProfile", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The .Net Framework {0} is not supported in the workflow designer.. - /// - internal static string NotSupportedFrameworkVersion { - get { - return ResourceManager.GetString("NotSupportedFrameworkVersion", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Type '{0}' is not a valid toolbox type. Reason: {1}. - /// - internal static string NotSupportedToolboxTypeFormatString { - get { - return ResourceManager.GetString("NotSupportedToolboxTypeFormatString", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Type '{0}' cannot be initialized with text content because it does not have a TypeConverter.. - /// - internal static string NoTypeConverter { - get { - return ResourceManager.GetString("NoTypeConverter", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Paste. - /// - internal static string PasteUndoDescription { - get { - return ResourceManager.GetString("PasteUndoDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Cannot find ShowInOutlineViewAttribute promoted property '{0}' on type: '{1}'. Specify an existing property of type: '{1}' as promoted property. If this promoted property is not required, remove it from ShowInOutlineViewAttribute() constructor.. - /// - internal static string PromotedPropertyNotFound { - get { - return ResourceManager.GetString("PromotedPropertyNotFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Property Change. - /// - internal static string PropertyChangeEditingScopeDescription { - get { - return ResourceManager.GetString("PropertyChangeEditingScopeDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Property '{0}' does not exist. - /// - internal static string PropertyDoesntExistFormatString { - get { - return ResourceManager.GetString("PropertyDoesntExistFormatString", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Property is read-only.. - /// - internal static string PropertyIsReadOnly { - get { - return ResourceManager.GetString("PropertyIsReadOnly", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Property Reference Change. - /// - internal static string PropertyReferenceChangeEditingScopeDescription { - get { - return ResourceManager.GetString("PropertyReferenceChangeEditingScopeDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Found in property '{0}'. - /// - internal static string SearchHintText { - get { - return ResourceManager.GetString("SearchHintText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to See the Error List window for more details.. - /// - internal static string SeeErrorWindow { - get { - return ResourceManager.GetString("SeeErrorWindow", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The provided SourceReferenceID '{0}' could not be found in the workflow.. - /// - internal static string SourceReferenceIdNotFoundInWorkflow { - get { - return ResourceManager.GetString("SourceReferenceIdNotFoundInWorkflow", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Cannot modify ToolName or AssemblyName of already initialized ToolboxItem.. - /// - internal static string ToolboxItemFrozenDescription { - get { - return ResourceManager.GetString("ToolboxItemFrozenDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The selected type could not be created.. - /// - internal static string TypeBrowserError { - get { - return ResourceManager.GetString("TypeBrowserError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Type Browser. - /// - internal static string TypeBrowserErrorMessageTitle { - get { - return ResourceManager.GetString("TypeBrowserErrorMessageTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The supplied type '{0}' does not inherit from System.Activities.Activity.. - /// - internal static string TypeDoesNotInheritFromActivity { - get { - return ResourceManager.GetString("TypeDoesNotInheritFromActivity", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Not all generic types could be resolved.. - /// - internal static string TypeResolverError { - get { - return ResourceManager.GetString("TypeResolverError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Type Resolver. - /// - internal static string TypeResolverErrorMessageTitle { - get { - return ResourceManager.GetString("TypeResolverErrorMessageTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Select Types. - /// - internal static string TypeResolverWindowTitle { - get { - return ResourceManager.GetString("TypeResolverWindowTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to defaultTypes should not contain null.. - /// - internal static string TypeResolvingOptionsArgumentExceptionMessage { - get { - return ResourceManager.GetString("TypeResolvingOptionsArgumentExceptionMessage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Type '{0}' is not assignable to item type '{1}' nor any other content type of collection '{2}'.. - /// - internal static string UnassignableCollection { - get { - return ResourceManager.GetString("UnassignableCollection", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Type '{0}' is not assignable to type '{1}' of member '{2}'.. - /// - internal static string UnassignableObject { - get { - return ResourceManager.GetString("UnassignableObject", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Bookmark is garbage collected without being committed or rolled back.. - /// - internal static string UndoEngine_NotDisposedBookmark { - get { - return ResourceManager.GetString("UndoEngine_NotDisposedBookmark", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Operation '{0}' not allowed on disposed object.. - /// - internal static string UndoEngine_OperationNotAllowed { - get { - return ResourceManager.GetString("UndoEngine_OperationNotAllowed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Type '{0}' does not have a suitable TypeConverter or content property to handle this content.. - /// - internal static string UnknownContent { - get { - return ResourceManager.GetString("UnknownContent", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not resolve type '{0}' because could not find one or more of its type arguments.. - /// - internal static string UnresolvedGenericType { - get { - return ResourceManager.GetString("UnresolvedGenericType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not find member '{0}' in type '{1}'.. - /// - internal static string UnresolvedMember { - get { - return ResourceManager.GetString("UnresolvedMember", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not resolve name: '{0}'.. - /// - internal static string UnresolvedName { - get { - return ResourceManager.GetString("UnresolvedName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not find type '{0}' in assembly '{1}'.. - /// - internal static string UnresolvedTypeInAssembly { - get { - return ResourceManager.GetString("UnresolvedTypeInAssembly", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not find type '{0}' in namespace '{1}'.. - /// - internal static string UnresolvedTypeInNamespace { - get { - return ResourceManager.GetString("UnresolvedTypeInNamespace", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Value was set in XAML.. - /// - internal static string UnsupportedExpressionHintText { - get { - return ResourceManager.GetString("UnsupportedExpressionHintText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The file '{0}' may have come from a location that isn't fully trusted. It could present a security risk by opening the file that could cause damage to your computer or compromise your private information. - ///To avoid this exception, please do the security check first (you can refer this link http://msdn.microsoft.com/library/system.security.permissionset.aspx to get information about IsUnrestricted check) and turn on LoadingFromUntrustedSourceEnabled by setting DesignerConfigurationService.LoadingFromUntruste [rest of string was truncated]";. - /// - internal static string UntrustedSourceDetected { - get { - return ResourceManager.GetString("UntrustedSourceDetected", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Update parameters. - /// - internal static string UpdateDynamicArgumentsDescription { - get { - return ResourceManager.GetString("UpdateDynamicArgumentsDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Design time validation is turned off. Validation occurs only at runtime. To validate your workflow, either enable validation by modifying the registry key[HKCU\Software\Microsoft\.NETFramework\v[assembly version]\System.Activities.Presentation\DisableValidateOnModelItemChanged] and reopening the designer or call ActivityValidationServices.Validate() on an instance of your workflow.. - /// - internal static string ValidationDisabledWarning { - get { - return ResourceManager.GetString("ValidationDisabledWarning", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to View State Change. - /// - internal static string ViewStateUndoUnitDescription { - get { - return ResourceManager.GetString("ViewStateUndoUnitDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Warning: {0}. - /// - internal static string WarningFormat { - get { - return ResourceManager.GetString("WarningFormat", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Workflow Designer. - /// - internal static string WorkflowDesignerErrorPresenterTitle { - get { - return ResourceManager.GetString("WorkflowDesignerErrorPresenterTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Load should be called before calling this method.. - /// - internal static string WorkflowDesignerLoadShouldBeCalledFirst { - get { - return ResourceManager.GetString("WorkflowDesignerLoadShouldBeCalledFirst", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Load should be called only once during the lifetime of a workflow designer object.. - /// - internal static string WorkflowDesignerLoadShouldBeCalledOnlyOnce { - get { - return ResourceManager.GetString("WorkflowDesignerLoadShouldBeCalledOnlyOnce", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Value of Text property should not be empty or null.. - /// - internal static string WorkflowDesignerTextShouldNotBeNull { - get { - return ResourceManager.GetString("WorkflowDesignerTextShouldNotBeNull", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Wrap in Sequence. - /// - internal static string WrapInSequenceDescription { - get { - return ResourceManager.GetString("WrapInSequenceDescription", resourceCulture); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegateInfo.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegateInfo.cs deleted file mode 100644 index 15cf387d574..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegateInfo.cs +++ /dev/null @@ -1,43 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation -{ - using System.Activities.Presentation.Metadata; - using System.Activities.Presentation.Model; - - internal class ActivityDelegateInfo : IActivityDelegateFactory - { - public ActivityDelegateInfo(ModelItem modelItem, string propertyName) - { - this.ModelItem = modelItem; - this.PropertyName = propertyName; - this.DelegateType = this.ModelItem.Properties[this.PropertyName].PropertyType; - } - - public ModelItem ModelItem { get; private set; } - - public string PropertyName { get; private set; } - - public Type DelegateType { get; private set; } - - public EditingContext EditingContext - { - get - { - return this.ModelItem.GetEditingContext(); - } - } - - public ActivityDelegate Create() - { - ActivityDelegate delegateObject = Activator.CreateInstance(this.DelegateType) as ActivityDelegate; - ActivityDelegateMetadata metadata = ActivityDelegateUtilities.GetMetadata(this.DelegateType); - ActivityDelegateUtilities.FillDelegate(delegateObject, metadata); - return delegateObject; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegateInfoPresenter.xaml.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegateInfoPresenter.xaml.cs deleted file mode 100644 index aecdc3ee29b..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegateInfoPresenter.xaml.cs +++ /dev/null @@ -1,54 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation -{ - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - - internal partial class ActivityDelegateInfoPresenter : UserControl - { - public static readonly DependencyProperty DelegateInfoProperty = DependencyProperty.Register("DelegateInfo", typeof(ActivityDelegateInfo), typeof(ActivityDelegateInfoPresenter), new PropertyMetadata(new PropertyChangedCallback(OnDelegateInfoChanged))); - - public ActivityDelegateInfoPresenter() - { - this.InitializeComponent(); - } - - public ActivityDelegateInfo DelegateInfo - { - get - { - return (ActivityDelegateInfo)GetValue(DelegateInfoProperty); - } - - set - { - SetValue(DelegateInfoProperty, value); - } - } - - private static void OnDelegateInfoChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) - { - ActivityDelegateInfoPresenter presenter = sender as ActivityDelegateInfoPresenter; - - presenter.OnDelegateInfoChanged(); - } - - private void OnDelegateInfoChanged() - { - if (this.DelegateInfo != null) - { - Binding binding = new Binding(this.DelegateInfo.PropertyName); - binding.Source = this.DelegateInfo.ModelItem; - binding.Mode = BindingMode.TwoWay; - - this.activityDelegatePresenter.SetBinding(ActivityDelegatePresenter.ActivityDelegateProperty, binding); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegatePresenter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegatePresenter.cs deleted file mode 100644 index 005e3e8e3a7..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegatePresenter.cs +++ /dev/null @@ -1,196 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation -{ - using System.Activities.Presentation.Metadata; - using System.Activities.Presentation.Model; - using System.Activities.Statements; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Reflection; - using System.Runtime; - using System.Windows; - using System.Windows.Controls; - using Microsoft.Activities.Presentation; - - internal class ActivityDelegatePresenter : Control - { - public static readonly DependencyProperty EditingContextProperty = DependencyProperty.Register("EditingContext", typeof(EditingContext), typeof(ActivityDelegatePresenter)); - public static readonly DependencyProperty FactoryProperty = DependencyProperty.Register("Factory", typeof(IActivityDelegateFactory), typeof(ActivityDelegatePresenter)); - - public static readonly DependencyProperty ActivityDelegateProperty = DependencyProperty.Register("ActivityDelegate", typeof(ModelItem), typeof(ActivityDelegatePresenter), new PropertyMetadata(new PropertyChangedCallback(ActivityDelegatePresenter.OnActivityDelegateChanged))); - public static readonly DependencyProperty HandlerProperty = DependencyProperty.Register("Handler", typeof(ModelItem), typeof(ActivityDelegatePresenter), new PropertyMetadata(new PropertyChangedCallback(ActivityDelegatePresenter.OnHandlerChanged))); - public static readonly DependencyProperty ArgumentsProperty = DependencyProperty.Register("Arguments", typeof(ObservableCollection), typeof(ActivityDelegatePresenter)); - - private bool isSetInternally; - - [SuppressMessage(FxCop.Category.Performance, FxCop.Rule.InitializeReferenceTypeStaticFieldsInline, - Justification = "Calls to OverrideMetadata for a dependency property should be done in the static constructor.")] - static ActivityDelegatePresenter() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(ActivityDelegatePresenter), new FrameworkPropertyMetadata(typeof(ActivityDelegatePresenter))); - } - - [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification = "This is internal code with no derived class")] - public ActivityDelegatePresenter() - { - this.Arguments = new ObservableCollection(); - } - - public ModelItem Handler - { - get - { - return (ModelItem)GetValue(HandlerProperty); - } - - set - { - SetValue(HandlerProperty, value); - } - } - - public ModelItem ActivityDelegate - { - get - { - return (ModelItem)GetValue(ActivityDelegateProperty); - } - - set - { - SetValue(ActivityDelegateProperty, value); - } - } - - public IActivityDelegateFactory Factory - { - get - { - return (IActivityDelegateFactory)GetValue(FactoryProperty); - } - - set - { - SetValue(FactoryProperty, value); - } - } - - public ObservableCollection Arguments - { - get - { - return (ObservableCollection)GetValue(ArgumentsProperty); - } - - set - { - SetValue(ArgumentsProperty, value); - } - } - - public EditingContext EditingContext - { - get - { - return (EditingContext)GetValue(EditingContextProperty); - } - - set - { - SetValue(EditingContextProperty, value); - } - } - - protected virtual void ReportError(string message, string details) - { - ErrorReporting.ShowErrorMessage(message, details); - } - - private static void OnActivityDelegateChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) - { - ((ActivityDelegatePresenter)sender).OnActivityDelegateChanged(); - } - - private static void OnHandlerChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) - { - ((ActivityDelegatePresenter)sender).OnHandlerChanged(); - } - - private void OnActivityDelegateChanged() - { - this.Arguments.Clear(); - - if (this.ActivityDelegate != null) - { - ActivityDelegateMetadata metadata = ActivityDelegateUtilities.GetMetadata(this.ActivityDelegate.ItemType); - - foreach (ActivityDelegateArgumentMetadata argument in metadata) - { - this.Arguments.Add(this.ActivityDelegate.Properties[argument.Name].Value); - } - - this.isSetInternally = true; - this.Handler = this.ActivityDelegate.Properties["Handler"].Value; - this.isSetInternally = false; - } - else - { - this.isSetInternally = true; - this.Handler = null; - this.isSetInternally = false; - } - } - - private void OnHandlerChanged() - { - if (!this.isSetInternally) - { - if (this.Handler == null) - { - this.ActivityDelegate = null; - } - else - { - if (this.Factory != null && this.EditingContext != null) - { - try - { - ActivityDelegate instance = this.Factory.Create(); - Fx.Assert(instance != null, "Factory should not return null"); - ModelItem modelItem = this.EditingContext.Services.GetService().WrapAsModelItem(instance); - modelItem.Properties["Handler"].SetValue(this.Handler); - this.ActivityDelegate = modelItem; - } - catch (Exception ex) - { - if (Fx.IsFatal(ex)) - { - throw; - } - - string details = ex.Message; - - if (ex is TargetInvocationException && ex.InnerException != null) - { - details = ex.InnerException.Message; - } - - this.ReportError(string.Format(CultureInfo.CurrentUICulture, SR.CannotCreateInstance, TypeNameHelper.GetDisplayName(this.Factory.DelegateType, false)), details); - - this.isSetInternally = true; - this.Handler = null; - this.isSetInternally = false; - } - } - } - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegateUtilities.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegateUtilities.cs deleted file mode 100644 index 8f11620c4f5..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDelegateUtilities.cs +++ /dev/null @@ -1,131 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation -{ - using System.Activities.Presentation.Metadata; - using System.Activities.Presentation.Model; - using System.Collections.Generic; - using System.Reflection; - using System.Runtime; - - internal static class ActivityDelegateUtilities - { - public static ActivityDelegateMetadata GetMetadata(Type type) - { - ActivityDelegateMetadata metadata = new ActivityDelegateMetadata(); - - PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); - - foreach (PropertyInfo property in properties) - { - if (property.PropertyType.IsGenericType) - { - ActivityDelegateArgumentMetadata argument = null; - if (property.PropertyType.GetGenericTypeDefinition() == typeof(DelegateInArgument<>)) - { - argument = new ActivityDelegateArgumentMetadata(); - argument.Direction = ActivityDelegateArgumentDirection.In; - } - else if (property.PropertyType.GetGenericTypeDefinition() == typeof(DelegateOutArgument<>)) - { - argument = new ActivityDelegateArgumentMetadata(); - argument.Direction = ActivityDelegateArgumentDirection.Out; - } - - if (argument != null) - { - argument.Name = property.Name; - argument.Type = property.PropertyType.GetGenericArguments()[0]; - metadata.Add(argument); - } - } - } - - return metadata; - } - - public static void FillDelegate(ActivityDelegate activityDelegate, ActivityDelegateMetadata metadata) - { - foreach (ActivityDelegateArgumentMetadata argument in metadata) - { - activityDelegate.GetType().GetProperty(argument.Name).SetValue(activityDelegate, CreateDelegateArgument(argument), null); - } - } - - public static bool HasActivityDelegate(Type type) - { - return GetPropertiesByHeuristics(type).Count > 0; - } - - public static List CreateActivityDelegateInfo(ModelItem activity) - { - List list = new List(); - - foreach (PropertyInfo property in GetPropertiesByHeuristics(activity.ItemType)) - { - list.Add(new ActivityDelegateInfo(activity, property.Name)); - } - - return list; - } - - // Heuristics: - // A property is considered to be an ActivityDelegate when - // 1. it is a public instance property - // 2. it has a public getter and a public setter - // 3. its type is derived from ActivityDelegate - // 4. can create an isntance of its type - private static List GetPropertiesByHeuristics(Type activityType) - { - List result = new List(); - - PropertyInfo[] properties = activityType.GetProperties(BindingFlags.Public | BindingFlags.Instance); - foreach (PropertyInfo property in properties) - { - if (property.GetGetMethod() != null && - property.GetSetMethod() != null && - property.PropertyType.IsSubclassOf(typeof(ActivityDelegate)) && - TypeUtilities.CanCreateInstanceUsingDefaultConstructor(property.PropertyType)) - { - result.Add(property); - } - } - - result.Sort(new PropertyInfoComparer()); - - return result; - } - - private static DelegateArgument CreateDelegateArgument(ActivityDelegateArgumentMetadata argument) - { - DelegateArgument delegateArgument = null; - if (argument.Direction == ActivityDelegateArgumentDirection.In) - { - delegateArgument = Activator.CreateInstance(typeof(DelegateInArgument<>).MakeGenericType(argument.Type)) as DelegateArgument; - } - else - { - delegateArgument = Activator.CreateInstance(typeof(DelegateOutArgument<>).MakeGenericType(argument.Type)) as DelegateArgument; - } - - delegateArgument.Name = argument.Name; - - return delegateArgument; - } - - private class PropertyInfoComparer : IComparer - { - public int Compare(PropertyInfo x, PropertyInfo y) - { - Fx.Assert(x != null, "x should not be null"); - Fx.Assert(y != null, "y should not be null"); - - return StringComparer.Ordinal.Compare(x.Name, y.Name); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDesigner.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDesigner.cs deleted file mode 100644 index 5ff38b52715..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDesigner.cs +++ /dev/null @@ -1,357 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- - -namespace System.Activities.Presentation -{ - using System.Activities.Presentation.Annotations; - using System.Activities.Presentation.Model; - using System.Activities.Presentation.View; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.ComponentModel; - using System.Diagnostics.CodeAnalysis; - using System.Runtime; - using System.Text; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - using System.Windows.Input; - using System.Windows.Media; - using System.Windows.Threading; - - public class ActivityDesigner : WorkflowViewElement - { - UserControl defaultDisplayNameReadOnlyControl; - TextBox defaultDisplayNameBox; - bool defaultDisplayNameReadOnlyControlMouseDown; - - private AnnotationManager annotationManager; - - [Fx.Tag.KnownXamlExternal] - public DrawingBrush Icon - { - get { return (DrawingBrush)GetValue(IconProperty); } - set { SetValue(IconProperty, value); } - } - - public static readonly DependencyProperty IconProperty = - DependencyProperty.Register("Icon", typeof(DrawingBrush), typeof(ActivityDesigner), new UIPropertyMetadata(null)); - - internal static readonly DependencyProperty ActivityDelegatesProperty = DependencyProperty.Register("ActivityDelegates", typeof(ObservableCollection), typeof(ActivityDesigner)); - - internal static readonly DependencyProperty HasActivityDelegatesProperty = DependencyProperty.Register("HasActivityDelegates", typeof(bool), typeof(ActivityDesigner)); - - [SuppressMessage(FxCop.Category.Performance, FxCop.Rule.InitializeReferenceTypeStaticFieldsInline, - Justification = "Calls to OverrideMetadata for a dependency property should be done in the static constructor.")] - static ActivityDesigner() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(ActivityDesigner), new FrameworkPropertyMetadata(typeof(ActivityDesigner))); - } - - public ActivityDesigner() - { - this.Loaded += (sender, args) => - { - this.SetupDefaultIcon(); - this.annotationManager.Initialize(); - }; - - this.Unloaded += (sender, args) => - { - this.annotationManager.Uninitialize(); - }; - - this.annotationManager = new AnnotationManager(this); - } - - internal ObservableCollection ActivityDelegates - { - get { return (ObservableCollection)GetValue(ActivityDelegatesProperty); } - set { SetValue(ActivityDelegatesProperty, value); } - } - - internal bool HasActivityDelegates - { - get { return (bool)GetValue(HasActivityDelegatesProperty); } - set { SetValue(HasActivityDelegatesProperty, value); } - } - - protected override void OnModelItemChanged(object newItem) - { - base.OnModelItemChanged(newItem); - - this.PopulateActivityDelegates((ModelItem)newItem); - } - - private void PopulateActivityDelegates(ModelItem modelItem) - { - if (this.ActivityDelegates == null) - { - this.ActivityDelegates = new ObservableCollection(); - } - else - { - this.ActivityDelegates.Clear(); - } - - List list = ActivityDelegateUtilities.CreateActivityDelegateInfo(modelItem); - - if (list.Count > 0) - { - foreach (ActivityDelegateInfo entry in list) - { - this.ActivityDelegates.Add(entry); - } - - this.HasActivityDelegates = true; - } - else - { - this.HasActivityDelegates = false; - } - } - - protected override string GetAutomationIdMemberName() - { - return "DisplayName"; - } - - protected internal override string GetAutomationItemStatus() - { - StringBuilder descriptiveText = new StringBuilder(); - - EmitPropertyValuePair(descriptiveText, "IsPrimarySelection"); - EmitPropertyValuePair(descriptiveText, "IsSelection"); - EmitPropertyValuePair(descriptiveText, "IsCurrentLocation"); - EmitPropertyValuePair(descriptiveText, "IsCurrentContext"); - EmitPropertyValuePair(descriptiveText, "IsBreakpointEnabled"); - EmitPropertyValuePair(descriptiveText, "IsBreakpointBounded"); - EmitPropertyValuePair(descriptiveText, "ValidationState"); - descriptiveText.Append(base.GetAutomationItemStatus()); - - return descriptiveText.ToString(); - } - - void EmitPropertyValuePair(StringBuilder description, string propertyName) - { - PropertyDescriptor property = TypeDescriptor.GetProperties(this.ModelItem)[propertyName]; - object propertyValue = (property == null) ? null : property.GetValue(this.ModelItem); - string propertyValueString = propertyValue == null ? "null" : propertyValue.ToString(); - description.AppendFormat("{0}={1} ", propertyName, propertyValueString); - } - - public override void OnApplyTemplate() - { - base.OnApplyTemplate(); - - if (this.defaultDisplayNameBox != null) - { - this.defaultDisplayNameBox.LostFocus -= new RoutedEventHandler(OnDefaultDisplayNameBoxLostFocus); - this.defaultDisplayNameBox.ContextMenuOpening -= new ContextMenuEventHandler(OnDefaultDisplayNameBoxContextMenuOpening); - } - if (this.defaultDisplayNameReadOnlyControl != null) - { - this.defaultDisplayNameReadOnlyControl.MouseLeftButtonDown -= new MouseButtonEventHandler(OnDefaultDisplayNameReadOnlyControlMouseLeftButtonDown); - this.defaultDisplayNameReadOnlyControl.GotKeyboardFocus -= new KeyboardFocusChangedEventHandler(OnDefaultDisplayNameReadOnlyControlGotKeyboardFocus); - } - - this.defaultDisplayNameReadOnlyControl = this.Template.FindName("DisplayNameReadOnlyControl_6E8E4954_F6B2_4c6c_9E28_33A7A78F1E81", this) as UserControl; - this.defaultDisplayNameBox = this.Template.FindName("DisplayNameBox_570C5205_7195_4d4e_953A_8E4B57EF7E7F", this) as TextBox; - - UIElement defaultAnnotationIndicator = this.Template.FindName("AnnotationIndicator_570C5205_7195_4d4e_953A_8E4B57EF7E7F", this) as UIElement; - DockedAnnotationDecorator defaultDockedAnnotationDecorator = this.Template.FindName("DockedAnnotationDecorator_570C5205_7195_4d4e_953A_8E4B57EF7E7F", this) as DockedAnnotationDecorator; - - if (defaultAnnotationIndicator != null && defaultDockedAnnotationDecorator != null) - { - this.annotationManager.AnnotationVisualProvider = new ActivityDesignerAnnotationVisualProvider(new UIElementToAnnotationIndicatorAdapter(defaultAnnotationIndicator), defaultDockedAnnotationDecorator); - } - - if (this.defaultDisplayNameBox != null && this.defaultDisplayNameReadOnlyControl != null) - { - this.defaultDisplayNameBox.LostFocus += new RoutedEventHandler(OnDefaultDisplayNameBoxLostFocus); - this.defaultDisplayNameBox.ContextMenuOpening += new ContextMenuEventHandler(OnDefaultDisplayNameBoxContextMenuOpening); - this.defaultDisplayNameReadOnlyControl.MouseLeftButtonDown += new MouseButtonEventHandler(OnDefaultDisplayNameReadOnlyControlMouseLeftButtonDown); - this.defaultDisplayNameReadOnlyControl.GotKeyboardFocus += new KeyboardFocusChangedEventHandler(OnDefaultDisplayNameReadOnlyControlGotKeyboardFocus); - } - - Border titleBar = this.Template.FindName("TitleBar_C36A1CF2_4B36_4F0D_B427_9825C2E110DE", this) as Border; - if (titleBar != null) - { - this.DragHandle = titleBar; - } - } - - void OnDefaultDisplayNameReadOnlyControlGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) - { - if (this.defaultDisplayNameBox != null && this.defaultDisplayNameReadOnlyControl != null) - { - DesignerView designerView = this.Context.Services.GetService(); - if (!designerView.IsReadOnly && !designerView.IsMultipleSelectionMode) - { - this.EnterDisplayNameEditMode(); - } - } - } - - void OnDefaultDisplayNameReadOnlyControlMouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - this.defaultDisplayNameReadOnlyControlMouseDown = true; - } - - void OnDefaultDisplayNameBoxLostFocus(object sender, RoutedEventArgs e) - { - if (this.defaultDisplayNameBox != null && this.defaultDisplayNameReadOnlyControl != null) - { - this.ExitDisplayNameEditMode(); - } - } - - void OnDefaultDisplayNameBoxContextMenuOpening(object sender, ContextMenuEventArgs e) - { - // to disable the context menu - e.Handled = true; - } - - protected override void OnPreviewMouseDown(MouseButtonEventArgs e) - { - this.defaultDisplayNameReadOnlyControlMouseDown = false; - base.OnPreviewMouseDown(e); - } - - protected override void OnMouseUp(MouseButtonEventArgs e) - { - // We have to check the defaultDisplayNameReadOnlyControlMouseDown flag to determine whether the mouse is clicked on - // the defaultDisplayNameReadOnlyControl. This is because the mouse capture is set on the WorkflowViewElement in - // OnMouseDown, and as a result MouseUp event is not fired on the defaultDisplayNameReadOnlyControl. - if (this.defaultDisplayNameBox != null && this.defaultDisplayNameReadOnlyControl != null && - this.defaultDisplayNameReadOnlyControlMouseDown) - { - this.defaultDisplayNameReadOnlyControlMouseDown = false; - DesignerView designerView = this.Context.Services.GetService(); - if (!designerView.IsReadOnly) - { - this.EnterDisplayNameEditMode(); - } - } - base.OnMouseUp(e); - } - - void EnterDisplayNameEditMode() - { - this.defaultDisplayNameBox.Visibility = Visibility.Visible; - this.defaultDisplayNameReadOnlyControl.Visibility = Visibility.Collapsed; - this.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => - { - Keyboard.Focus(this.defaultDisplayNameBox); - this.defaultDisplayNameBox.ScrollToHome(); - })); - } - - void ExitDisplayNameEditMode() - { - this.defaultDisplayNameReadOnlyControl.Visibility = Visibility.Visible; - this.defaultDisplayNameBox.Visibility = Visibility.Collapsed; - } - - private void SetupDefaultIcon() - { - if (this.Icon == null) - { - this.Icon = GetDefaultIcon(); - } - } - - internal DrawingBrush GetDefaultIcon() - { - DrawingBrush icon = null; - - // Look for a named icon if this property is not set - - if (this.ModelItem != null) - { - string iconKey = this.ModelItem.ItemType.IsGenericType ? this.ModelItem.ItemType.GetGenericTypeDefinition().Name : this.ModelItem.ItemType.Name; - int genericParamsIndex = iconKey.IndexOf('`'); - if (genericParamsIndex > 0) - { - iconKey = iconKey.Remove(genericParamsIndex); - } - iconKey = iconKey + "Icon"; - try - { - if (WorkflowDesignerIcons.IconResourceDictionary.Contains(iconKey)) - { - object resourceItem = WorkflowDesignerIcons.IconResourceDictionary[iconKey]; - if (resourceItem is DrawingBrush) - { - icon = (DrawingBrush)resourceItem; - } - } - } - catch (ResourceReferenceKeyNotFoundException) { } - catch (InvalidCastException) { } - } - if (icon == null) - { - // as a last resort fall back to the default generic leaf activity icon. - icon = WorkflowDesignerIcons.Activities.DefaultCustomActivity; - } - - return icon; - } - - protected internal override void OnEditAnnotation() - { - this.annotationManager.OnEditAnnotation(); - } - - private class ActivityDesignerAnnotationVisualProvider : IAnnotationVisualProvider - { - private DockedAnnotationDecorator decorator; - private IAnnotationIndicator indicator; - private IFloatingAnnotation floatingAnnotation; - private IDockedAnnotation dockedAnnotation; - - public ActivityDesignerAnnotationVisualProvider(IAnnotationIndicator indicator, DockedAnnotationDecorator decorator) - { - this.indicator = indicator; - this.decorator = decorator; - } - - public IAnnotationIndicator GetAnnotationIndicator() - { - return this.indicator; - } - - public IFloatingAnnotation GetFloatingAnnotation() - { - if (this.floatingAnnotation == null) - { - this.floatingAnnotation = new FloatingAnnotationView(); - } - - return this.floatingAnnotation; - } - - public IDockedAnnotation GetDockedAnnotation() - { - if (this.dockedAnnotation == null) - { - DockedAnnotationView view = new DockedAnnotationView(); - - Binding annotationTextbinding = new Binding("ModelItem.AnnotationText"); - view.SetBinding(DockedAnnotationView.AnnotationTextProperty, annotationTextbinding); - - Binding maxWidthBinding = new Binding("ActualWidth"); - maxWidthBinding.ElementName = "annotationWidthSetter"; - view.SetBinding(DockedAnnotationView.MaxWidthProperty, maxWidthBinding); - - this.dockedAnnotation = view; - this.decorator.Child = view; - } - - return this.dockedAnnotation; - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDesignerOptionsAttribute.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDesignerOptionsAttribute.cs deleted file mode 100644 index e8c367bef74..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ActivityDesignerOptionsAttribute.cs +++ /dev/null @@ -1,40 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- - -namespace System.Activities.Presentation -{ - using System.Activities.Presentation.Model; - using System.Runtime; - using System.Windows; - using System.Windows.Media; - - [Fx.Tag.XamlVisible(false)] - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)] - public sealed class ActivityDesignerOptionsAttribute : Attribute - { - public ActivityDesignerOptionsAttribute() - { - this.AllowDrillIn = true; - this.AlwaysCollapseChildren = false; - } - - public bool AllowDrillIn - { - get; - set; - } - - public bool AlwaysCollapseChildren - { - get; - set; - } - - public Func OutlineViewIconProvider - { - get; - set; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AdornerLocation.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AdornerLocation.cs deleted file mode 100644 index 34d3d24b7e2..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AdornerLocation.cs +++ /dev/null @@ -1,17 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - internal enum AdornerLocation - { - None, - BottomRight, - TopRight, - TopLeft, - BottomLeft - } -} \ No newline at end of file diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/Annotation.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/Annotation.cs deleted file mode 100644 index ca4eef79adf..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/Annotation.cs +++ /dev/null @@ -1,73 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - using System.Diagnostics.CodeAnalysis; - using System.Runtime; - using System.Xaml; - - /// - /// Annotation class that contains methods to access annotation attached property - /// - public static class Annotation - { - /// - /// attachable property for annotation text - /// - [SuppressMessage(FxCop.Category.Security, FxCop.Rule.DoNotDeclareReadOnlyMutableReferenceTypes, Justification = "XAML attached property declaration.")] - public static readonly AttachableMemberIdentifier AnnotationTextProperty = new AttachableMemberIdentifier(typeof(Annotation), "AnnotationText"); - - /// - /// property name to access annotation in a ModelItem - /// - public static readonly string AnnotationTextPropertyName = "AnnotationText"; - - /// - /// property name to access dock annoation view state - /// - internal static readonly string IsAnnotationDockedViewStateName = "IsAnnotationDocked"; - - /// - /// Get annotation text of an object - /// - /// instance to get annotation - /// annoation text - public static string GetAnnotationText(object instance) - { - if (instance == null) - { - throw FxTrace.Exception.AsError(new ArgumentNullException("instance")); - } - - string annotationText; - AttachablePropertyServices.TryGetProperty(instance, Annotation.AnnotationTextProperty, out annotationText); - return annotationText; - } - - /// - /// Set annotation of an object - /// - /// instance to set annotation text - /// annoatation text to be set - public static void SetAnnotationText(object instance, string annotationText) - { - if (instance == null) - { - throw FxTrace.Exception.AsError(new ArgumentNullException("instance")); - } - - if (annotationText != null) - { - AttachablePropertyServices.SetProperty(instance, Annotation.AnnotationTextProperty, annotationText); - } - else - { - AttachablePropertyServices.RemoveProperty(instance, Annotation.AnnotationTextProperty); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationAdorner.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationAdorner.cs deleted file mode 100644 index 76324981da7..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationAdorner.cs +++ /dev/null @@ -1,175 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - using System.Activities.Presentation.View; - using System.Runtime; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Documents; - using System.Windows.Media; - - internal class AnnotationAdorner : Adorner - { - public static readonly DependencyProperty AnchorProperty = DependencyProperty.RegisterAttached("Anchor", typeof(AdornerLocation), typeof(AnnotationAdorner), new FrameworkPropertyMetadata(AdornerLocation.None)); - private UIElement content; - - public AnnotationAdorner(UIElement adornedElement) - : base(adornedElement) - { - } - - internal ScrollViewer ScrollViewer - { - get; - set; - } - - internal UIElement Content - { - get - { - return this.content; - } - - set - { - if (this.content != value) - { - if (this.content != null) - { - this.RemoveVisualChild(this.content); - } - - this.content = value; - if (this.content != null) - { - this.AddVisualChild(this.content); - } - } - } - } - - protected override int VisualChildrenCount - { - get - { - return 1; - } - } - - public static AdornerLocation GetAnchor(DependencyObject obj) - { - return (AdornerLocation)obj.GetValue(AnnotationAdorner.AnchorProperty); - } - - public static void SetAnchor(DependencyObject obj, AdornerLocation anchor) - { - obj.SetValue(AnnotationAdorner.AnchorProperty, anchor); - } - - // (3) | (2) - // ______|______ - // (4) | (1) - // | - // canvas is divided into four areas by anchorPoint - // try to figure out which area could fit desiredSize from area1 to area4, if there's no fit, default to area4. - internal static AdornerLocation FindAnchor(Point anchorPoint, Size desiredSize, Rect canvas) - { - Fx.Assert(anchorPoint.X >= canvas.X && anchorPoint.X <= canvas.X + canvas.Width, "X axis of anchorPoint not within canvas"); - Fx.Assert(anchorPoint.Y >= canvas.Y && anchorPoint.Y <= canvas.Y + canvas.Height, "Y axis of anchorPoint not within canvas"); - - AdornerLocation anchor = AdornerLocation.None; - - // try area 1 and 2 - if (anchorPoint.X + desiredSize.Width <= canvas.X + canvas.Width) - { - // area 1 - if (anchorPoint.Y + desiredSize.Height <= canvas.Y + canvas.Height) - { - anchor = AdornerLocation.BottomRight; - } - - // area 2 - if (anchor == AdornerLocation.None && anchorPoint.Y - desiredSize.Height >= canvas.Y) - { - anchor = AdornerLocation.TopRight; - } - } - - // area 3 - if (anchor == AdornerLocation.None && anchorPoint.X - desiredSize.Width >= canvas.X && anchorPoint.Y - desiredSize.Height >= canvas.Y) - { - anchor = AdornerLocation.TopLeft; - } - - // default to area 4 - if (anchor == AdornerLocation.None) - { - anchor = AdornerLocation.BottomLeft; - } - - return anchor; - } - - protected override Visual GetVisualChild(int index) - { - return this.Content; - } - - protected override Size MeasureOverride(Size constraint) - { - this.content.Measure(constraint); - return this.content.DesiredSize; - } - - protected override Size ArrangeOverride(Size finalSize) - { - Point anchorPoint = this.AdornedElement.TranslatePoint(new Point(this.AdornedElement.RenderSize.Width, 0), this.ScrollViewer); - - AdornerLocation anchor = AnnotationAdorner.GetAnchor(this); - if (anchor == AdornerLocation.None) - { - // Calculate based on the real size of the adorner, depending on current zoom level - DesignerView designerView = ((WorkflowViewElement)AdornedElement).Context.Services.GetService(); - double zoomLevel = designerView.ZoomFactor; - Size adornerSize = new Size(this.content.DesiredSize.Width * zoomLevel, this.content.DesiredSize.Height * zoomLevel); - anchor = FindAnchor(anchorPoint, adornerSize, new Rect(0, 0, this.ScrollViewer.ViewportWidth, this.ScrollViewer.ViewportHeight)); - AnnotationAdorner.SetAnchor(this, anchor); - } - - Point location = CalculateLocation(anchor, this.AdornedElement.RenderSize, this.content.DesiredSize); - - this.content.Arrange(new Rect(location, finalSize)); - - return finalSize; - } - - private static Point CalculateLocation(AdornerLocation anchor, Size adorneeSize, Size adornerSize) - { - Point location = new Point(); - - switch (anchor) - { - case AdornerLocation.BottomRight: - location = new Point(adorneeSize.Width, 0); - break; - case AdornerLocation.TopRight: - location = new Point(adorneeSize.Width, -adornerSize.Height); - break; - case AdornerLocation.TopLeft: - location = new Point(adorneeSize.Width - adornerSize.Width, -adornerSize.Height); - break; - case AdornerLocation.BottomLeft: - location = new Point(adorneeSize.Width - adornerSize.Width, 20); - break; - } - - return location; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationAdornerService.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationAdornerService.cs deleted file mode 100644 index 9a8b2b0f6fa..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationAdornerService.cs +++ /dev/null @@ -1,15 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - internal abstract class AnnotationAdornerService - { - public abstract void Show(AnnotationAdorner adorner); - - public abstract void Hide(AnnotationAdorner adorner); - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationManager.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationManager.cs deleted file mode 100644 index 4002583084f..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationManager.cs +++ /dev/null @@ -1,574 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - using System.Activities.Presentation.Hosting; - using System.Activities.Presentation.Model; - using System.Activities.Presentation.View; - using System.ComponentModel; - using System.Runtime; - using System.Windows; - using System.Windows.Threading; - - internal class AnnotationManager - { - private bool isInitialized; - - private WorkflowViewElement workflowViewElement; - private IAnnotationVisualProvider annotationVisualProvider; - - private ModelItem modelItem; - private EditingContext editingContext; - private IAnnotationIndicator indicator; - private IDockedAnnotation dockedAnnotation; - private IFloatingAnnotation floatingAnnotation; - - private bool isViewStateChangedInternally; - private AnnotationStatus status; - private AnnotationAdorner annotationAdorner; - private DispatcherTimer tryHideTimer; - private bool hasAnnotation; - - private IIntegratedHelpService helpService; - - internal AnnotationManager(WorkflowViewElement workflowViewElement) - { - this.workflowViewElement = workflowViewElement; - } - - public IAnnotationVisualProvider AnnotationVisualProvider - { - get - { - return this.annotationVisualProvider; - } - - set - { - if (this.annotationVisualProvider != value) - { - if (this.isInitialized) - { - throw FxTrace.Exception.AsError(new InvalidOperationException(SR.CouldNotChangeValueAfterInitialization)); - } - - this.annotationVisualProvider = value; - } - } - } - - protected internal virtual AnnotationAdornerService AnnotationAdornerService - { - get - { - return this.EditingContext.Services.GetService(); - } - } - - private ModelItem ModelItem - { - get - { - return this.modelItem; - } - - set - { - if (this.modelItem != value) - { - Fx.Assert(!this.isInitialized, "could not change value after initialization"); - - this.modelItem = value; - } - } - } - - private EditingContext EditingContext - { - get - { - return this.editingContext; - } - - set - { - if (this.editingContext != value) - { - Fx.Assert(!this.isInitialized, "could not change value after initialization"); - - this.editingContext = value; - } - } - } - - private IAnnotationIndicator Indicator - { - get - { - if (this.indicator == null) - { - this.indicator = this.AnnotationVisualProvider.GetAnnotationIndicator(); - } - - return this.indicator; - } - } - - private IFloatingAnnotation FloatingAnnotation - { - get - { - if (this.floatingAnnotation == null) - { - this.floatingAnnotation = this.AnnotationVisualProvider.GetFloatingAnnotation(); - - this.floatingAnnotation.IsReadOnly = this.EditingContext.Items.GetValue().IsReadOnly; - this.floatingAnnotation.IsMouseOverChanged += new EventHandler(this.OnFloatingAnnotationIsMouseOverChanged); - this.floatingAnnotation.IsKeyboardFocusWithinChanged += new DependencyPropertyChangedEventHandler(this.OnFloatingAnnotationIsKeyboardFocusWithinChanged); - this.floatingAnnotation.DockButtonClicked += new Action(this.OnDockButtonClicked); - this.floatingAnnotation.ModelItem = this.ModelItem; - } - - return this.floatingAnnotation; - } - } - - private IDockedAnnotation DockedAnnotation - { - get - { - if (this.dockedAnnotation == null) - { - this.dockedAnnotation = this.AnnotationVisualProvider.GetDockedAnnotation(); - - this.dockedAnnotation.IsReadOnly = this.EditingContext.Items.GetValue().IsReadOnly; - this.dockedAnnotation.UndockButtonClicked += new Action(this.OnUndockButtonClicked); - } - - return this.dockedAnnotation; - } - } - - private ViewStateService ViewStateService - { - get - { - return this.EditingContext.Services.GetService(); - } - } - - private AnnotationAdorner AnnotationAdorner - { - get - { - if (this.annotationAdorner == null) - { - this.annotationAdorner = new AnnotationAdorner(this.workflowViewElement); - this.annotationAdorner.Content = this.FloatingAnnotation as UIElement; - } - - return this.annotationAdorner; - } - } - - private bool IsAnnotationDocked - { - get - { - bool? value = this.ViewStateService.RetrieveViewState(this.ModelItem, Annotation.IsAnnotationDockedViewStateName) as bool?; - if (value.HasValue) - { - return value.Value; - } - else - { - return false; - } - } - - set - { - this.isViewStateChangedInternally = true; - this.ViewStateService.StoreViewState(this.ModelItem, Annotation.IsAnnotationDockedViewStateName, value); - this.isViewStateChangedInternally = false; - } - } - - private DispatcherTimer TryHideTimer - { - get - { - if (this.tryHideTimer == null) - { - this.tryHideTimer = new DispatcherTimer(); - this.tryHideTimer.Interval = TimeSpan.FromMilliseconds(200); - this.tryHideTimer.Tick += this.TryHideAnnotation; - } - - return this.tryHideTimer; - } - } - - public void Initialize() - { - if (this.isInitialized) - { - return; - } - - this.ModelItem = this.workflowViewElement.ModelItem; - this.EditingContext = this.workflowViewElement.Context; - - if (!this.CanInitialize()) - { - return; - } - - this.EditingContext.Items.Subscribe(this.OnReadOnlyStateChanged); - this.ViewStateService.ViewStateChanged += new ViewStateChangedEventHandler(this.OnViewStateChanged); - this.ModelItem.PropertyChanged += new PropertyChangedEventHandler(this.OnModelItemPropertyChanged); - this.Indicator.IsMouseOverChanged += new EventHandler(this.OnIndicatorIsMouseOverChanged); - this.helpService = this.EditingContext.Services.GetService(); - - this.hasAnnotation = this.ModelItem.Properties[Annotation.AnnotationTextPropertyName].ComputedValue != null; - - if (this.ModelItem.Properties[Annotation.AnnotationTextPropertyName].ComputedValue == null) - { - this.Indicator.Visibility = Visibility.Collapsed; - if (this.dockedAnnotation != null) - { - this.DockedAnnotation.Visibility = Visibility.Collapsed; - } - } - else - { - if (this.IsAnnotationDocked) - { - this.Indicator.Visibility = Visibility.Collapsed; - this.DockedAnnotation.Visibility = Visibility.Visible; - this.status = AnnotationStatus.Docked; - } - else - { - this.Indicator.Visibility = Visibility.Visible; - this.DockedAnnotation.Visibility = Visibility.Collapsed; - } - } - - this.isInitialized = true; - } - - public void Uninitialize() - { - if (!this.isInitialized) - { - return; - } - - this.EditingContext.Items.Unsubscribe(this.OnReadOnlyStateChanged); - this.ViewStateService.ViewStateChanged -= new ViewStateChangedEventHandler(this.OnViewStateChanged); - this.ModelItem.PropertyChanged -= new PropertyChangedEventHandler(this.OnModelItemPropertyChanged); - this.Indicator.IsMouseOverChanged -= new EventHandler(this.OnIndicatorIsMouseOverChanged); - - if (this.dockedAnnotation != null) - { - this.dockedAnnotation.UndockButtonClicked -= new Action(this.OnUndockButtonClicked); - } - - if (this.floatingAnnotation != null) - { - this.floatingAnnotation.IsMouseOverChanged -= new EventHandler(this.OnFloatingAnnotationIsMouseOverChanged); - this.floatingAnnotation.IsKeyboardFocusWithinChanged -= new DependencyPropertyChangedEventHandler(this.OnFloatingAnnotationIsKeyboardFocusWithinChanged); - this.floatingAnnotation.DockButtonClicked -= new Action(this.OnDockButtonClicked); - } - - if (this.tryHideTimer != null) - { - this.tryHideTimer.Tick -= this.TryHideAnnotation; - if (this.tryHideTimer.IsEnabled) - { - this.tryHideTimer.Stop(); - } - } - - this.tryHideTimer = null; - - this.isInitialized = false; - } - - public void OnEditAnnotation() - { - if (!this.isInitialized) - { - return; - } - - if (this.status == AnnotationStatus.Docked) - { - this.DockedAnnotation.FocusOnContent(); - return; - } - - if (this.status == AnnotationStatus.Hidden) - { - this.ShowAnnotation(); - } - - this.FloatingAnnotation.FocusOnContent(); - } - - private void OnReadOnlyStateChanged(ReadOnlyState state) - { - if (this.floatingAnnotation != null) - { - this.floatingAnnotation.IsReadOnly = state.IsReadOnly; - } - - if (this.dockedAnnotation != null) - { - this.dockedAnnotation.IsReadOnly = state.IsReadOnly; - } - } - - private void OnViewStateChanged(object sender, ViewStateChangedEventArgs e) - { - if (e.ParentModelItem == this.ModelItem && e.Key == Annotation.IsAnnotationDockedViewStateName && !this.isViewStateChangedInternally) - { - bool? isAnnotationDocked = e.NewValue as bool?; - if (isAnnotationDocked.HasValue) - { - if (this.hasAnnotation) - { - if (isAnnotationDocked.Value) - { - this.DockAnnotation(); - } - else - { - this.HideAnnotation(); - } - } - } - } - } - - private void OnModelItemPropertyChanged(object sender, PropertyChangedEventArgs e) - { - if (e.PropertyName == Annotation.AnnotationTextPropertyName) - { - bool previouslyHadAnnotation = this.hasAnnotation; - this.hasAnnotation = this.ModelItem.Properties[Annotation.AnnotationTextPropertyName].ComputedValue != null; - - if (!this.hasAnnotation) - { - //// annotation is removed - - if (this.status == AnnotationStatus.Floating) - { - this.AnnotationAdornerService.Hide(this.AnnotationAdorner); - } - - this.Indicator.Visibility = Visibility.Collapsed; - if (this.dockedAnnotation != null) - { - this.dockedAnnotation.Visibility = Visibility.Collapsed; - } - - this.status = AnnotationStatus.Hidden; - } - else if (!previouslyHadAnnotation) - { - //// annotation is added - - if (this.IsAnnotationDocked) - { - this.Indicator.Visibility = Visibility.Collapsed; - this.DockedAnnotation.Visibility = Visibility.Visible; - this.status = AnnotationStatus.Docked; - } - else - { - this.Indicator.Visibility = Visibility.Visible; - } - } - } - } - - private void OnUndockButtonClicked() - { - this.ShowAnnotation(); - this.OnEditAnnotation(); - } - - private void OnFloatingAnnotationIsMouseOverChanged(object sender, EventArgs e) - { - if (!this.FloatingAnnotation.IsMouseOver) - { - if (this.status == AnnotationStatus.Floating) - { - this.DelayedTryHide(); - } - } - } - - private void OnFloatingAnnotationIsKeyboardFocusWithinChanged(object sender, DependencyPropertyChangedEventArgs e) - { - if (!this.FloatingAnnotation.IsKeyboardFocusWithin) - { - this.TryHideAnnotation(null, null); - if (this.helpService != null) - { - this.helpService.RemoveContextAttribute(string.Empty, typeof(Annotation).FullName); - this.helpService.AddContextAttribute(string.Empty, WorkflowViewManager.GetF1HelpTypeKeyword(this.ModelItem.ItemType), ComponentModel.Design.HelpKeywordType.F1Keyword); - } - } - else - { - Selection.SelectOnly(this.EditingContext, this.ModelItem); - if (this.helpService != null) - { - this.helpService.RemoveContextAttribute(string.Empty, WorkflowViewManager.GetF1HelpTypeKeyword(this.ModelItem.ItemType)); - this.helpService.AddContextAttribute(string.Empty, typeof(Annotation).FullName, ComponentModel.Design.HelpKeywordType.F1Keyword); - } - } - } - - private void OnIndicatorIsMouseOverChanged(object sender, EventArgs e) - { - if (this.Indicator.IsMouseOver) - { - if (this.status == AnnotationStatus.Hidden) - { - this.ShowAnnotation(); - } - } - else - { - if (this.status == AnnotationStatus.Floating) - { - this.DelayedTryHide(); - } - } - } - - private void OnDockButtonClicked() - { - this.DockAnnotation(); - } - - private bool CanInitialize() - { - return this.ModelItem != null && - this.EditingContext != null && - this.AnnotationVisualProvider != null && - this.EditingContext.Services.GetService().AnnotationEnabled; - } - - private void TryHideAnnotation(object sender, EventArgs e) - { - DispatcherTimer timer = sender as DispatcherTimer; - if (timer != null) - { - timer.Stop(); - } - - if (this.status == AnnotationStatus.Floating) - { - if (!this.FloatingAnnotation.IsMouseOver && - !this.Indicator.IsMouseOver && - !this.FloatingAnnotation.IsKeyboardFocusWithin) - { - this.HideAnnotation(); - } - } - } - - private void DelayedTryHide() - { - if (this.TryHideTimer.IsEnabled) - { - this.TryHideTimer.Stop(); - } - - this.TryHideTimer.Start(); - } - - private void ShowAnnotation() - { - System.Diagnostics.Debug.WriteLine("ShowAnnotation called."); - - switch (this.status) - { - case AnnotationStatus.Floating: - return; - case AnnotationStatus.Hidden: - this.AnnotationAdornerService.Show(this.AnnotationAdorner); - break; - case AnnotationStatus.Docked: - if (this.Indicator != null) - { - this.Indicator.Visibility = Visibility.Visible; - } - - this.DockedAnnotation.Visibility = Visibility.Collapsed; - - this.AnnotationAdornerService.Show(this.AnnotationAdorner); - break; - } - - this.status = AnnotationStatus.Floating; - this.IsAnnotationDocked = false; - } - - private void HideAnnotation() - { - System.Diagnostics.Debug.WriteLine("HideAnnotation called."); - - if (this.status == AnnotationStatus.Hidden) - { - return; - } - - if (this.status == AnnotationStatus.Floating) - { - this.FloatingAnnotation.UpdateModelItem(); - this.AnnotationAdornerService.Hide(this.AnnotationAdorner); - } - - if (this.status == AnnotationStatus.Docked) - { - this.Indicator.Visibility = Visibility.Visible; - - this.DockedAnnotation.Visibility = Visibility.Collapsed; - } - - this.status = AnnotationStatus.Hidden; - this.IsAnnotationDocked = false; - } - - private void DockAnnotation() - { - System.Diagnostics.Debug.WriteLine("DockAnnotation called."); - - if (this.status == AnnotationStatus.Docked) - { - return; - } - - if (this.status == AnnotationStatus.Floating) - { - this.AnnotationAdornerService.Hide(this.AnnotationAdorner); - } - - this.Indicator.Visibility = Visibility.Collapsed; - this.DockedAnnotation.Visibility = Visibility.Visible; - - this.status = AnnotationStatus.Docked; - this.IsAnnotationDocked = true; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationStatus.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationStatus.cs deleted file mode 100644 index eb6a3c3090d..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/AnnotationStatus.cs +++ /dev/null @@ -1,15 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - internal enum AnnotationStatus - { - Hidden = 0, - Floating, - Docked - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/DockedAnnotationView.xaml.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/DockedAnnotationView.xaml.cs deleted file mode 100644 index e1018c476fa..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/DockedAnnotationView.xaml.cs +++ /dev/null @@ -1,79 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - using System.Windows; - using System.Windows.Controls; - - internal partial class DockedAnnotationView : UserControl, IDockedAnnotation - { - public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(DockedAnnotationView)); - - private static DependencyProperty annotationTextProperty = DependencyProperty.Register("AnnotationText", typeof(string), typeof(DockedAnnotationView), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); - - public DockedAnnotationView() - { - this.InitializeComponent(); - } - - public event Action UndockButtonClicked; - - public static DependencyProperty AnnotationTextProperty - { - get { return annotationTextProperty; } - } - - public bool IsReadOnly - { - get { return (bool)GetValue(IsReadOnlyProperty); } - set { SetValue(IsReadOnlyProperty, value); } - } - - public string AnnotationText - { - get { return (string)GetValue(AnnotationTextProperty); } - set { SetValue(AnnotationTextProperty, value); } - } - - public void FocusOnContent() - { - this.textBox.Focus(); - } - - protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) - { - base.OnPropertyChanged(e); - - if (e.Property.Name == "IsMouseOver" || e.Property.Name == "IsKeyboardFocusWithin") - { - if (this.IsMouseOver || this.IsKeyboardFocusWithin) - { - this.undockButton.Visibility = Visibility.Visible; - this.border.Visibility = Visibility.Visible; - } - else - { - this.undockButton.Visibility = Visibility.Hidden; - this.border.Visibility = Visibility.Hidden; - } - } - } - - protected override void OnContextMenuOpening(ContextMenuEventArgs e) - { - e.Handled = true; - } - - private void OnUndockButtonClicked(object sender, RoutedEventArgs e) - { - if (this.UndockButtonClicked != null) - { - this.UndockButtonClicked(); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/FloatingAnnotationView.xaml.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/FloatingAnnotationView.xaml.cs deleted file mode 100644 index 83c6c45fb2f..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/FloatingAnnotationView.xaml.cs +++ /dev/null @@ -1,95 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - using System.Activities.Presentation.Model; - using System.ComponentModel; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - using System.Windows.Input; - - internal sealed partial class FloatingAnnotationView : UserControl, IFloatingAnnotation - { - public static readonly DependencyProperty ModelItemProperty = DependencyProperty.Register("ModelItem", typeof(ModelItem), typeof(FloatingAnnotationView)); - - public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(FloatingAnnotationView)); - - private bool focusOnLoad; - - public FloatingAnnotationView() - { - this.InitializeComponent(); - this.Loaded += new RoutedEventHandler(this.OnFloatingAnnotationViewLoaded); - } - - public event Action DockButtonClicked; - - public event EventHandler IsMouseOverChanged - { - add - { - DependencyPropertyDescriptor descriptor = DependencyPropertyDescriptor.FromProperty(UIElement.IsMouseOverProperty, typeof(UIElement)); - descriptor.AddValueChanged(this, value); - } - - remove - { - DependencyPropertyDescriptor descriptor = DependencyPropertyDescriptor.FromProperty(UIElement.IsMouseOverProperty, typeof(UIElement)); - descriptor.RemoveValueChanged(this, value); - } - } - - public bool IsReadOnly - { - get { return (bool)GetValue(IsReadOnlyProperty); } - set { SetValue(IsReadOnlyProperty, value); } - } - - public ModelItem ModelItem - { - get { return (ModelItem)GetValue(ModelItemProperty); } - set { SetValue(ModelItemProperty, value); } - } - - public void FocusOnContent() - { - if (this.annotationTextBox.Focus() != true) - { - this.focusOnLoad = true; - } - } - - public void UpdateModelItem() - { - BindingExpression be = this.annotationTextBox.GetBindingExpression(TextBox.TextProperty); - be.UpdateSource(); - } - - protected override void OnContextMenuOpening(ContextMenuEventArgs e) - { - e.Handled = true; - } - - private void OnFloatingAnnotationViewLoaded(object sender, RoutedEventArgs e) - { - if (this.focusOnLoad) - { - Keyboard.Focus(this.annotationTextBox); - this.focusOnLoad = false; - } - } - - private void OnDockButtonClicked(object sender, RoutedEventArgs e) - { - if (this.DockButtonClicked != null) - { - this.DockButtonClicked(); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IAnnotationIndicator.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IAnnotationIndicator.cs deleted file mode 100644 index 3af15672496..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IAnnotationIndicator.cs +++ /dev/null @@ -1,25 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - using System.Windows; - - internal interface IAnnotationIndicator - { - event EventHandler IsMouseOverChanged; - - bool IsMouseOver - { - get; - } - - Visibility Visibility - { - set; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IAnnotationVisualProvider.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IAnnotationVisualProvider.cs deleted file mode 100644 index 3070ffc33a6..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IAnnotationVisualProvider.cs +++ /dev/null @@ -1,17 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - internal interface IAnnotationVisualProvider - { - IAnnotationIndicator GetAnnotationIndicator(); - - IFloatingAnnotation GetFloatingAnnotation(); - - IDockedAnnotation GetDockedAnnotation(); - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IDockedAnnotation.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IDockedAnnotation.cs deleted file mode 100644 index 658c833204a..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IDockedAnnotation.cs +++ /dev/null @@ -1,27 +0,0 @@ -//--------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//--------------------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - using System.Windows; - - internal interface IDockedAnnotation - { - event Action UndockButtonClicked; - - bool IsReadOnly - { - set; - } - - Visibility Visibility - { - set; - } - - void FocusOnContent(); - } -} \ No newline at end of file diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IFloatingAnnotation.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IFloatingAnnotation.cs deleted file mode 100644 index 2ad648b2e02..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/IFloatingAnnotation.cs +++ /dev/null @@ -1,46 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - using System; - using System.Activities.Presentation.Model; - using System.Windows; - - internal interface IFloatingAnnotation - { - event DependencyPropertyChangedEventHandler IsKeyboardFocusWithinChanged; - - event EventHandler IsMouseOverChanged; - - event Action DockButtonClicked; - - bool IsReadOnly - { - set; - } - - ModelItem ModelItem - { - get; - set; - } - - bool IsKeyboardFocusWithin - { - get; - } - - bool IsMouseOver - { - get; - } - - void FocusOnContent(); - - void UpdateModelItem(); - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/NotifyArgumentVariableAnnotationTextChanged.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/NotifyArgumentVariableAnnotationTextChanged.cs deleted file mode 100644 index d4ff80cfa99..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/NotifyArgumentVariableAnnotationTextChanged.cs +++ /dev/null @@ -1,47 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - using System; - using System.Activities.Presentation.Model; - using System.Activities.Presentation.View; - - // This is to workaround a bug that updating ModelItem from outside of ArgumentDesigner/VariableDesigner will not update it. - internal class NotifyArgumentVariableAnnotationTextChanged : Change - { - public ArgumentDesigner ArgumentDesigner { get; set; } - - public VariableDesigner VariableDesigner { get; set; } - - public override string Description - { - get { return SR.NotifyAnnotationTextChangedDescription; } - } - - public override bool Apply() - { - this.VariableDesigner.Dispatcher.BeginInvoke( - new Action(() => - { - this.VariableDesigner.NotifyAnnotationTextChanged(); - this.ArgumentDesigner.NotifyAnnotationTextChanged(); - }), - Windows.Threading.DispatcherPriority.ApplicationIdle, - null); - return true; - } - - public override Change GetInverse() - { - return new NotifyArgumentVariableAnnotationTextChanged() - { - VariableDesigner = this.VariableDesigner, - ArgumentDesigner = this.ArgumentDesigner, - }; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/UIElementToAnnotationIndicatorAdapter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/UIElementToAnnotationIndicatorAdapter.cs deleted file mode 100644 index 43c9843472b..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/UIElementToAnnotationIndicatorAdapter.cs +++ /dev/null @@ -1,58 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - using System; - using System.ComponentModel; - using System.Windows; - - internal class UIElementToAnnotationIndicatorAdapter : IAnnotationIndicator - { - private UIElement element; - - public UIElementToAnnotationIndicatorAdapter(UIElement element) - { - if (element == null) - { - throw FxTrace.Exception.AsError(new ArgumentNullException("element")); - } - - this.element = element; - } - - public event EventHandler IsMouseOverChanged - { - add - { - DependencyPropertyDescriptor descriptor = DependencyPropertyDescriptor.FromProperty(UIElement.IsMouseOverProperty, typeof(UIElement)); - descriptor.AddValueChanged(this.element, value); - } - - remove - { - DependencyPropertyDescriptor descriptor = DependencyPropertyDescriptor.FromProperty(UIElement.IsMouseOverProperty, typeof(UIElement)); - descriptor.RemoveValueChanged(this.element, value); - } - } - - public bool IsMouseOver - { - get - { - return this.element.IsMouseOver; - } - } - - public Visibility Visibility - { - set - { - this.element.Visibility = value; - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/WorkflowAnnotationAdornerService.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/WorkflowAnnotationAdornerService.cs deleted file mode 100644 index c21dbeaaaee..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Annotations/WorkflowAnnotationAdornerService.cs +++ /dev/null @@ -1,110 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Annotations -{ - using System.Activities.Presentation.Model; - using System.Windows.Controls; - using System.Windows.Documents; - using System.Xaml; - - internal class WorkflowAnnotationAdornerService : AnnotationAdornerService - { - private ScrollViewer scrollViewer; - private bool enabled; - - internal WorkflowAnnotationAdornerService() - { - } - - public override void Show(AnnotationAdorner adorner) - { - if (!this.enabled) - { - return; - } - - AnnotationAdorner.SetAnchor(adorner, AdornerLocation.None); - adorner.ScrollViewer = this.scrollViewer; - - AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(adorner.AdornedElement); - if (adornerLayer != null) - { - adornerLayer.Add(adorner); - } - - return; - } - - public override void Hide(AnnotationAdorner adorner) - { - if (!this.enabled) - { - return; - } - - AnnotationAdorner.SetAnchor(adorner, AdornerLocation.None); - - AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(adorner.AdornedElement); - if (adornerLayer != null) - { - adornerLayer.Remove(adorner); - } - - return; - } - - internal void Initialize(EditingContext editingContext, ScrollViewer scrollViewer) - { - this.scrollViewer = scrollViewer; - this.enabled = editingContext.Services.GetService().AnnotationEnabled; - - if (!this.enabled) - { - return; - } - - AttachedPropertiesService attachedPropertiesService = editingContext.Services.GetService(); - AttachedProperty attachedProperty = new AttachedProperty - { - IsBrowsable = false, - IsVisibleToModelItem = true, - Name = Annotation.AnnotationTextPropertyName, - OwnerType = typeof(object), - Getter = (modelItem) => - { - string annotation = null; - AttachablePropertyServices.TryGetProperty(modelItem.GetCurrentValue(), Annotation.AnnotationTextProperty, out annotation); - return annotation; - }, - Setter = (modelItem, value) => - { - string oldValue = null; - AttachablePropertyServices.TryGetProperty(modelItem.GetCurrentValue(), Annotation.AnnotationTextProperty, out oldValue); - if (oldValue == value) - { - return; - } - - ModelTreeManager treeManager = modelItem.GetEditingContext().Services.GetService(); - - AttachablePropertyChange change = new AttachablePropertyChange() - { - Owner = modelItem, - AttachablePropertyIdentifier = Annotation.AnnotationTextProperty, - OldValue = oldValue, - NewValue = value, - PropertyName = Annotation.AnnotationTextPropertyName - }; - - treeManager.AddToCurrentEditingScope(change); - } - }; - - attachedPropertiesService.AddProperty(attachedProperty); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ArgumentAccessor.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ArgumentAccessor.cs deleted file mode 100644 index e3bfc8786f4..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/ArgumentAccessor.cs +++ /dev/null @@ -1,26 +0,0 @@ -//---------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//---------------------------------------------------------------- - -namespace System.Activities.Presentation -{ - using System; - - /// - /// A class containing a get/set delegate pair to access an argument in an activity instance. - /// - public class ArgumentAccessor - { - /// - /// Gets or sets the method to retrieve an argument from an activity instance. - /// - public Func Getter { get; set; } - - /// - /// Gets or sets the method to set an argument into an activity instance. - /// - public Action Setter { get; set; } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/ContextItem.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/ContextItem.cs deleted file mode 100644 index 977c81a5f34..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/ContextItem.cs +++ /dev/null @@ -1,57 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- - -namespace System.Activities.Presentation -{ - using System.Diagnostics.CodeAnalysis; - - - using System; - using System.Collections.Generic; - - // - // The ContextItem class is the base class from which all context items must derive. - // - public abstract class ContextItem - { - - // - // Creates a new ContextItem. - // - protected ContextItem() - { - } - - // - // Returns the item type for this editing context item. Context items are - // considered unique based on their item type. By using ItemType to identify - // a type of context item we allow several derived versions of context items to - // be cataloged under the same key in the editing context. - // - // - public abstract Type ItemType - { get; } - - // - // This method is called on a context item before it is stored in the context item - // manager. The previous item in the context item manager is passed. - // - // The editing context that is making this change. - // The previously active item in the context. Because items must have default constructors a default item will be fabricated if an item is first passed into the context. - // - protected virtual void OnItemChanged(EditingContext context, ContextItem previousItem) - { - } - - // - // Internal API that calls OnItemChanged. This is invoked from the - // abstract ContextItemManager class so deriving classes can still - // invoke it. - // - internal void InvokeOnItemChanged(EditingContext context, ContextItem previousItem) - { - OnItemChanged(context, previousItem); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/ContextItemManager.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/ContextItemManager.cs deleted file mode 100644 index 587019362f6..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/ContextItemManager.cs +++ /dev/null @@ -1,337 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation -{ - - using System; - using System.Collections; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Diagnostics.CodeAnalysis; - using System.Activities.Presentation; - - using System.Runtime; - - // - // The ContextItemManager class maintains a set of context items. A context - // item represents a piece of transient state in a designer. - // - // ContextItems must define an empty constructor. This empty constructor - // version of a context item represents its default value, and will be the - // value returned from GetItem if the context item manager does not contain - // a context item of the requested type. - // - // The ContextItemManager supports context layers. A context layer is a - // separation in the set of context items and is useful when providing modal - // functions. For example, when switching modes in the designer to show the - // tab order layout it may be desirable to disable adding items from the - // toolbox and change the user mouse and keyboard gestures to focus on setting - // the tab order. Rather than grabbing and storing context items before - // replacing them with new values, a developer can simply call CreateLayer. - // Once the layer is created, all subsequent context changes go to that layer. - // - // When the developer is done with the layer, as would be the case when a user - // switches out of tab order mode, she simply calls Remove on the layer. This - // removes all context items that were added to the layer and restores the context - // to its previous set of values before the layer was created. - // - [SuppressMessage(FxCop.Category.Naming, FxCop.Rule.IdentifiersShouldHaveCorrectSuffix)] - public abstract class ContextItemManager : IEnumerable - { - - // - // Creates a new ContextItemManager object. - // - protected ContextItemManager() - { - } - - // - // Returns true if the item manager contains an item of the given type. - // - // The type of item to check. - // True if the context contains an instance of this item type. - // if itemType is null. - public abstract bool Contains(Type itemType); - - // - // Returns true if the item manager contains an item of the given type. - // - // The type of item to check. - // True if the context contains an instance of this item type. - [SuppressMessage(FxCop.Category.Design, FxCop.Rule.GenericMethodsShouldProvideTypeParameter)] - public bool Contains() where TItemType : ContextItem - { - return Contains(typeof(TItemType)); - } - - // - // Enumerates the context items in the editing context. This enumeration - // includes prior layers unless the enumerator hits an isolated layer. - // Enumeration is typically not useful in most scenarios but it is provided so - // that developers can search in the context and learn what is placed in it. - // - // An enumeration of context items. - public abstract IEnumerator GetEnumerator(); - - // - // Returns an instance of the requested item type. If there is no context - // item with the given type, an empty item will be created. - // - // The type of item to return. - // A context item of the requested type. If there is no item in the context of this type a default one will be created. - // if itemType is null. - public abstract ContextItem GetValue(Type itemType); - - // - // Returns an instance of the requested item type. If there is no context - // item with the given type, an empty item will be created. - // - // The type of item to return. - // A context item of the requested type. If there is no item in the context of this type a default one will be created. - [SuppressMessage(FxCop.Category.Design, FxCop.Rule.GenericMethodsShouldProvideTypeParameter)] - public TItemType GetValue() where TItemType : ContextItem - { - return (TItemType)GetValue(typeof(TItemType)); - } - - // - // This is a helper method that invokes the protected OnItemChanged - // method on ContextItem. - // - // The editing context in use. - // The new context item. - // The previous context item. - // if context, item or previousItem is null. - protected static void NotifyItemChanged(EditingContext context, ContextItem item, ContextItem previousItem) - { - if (context == null) - { - throw FxTrace.Exception.ArgumentNull("context"); - } - if (item == null) - { - throw FxTrace.Exception.ArgumentNull("item"); - } - if (previousItem == null) - { - throw FxTrace.Exception.ArgumentNull("previousItem"); - } - item.InvokeOnItemChanged(context, previousItem); - } - - // - // This sets a context item to the given value. It is illegal to pass - // null here. If you want to set a context item to its empty value create - // an instance of the item using a default constructor. - // - // The value to set into the context item manager. - public abstract void SetValue(ContextItem value); - - // - // Adds an event callback that will be invoked with a context item of the given item type changes. - // - // The type of item you wish to subscribe to. - // A callback that will be invoked when contextItemType changes. - // if contextItemType or callback is null. - public abstract void Subscribe(Type contextItemType, SubscribeContextCallback callback); - - // - // Adds an event callback that will be invoked with a context item of the given item type changes. - // - // The type of item you wish to subscribe to. - // A callback that will be invoked when contextItemType changes. - // if callback is null. - [SuppressMessage(FxCop.Category.Design, FxCop.Rule.GenericMethodsShouldProvideTypeParameter)] - public void Subscribe(SubscribeContextCallback callback) where TContextItemType : ContextItem - { - if (callback == null) - { - throw FxTrace.Exception.ArgumentNull("callback"); - } - SubscribeProxy proxy = new SubscribeProxy(callback); - Subscribe(typeof(TContextItemType), proxy.Callback); - } - - // - // Removes a subscription. - // - // The type of context item to remove the callback from. - // The callback to remove. - // if callback is null. - [SuppressMessage(FxCop.Category.Design, FxCop.Rule.GenericMethodsShouldProvideTypeParameter)] - public void Unsubscribe(SubscribeContextCallback callback) where TContextItemType : ContextItem - { - if (callback == null) - { - throw FxTrace.Exception.ArgumentNull("callback"); - } - SubscribeProxy proxy = new SubscribeProxy(callback); - Unsubscribe(typeof(TContextItemType), proxy.Callback); - } - - // - // Removes a subscription. - // - // The type of context item to remove the callback from. - // The callback to remove. - // if contextItemType or callback is null. - public abstract void Unsubscribe(Type contextItemType, SubscribeContextCallback callback); - - // - // This is a helper method that returns the target object for a delegate. - // If the delegate was created to proxy a generic delegate, this will correctly - // return the original object, not the proxy. - // - // The callback whose target you want. - // if callback is null. - // The target object of the callback. - protected static object GetTarget(Delegate callback) - { - if (callback == null) - { - throw FxTrace.Exception.ArgumentNull("callback"); - } - - ICallbackProxy proxy = callback.Target as ICallbackProxy; - if (proxy != null) - { - return proxy.OriginalTarget; - } - - return callback.Target; - } - - // - // This is a helper method that performs a Delegate.Remove, but knows - // how to unwrap delegates that are proxies to generic callbacks. Use - // this in your Unsubscribe implementations. - // - // The existing delegate. - // The delegate to be removed from existing. - // The new delegate that should be assigned to existing. - protected static Delegate RemoveCallback(Delegate existing, Delegate toRemove) - { - if (existing == null) - { - return null; - } - if (toRemove == null) - { - return existing; - } - - ICallbackProxy toRemoveProxy = toRemove.Target as ICallbackProxy; - if (toRemoveProxy == null) - { - // The item to be removed is a normal delegate. Just call - // Delegate.Remove - return Delegate.Remove(existing, toRemove); - } - - toRemove = toRemoveProxy.OriginalDelegate; - - Delegate[] invocationList = existing.GetInvocationList(); - bool removedItems = false; - - for (int idx = 0; idx < invocationList.Length; idx++) - { - Delegate item = invocationList[idx]; - ICallbackProxy itemProxy = item.Target as ICallbackProxy; - if (itemProxy != null) - { - item = itemProxy.OriginalDelegate; - } - - if (item.Equals(toRemove)) - { - invocationList[idx] = null; - removedItems = true; - } - } - - if (removedItems) - { - // We must create a new delegate containing the - // invocation list that is is left - existing = null; - foreach (Delegate d in invocationList) - { - if (d != null) - { - if (existing == null) - { - existing = d; - } - else - { - existing = Delegate.Combine(existing, d); - } - } - } - } - - return existing; - } - - // - // Implementation of default IEnumerable. - // - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - private interface ICallbackProxy - { - Delegate OriginalDelegate - { get; } - object OriginalTarget - { get; } - } - - // - // This is a simple proxy that converts a non-generic subscribe callback to a generic - // one. - // - // - private class SubscribeProxy : ICallbackProxy where TContextItemType : ContextItem - { - private SubscribeContextCallback _genericCallback; - - internal SubscribeProxy(SubscribeContextCallback callback) - { - _genericCallback = callback; - } - - internal SubscribeContextCallback Callback - { - get { - return new SubscribeContextCallback(SubscribeContext); - } - } - - Delegate ICallbackProxy.OriginalDelegate - { - get { return _genericCallback; } - } - - object ICallbackProxy.OriginalTarget - { - get { - return _genericCallback.Target; - } - } - - private void SubscribeContext(ContextItem item) - { - if (item == null) - { - throw FxTrace.Exception.ArgumentNull("item"); - } - _genericCallback((TContextItemType)item); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/EditingContext.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/EditingContext.cs deleted file mode 100644 index 923712df500..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/EditingContext.cs +++ /dev/null @@ -1,783 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- - -namespace System.Activities.Presentation -{ - using System.Activities.Presentation.Internal.Properties; - using System; - using System.Runtime; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.Globalization; - using System.Text; - using System.Activities.Presentation; - - // - // The EditingContext class contains contextual state about a designer. This includes permanent - // state such as list of services running in the designer. - // It also includes transient state consisting of context items. Examples of transient - // context item state include the set of currently selected objects as well as the editing tool - // being used to manipulate objects on the design surface. - // - // The editing context is designed to be a concrete class for ease of use. It does have a protected - // API that can be used to replace its implementation. - // - public class EditingContext : IDisposable - { - - private ContextItemManager _contextItems; - private ServiceManager _services; - - // - // Creates a new editing context. - // - public EditingContext() - { - } - - - // - // The Disposing event gets fired just before the context gets disposed. - // - public event EventHandler Disposing; - - // - // Returns the local collection of context items offered by this editing context. - // - // - public ContextItemManager Items - { - get { - if (_contextItems == null) - { - _contextItems = CreateContextItemManager(); - if (_contextItems == null) - { - throw FxTrace.Exception.AsError(new InvalidOperationException( - string.Format(CultureInfo.CurrentCulture, Resources.Error_NullImplementation, "CreateContextItemManager"))); - } - } - - return _contextItems; - } - } - - // - // Returns the service manager for this editing context. - // - // - public ServiceManager Services - { - get { - if (_services == null) - { - _services = CreateServiceManager(); - if (_services == null) - { - throw FxTrace.Exception.AsError(new InvalidOperationException( - string.Format(CultureInfo.CurrentCulture, Resources.Error_NullImplementation, "CreateServiceManager"))); - } - } - - return _services; - } - } - - // - // Creates an instance of the context item manager to be returned from - // the ContextItems property. The default implementation creates a - // ContextItemManager that supports delayed activation of design editor - // managers through the declaration of a SubscribeContext attribute on - // the design editor manager. - // - // Returns an implementation of the ContextItemManager class. - protected virtual ContextItemManager CreateContextItemManager() - { - return new DefaultContextItemManager(this); - } - - // - // Creates an instance of the service manager to be returned from the - // Services property. The default implementation creates a ServiceManager - // that supports delayed activation of design editor managers through the - // declaration of a SubscribeService attribute on the design editor manager. - // - // Returns an implemetation of the ServiceManager class. - protected virtual ServiceManager CreateServiceManager() - { - return new DefaultServiceManager(); - } - - // - // Disposes this editing context. - // - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - // - // Disposes this editing context. - // True if this object is being disposed, or false if it is finalizing. - // - protected virtual void Dispose(bool disposing) - { - if (disposing) - { - // Let any interested parties know the context is being disposed - if (Disposing != null) - { - Disposing(this, EventArgs.Empty); - } - - IDisposable d = _services as IDisposable; - if (d != null) - { - d.Dispose(); - } - - d = _contextItems as IDisposable; - if (d != null) - { - d.Dispose(); - } - } - } - - // - // This is the default context item manager for our editing context. - // - private sealed class DefaultContextItemManager : ContextItemManager - { - private EditingContext _context; - private DefaultContextLayer _currentLayer; - private Dictionary _subscriptions; - - internal DefaultContextItemManager(EditingContext context) - { - _context = context; - _currentLayer = new DefaultContextLayer(null); - } - - // - // This changes a context item to the given value. It is illegal to pass - // null here. If you want to set a context item to its empty value create - // an instance of the item using a default constructor. - // - // - public override void SetValue(ContextItem value) - { - if (value == null) - { - throw FxTrace.Exception.ArgumentNull("value"); - } - - // The rule for change is that we store the new value, - // raise a change on the item, and then raise a change - // to everyone else. If changing the item fails, we recover - // the previous item. - ContextItem existing, existingRawValue; - existing = existingRawValue = GetValueNull(value.ItemType); - - if (existing == null) - { - existing = GetValue(value.ItemType); - } - - bool success = false; - - try - { - _currentLayer.Items[value.ItemType] = value; - NotifyItemChanged(_context, value, existing); - success = true; - } - finally - { - if (success) - { - OnItemChanged(value); - } - else - { - // The item threw during its transition to - // becoming active. Put the old one back. - // We must put the old one back by re-activating - // it. This could throw a second time, so we - // cover this case by removing the value first. - // Should it throw again, we won't recurse because - // the existing raw value would be null. - - _currentLayer.Items.Remove(value.ItemType); - if (existingRawValue != null) - { - SetValue(existingRawValue); - } - } - } - } - - // - // Returns true if the item manager contains an item of the given type. - // This only looks in the current layer. - // - // - // - public override bool Contains(Type itemType) - { - if (itemType == null) - { - throw FxTrace.Exception.ArgumentNull("itemType"); - } - if (!typeof(ContextItem).IsAssignableFrom(itemType)) - { - throw FxTrace.Exception.AsError(new ArgumentException( - string.Format(CultureInfo.CurrentCulture, - Resources.Error_ArgIncorrectType, - "itemType", typeof(ContextItem).FullName))); - } - - return _currentLayer.Items.ContainsKey(itemType); - } - - // - // Returns an instance of the requested item type. If there is no context - // item with the given type, an empty item will be created. - // - // - // - public override ContextItem GetValue(Type itemType) - { - - ContextItem item = GetValueNull(itemType); - - if (item == null) - { - - // Check the default item table and add a new - // instance there if we need to - if (!_currentLayer.DefaultItems.TryGetValue(itemType, out item)) - { - item = (ContextItem)Activator.CreateInstance(itemType); - - // Verify that the resulting item has the correct item type - // If it doesn't, it means that the user provided a derived - // item type - if (item.ItemType != itemType) - { - throw FxTrace.Exception.AsError(new ArgumentException(string.Format( - CultureInfo.CurrentCulture, - Resources.Error_DerivedContextItem, - itemType.FullName, - item.ItemType.FullName))); - } - - // Now push the item in the context so we have - // a consistent reference - _currentLayer.DefaultItems.Add(item.ItemType, item); - } - } - - return item; - } - - // - // Similar to GetValue, but returns NULL if the item isn't found instead of - // creating an empty item. - // - // - // - private ContextItem GetValueNull(Type itemType) - { - - if (itemType == null) - { - throw FxTrace.Exception.ArgumentNull("itemType"); - } - if (!typeof(ContextItem).IsAssignableFrom(itemType)) - { - throw FxTrace.Exception.AsError(new ArgumentException( - string.Format(CultureInfo.CurrentCulture, - Resources.Error_ArgIncorrectType, - "itemType", typeof(ContextItem).FullName))); - } - - ContextItem item = null; - DefaultContextLayer layer = _currentLayer; - while (layer != null && !layer.Items.TryGetValue(itemType, out item)) - { - layer = layer.ParentLayer; - } - - return item; - } - - // - // Enumerates the context items in the editing context. This enumeration - // includes prior layers unless the enumerator hits an isolated layer. - // Enumeration is typically not useful in most scenarios but it is provided so - // that developers can search in the context and learn what is placed in it. - // - // - public override IEnumerator GetEnumerator() - { - return _currentLayer.Items.Values.GetEnumerator(); - } - - // - // Called when an item changes value. This happens in one of two ways: - // either the user has called Change, or the user has removed a layer. - // - // - private void OnItemChanged(ContextItem item) - { - SubscribeContextCallback callback; - - Fx.Assert(item != null, "You cannot pass a null item here."); - - if (_subscriptions != null && _subscriptions.TryGetValue(item.ItemType, out callback)) - { - callback(item); - } - } - - // - // Adds an event callback that will be invoked with a context item of the given item type changes. - // - // - // - public override void Subscribe(Type contextItemType, SubscribeContextCallback callback) - { - if (contextItemType == null) - { - throw FxTrace.Exception.ArgumentNull("contextItemType"); - } - if (callback == null) - { - throw FxTrace.Exception.ArgumentNull("callback"); - } - if (!typeof(ContextItem).IsAssignableFrom(contextItemType)) - { - throw FxTrace.Exception.AsError(new ArgumentException( - string.Format(CultureInfo.CurrentCulture, - Resources.Error_ArgIncorrectType, - "contextItemType", typeof(ContextItem).FullName))); - } - - if (_subscriptions == null) - { - _subscriptions = new Dictionary(); - } - - SubscribeContextCallback existing = null; - - _subscriptions.TryGetValue(contextItemType, out existing); - - existing = (SubscribeContextCallback)Delegate.Combine(existing, callback); - _subscriptions[contextItemType] = existing; - - // If the context is already present, invoke the callback. - ContextItem item = GetValueNull(contextItemType); - - if (item != null) - { - callback(item); - } - } - - // - // Removes a subscription. - // - public override void Unsubscribe(Type contextItemType, SubscribeContextCallback callback) - { - - if (contextItemType == null) - { - throw FxTrace.Exception.ArgumentNull("contextItemType"); - } - if (callback == null) - { - throw FxTrace.Exception.ArgumentNull("callback"); - } - if (!typeof(ContextItem).IsAssignableFrom(contextItemType)) - { - throw FxTrace.Exception.AsError(new ArgumentException( - string.Format(CultureInfo.CurrentCulture, - Resources.Error_ArgIncorrectType, - "contextItemType", typeof(ContextItem).FullName))); - } - if (_subscriptions != null) - { - SubscribeContextCallback existing; - if (_subscriptions.TryGetValue(contextItemType, out existing)) - { - existing = (SubscribeContextCallback)RemoveCallback(existing, callback); - if (existing == null) - { - _subscriptions.Remove(contextItemType); - } - else - { - _subscriptions[contextItemType] = existing; - } - } - } - } - - // - // This context layer contains our context items. - // - private class DefaultContextLayer - { - private DefaultContextLayer _parentLayer; - private Dictionary _items; - private Dictionary _defaultItems; - - internal DefaultContextLayer(DefaultContextLayer parentLayer) - { - _parentLayer = parentLayer; // can be null - } - - internal Dictionary DefaultItems - { - get { - if (_defaultItems == null) - { - _defaultItems = new Dictionary(); - } - return _defaultItems; - } - } - - internal Dictionary Items - { - get { - if (_items == null) - { - _items = new Dictionary(); - } - return _items; - } - } - - internal DefaultContextLayer ParentLayer - { - get { return _parentLayer; } - } - } - } - - // - // This is the default service manager for our editing context. - // - private sealed class DefaultServiceManager : ServiceManager, IDisposable - { - private static readonly object _recursionSentinel = new object(); - - private Dictionary _services; - private Dictionary _subscriptions; - - internal DefaultServiceManager() - { - } - - // - // Returns true if the service manager contains a service of the given type. - // - // - // - public override bool Contains(Type serviceType) - { - if (serviceType == null) - { - throw FxTrace.Exception.ArgumentNull("serviceType"); - } - return (_services != null && _services.ContainsKey(serviceType)); - } - - // - // Retrieves the requested service. This method returns null if the service could not be located. - // - // - // - public override object GetService(Type serviceType) - { - object result = this.GetPublishedService(serviceType); - if (result == null) - { - if (this.Contains(typeof(IServiceProvider))) - { - result = this.GetRequiredService().GetService(serviceType); - if (result != null) - { - this.Publish(serviceType, result); - } - } - } - return result; - } - - object GetPublishedService(Type serviceType) - { - object service = null; - - if (serviceType == null) - { - throw FxTrace.Exception.ArgumentNull("serviceType"); - } - - if (_services != null && _services.TryGetValue(serviceType, out service)) - { - - // If this service is our recursion sentinel, it means that someone is recursing - // while resolving a service callback. Throw to break out of the recursion - // cycle. - if (service == _recursionSentinel) - { - throw FxTrace.Exception.AsError(new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resources.Error_RecursionResolvingService, serviceType.FullName))); - } - - // See if this service is a callback. If it is, invoke it and store - // the resulting service back in the dictionary. - PublishServiceCallback callback = service as PublishServiceCallback; - if (callback != null) - { - - // Store a recursion sentinel in the dictionary so we can easily - // tell if someone is recursing - _services[serviceType] = _recursionSentinel; - try - { - service = callback(serviceType); - if (service == null) - { - throw FxTrace.Exception.AsError(new InvalidOperationException( - string.Format(CultureInfo.CurrentCulture, - Resources.Error_NullService, - callback.Method.DeclaringType.FullName, - serviceType.FullName))); - } - - if (!serviceType.IsInstanceOfType(service)) - { - throw FxTrace.Exception.AsError(new InvalidOperationException( - string.Format(CultureInfo.CurrentCulture, - Resources.Error_IncorrectServiceType, - callback.Method.DeclaringType.FullName, - serviceType.FullName, - service.GetType().FullName))); - } - } - finally - { - // Note, this puts the callback back in place if it threw. - _services[serviceType] = service; - } - } - } - - // If the service is not found locally, do not walk up the parent chain. - // This was a major source of unreliability with the component model - // design. For a service to be accessible from the editing context, it - // must be added. - - return service; - } - - // - // Retrieves an enumerator that can be used to enumerate all of the services that this - // service manager publishes. - // - // - public override IEnumerator GetEnumerator() - { - if (_services == null) - { - _services = new Dictionary(); - } - - return _services.Keys.GetEnumerator(); - } - - // - // Calls back on the provided callback when someone has published the requested service. - // If the service was already available, this method invokes the callback immediately. - // - // A generic version of this method is provided for convience, and calls the non-generic - // method with appropriate casts. - // - // - // - public override void Subscribe(Type serviceType, SubscribeServiceCallback callback) - { - if (serviceType == null) - { - throw FxTrace.Exception.ArgumentNull("serviceType"); - } - if (callback == null) - { - throw FxTrace.Exception.ArgumentNull("callback"); - } - - object service = GetService(serviceType); - if (service != null) - { - - // If the service is already available, callback immediately - callback(serviceType, service); - } - else - { - - // Otherwise, store this for later - if (_subscriptions == null) - { - _subscriptions = new Dictionary(); - } - SubscribeServiceCallback existing = null; - _subscriptions.TryGetValue(serviceType, out existing); - existing = (SubscribeServiceCallback)Delegate.Combine(existing, callback); - _subscriptions[serviceType] = existing; - } - } - - // - // Calls back on the provided callback when someone has published the requested service. - // If the service was already available, this method invokes the callback immediately. - // - // A generic version of this method is provided for convience, and calls the non-generic - // method with appropriate casts. - // - // - // - public override void Publish(Type serviceType, PublishServiceCallback callback) - { - if (serviceType == null) - { - throw FxTrace.Exception.ArgumentNull("serviceType"); - } - if (callback == null) - { - throw FxTrace.Exception.ArgumentNull("callback"); - } - - Publish(serviceType, (object)callback); - } - - // - // If you already have an instance to a service, you can publish it here. - // - // - // - public override void Publish(Type serviceType, object serviceInstance) - { - if (serviceType == null) - { - throw FxTrace.Exception.ArgumentNull("serviceType"); - } - if (serviceInstance == null) - { - throw FxTrace.Exception.ArgumentNull("serviceInstance"); - } - - if (!(serviceInstance is PublishServiceCallback) && !serviceType.IsInstanceOfType(serviceInstance)) - { - throw FxTrace.Exception.AsError(new ArgumentException( - string.Format(CultureInfo.CurrentCulture, - Resources.Error_IncorrectServiceType, - typeof(ServiceManager).Name, - serviceType.FullName, - serviceInstance.GetType().FullName))); - } - - if (_services == null) - { - _services = new Dictionary(); - } - - try - { - _services.Add(serviceType, serviceInstance); - } - catch (ArgumentException e) - { - throw FxTrace.Exception.AsError(new ArgumentException(string.Format( - CultureInfo.CurrentCulture, - Resources.Error_DuplicateService, serviceType.FullName), e)); - } - - // Now see if there were any subscriptions that required this service - SubscribeServiceCallback subscribeCallback; - if (_subscriptions != null && _subscriptions.TryGetValue(serviceType, out subscribeCallback)) - { - subscribeCallback(serviceType, GetService(serviceType)); - _subscriptions.Remove(serviceType); - } - } - - // - // Removes a subscription. - // - public override void Unsubscribe(Type serviceType, SubscribeServiceCallback callback) - { - - if (serviceType == null) - { - throw FxTrace.Exception.ArgumentNull("serviceType"); - } - if (callback == null) - { - throw FxTrace.Exception.ArgumentNull("callback"); - } - - if (_subscriptions != null) - { - SubscribeServiceCallback existing; - if (_subscriptions.TryGetValue(serviceType, out existing)) - { - existing = (SubscribeServiceCallback)RemoveCallback(existing, callback); - if (existing == null) - { - _subscriptions.Remove(serviceType); - } - else - { - _subscriptions[serviceType] = existing; - } - } - } - } - - // - // We implement IDisposable so that the editing context can destroy us when it - // shuts down. - // - void IDisposable.Dispose() - { - if (_services != null) - { - Dictionary services = _services; - - try - { - foreach (object value in services.Values) - { - IDisposable d = value as IDisposable; - if (d != null) - { - d.Dispose(); - } - } - } - finally - { - _services = null; - } - } - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/EnumValidator.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/EnumValidator.cs deleted file mode 100644 index 63192030314..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/EnumValidator.cs +++ /dev/null @@ -1,26 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//----------------------------------------------------------------------------- - -namespace System.Activities.Presentation -{ - using System; - - // - // Class containing a single IsValid() method that ensures - // that the given public enum is of expected value. Use this - // method to validate the enum value of all publicly exposed setters. - // - internal static partial class EnumValidator - { - public static bool IsValid(OrderTokenPrecedence value) - { - return value == OrderTokenPrecedence.Before || value == OrderTokenPrecedence.After; - } - - public static bool IsValid(OrderTokenConflictResolution value) - { - return value == OrderTokenConflictResolution.Win || value == OrderTokenConflictResolution.Lose; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/GenericTypeParameterConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/GenericTypeParameterConverter.cs deleted file mode 100644 index 8ea855c8357..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/GenericTypeParameterConverter.cs +++ /dev/null @@ -1,150 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Core -{ - using System; - using System.Globalization; - using System.Text; - using System.Windows.Data; - using System.Activities.Presentation.Model; - - using System.Activities.Presentation; - - // This class is used for generating collections of passed type argument, based on the - // fully qualified type name passed as containerParameter. i.e. one may convert - // Foo class into List - internal sealed class GenericTypeParameterConverter : IValueConverter - { - - bool displayFullName; - - public GenericTypeParameterConverter() : this(false) - { - } - - public GenericTypeParameterConverter(bool displayFullName) - { - this.displayFullName = displayFullName; - } - - object IValueConverter.Convert(object value, Type convertToType, object containerParameter, CultureInfo culture) - { - Type[] argumentTypes = GetGenericTypeArguments(value); - Type containerType = GetContainerType(containerParameter); - - if (null != argumentTypes && null != containerType) - { - Type resultType = BuildTargetType(argumentTypes, containerType); - return HandleConversion(resultType, convertToType); - } - - containerType = GetContainerType(value); - if (null != containerType) - { - return HandleConversion(containerType, convertToType); - } - return null; - } - - object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw FxTrace.Exception.AsError(new NotImplementedException()); - } - - Type GetContainerType(object value) - { - if (null == value) - { - return null; - } - if (value is ModelItem) - { - value = ((ModelItem)value).GetCurrentValue(); - } - if (value is Type) - { - return (Type)value; - } - else if (value is string) - { - return Type.GetType((string)value, false, true); - } - return null; - } - - Type[] GetGenericTypeArguments(object value) - { - Type[] result = null; - if (value is ModelItem) - { - value = ((ModelItem)value).GetCurrentValue(); - } - if (null != value && (value is Type)) - { - Type type = (Type)value; - if (type.IsGenericType) - { - result = type.GetGenericArguments(); - } - else - { - result = new Type[] { type }; - } - } - return result; - } - - Type BuildTargetType(Type[] argumentTypes, Type containerType) - { - if (containerType.IsGenericType) - { - return containerType.MakeGenericType(argumentTypes); - } - return containerType; - } - - object HandleConversion(Type resultType, Type convertToType) - { - if (typeof(string) == convertToType) - { - if (resultType.IsGenericType) - { - StringBuilder strBldr = new StringBuilder(); - if (this.displayFullName) - { - strBldr.Append(resultType.FullName.Substring(0, resultType.FullName.IndexOf('`'))); - } - else - { - strBldr.Append(resultType.Name.Substring(0, resultType.Name.IndexOf('`'))); - } - - strBldr.Append("<"); - bool addComma = false; - foreach (Type arg in resultType.GetGenericArguments()) - { - strBldr.Append(addComma ? "," : string.Empty); - if (arg.IsGenericType) - { - strBldr.Append(HandleConversion(arg, convertToType)); - } - else - { - strBldr.Append(this.displayFullName ? arg.FullName : arg.Name); - } - addComma = true; - } - strBldr.Append(">"); - return strBldr.ToString(); - } - return this.displayFullName ? resultType.FullName : resultType.Name; - } - else if (typeof(Type) == convertToType) - { - return resultType; - } - return null; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/Metadata/AttributeData.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/Metadata/AttributeData.cs deleted file mode 100644 index 06af11c37c6..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/Metadata/AttributeData.cs +++ /dev/null @@ -1,100 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.Metadata -{ - using System; - using System.Collections.Generic; - using System.Text; - using System.Diagnostics; - using System.Runtime; - - // This class groups Attribute with its AttributeUsageAttributes that we care about. - // Basically, each Attribute has characteristics that are useful to know about, - // such as whether it can be inherited and whether there can be more than - // one instance of that attribute extending whatever it is the attribute - // is extending (class, method, property, or event). Those characteristics - // are stored as attributes themselves and, as such, are costly to retrieve. - // This class retrieves that information exactly once, on demand, and caches it for - // further use. - internal class AttributeData - { - - private Type _attributeType; - private bool? _isInheritable; - private bool? _allowsMultiple; - - // - // Creates an AttributeData wrapper around Attribute type to expose its - // Inherit and AllowMultiple characteristics - // - // Attribute type to wrap around - internal AttributeData(Type attributeType) - { - Fx.Assert(attributeType != null, "attributeType parameter should not be null"); - _attributeType = attributeType; - } - - // - // Gets the contained attribute type - // - internal Type AttributeType - { - get { - return _attributeType; - } - } - - // - // Gets the AllowMultiple characteristic of the - // contained attribute and caches the result for subsequent - // calls to this property. - // - internal bool AllowsMultiple - { - get { - if (_allowsMultiple == null) - { - ParseUsageAttributes(); - } - - return (bool)_allowsMultiple; - } - } - - // - // Gets the Inherit characteristic of the - // contained attribute and caches the result for subsequent - // calls to this property. - // - internal bool IsInheritable - { - get { - if (_isInheritable == null) - { - ParseUsageAttributes(); - } - - return (bool)_isInheritable; - } - } - - private void ParseUsageAttributes() - { - _isInheritable = false; - _allowsMultiple = false; - object[] usageAttributes = _attributeType.GetCustomAttributes(typeof(AttributeUsageAttribute), true); - - if (usageAttributes != null && usageAttributes.Length > 0) - { - for (int i = 0; i < usageAttributes.Length; i++) - { - Fx.Assert(usageAttributes[i] is AttributeUsageAttribute, "usageAttributes should be of type AttributeUsageAttribute"); - AttributeUsageAttribute usageAttribute = (AttributeUsageAttribute)usageAttributes[i]; - _isInheritable = usageAttribute.Inherited; - _allowsMultiple = usageAttribute.AllowMultiple; - } - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/Metadata/AttributeDataCache.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/Metadata/AttributeDataCache.cs deleted file mode 100644 index ef3da8bad2d..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/Metadata/AttributeDataCache.cs +++ /dev/null @@ -1,272 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.Metadata -{ - using System; - using System.Collections.Generic; - using System.Text; - using System.Activities.Presentation.Metadata; - using System.Reflection; - using System.Diagnostics; - using System.Collections; - using System.Globalization; - using System.Diagnostics.CodeAnalysis; - using System.Runtime; - - // - // Helper class that knows how to look up the base implementation of a given MemberInfo, - // as well as custom attributes from the MetadataStore or the CLR. However, it does not - // actually cache those attributes. We can add this functionality in the future if needed. - // On the other hand, this class does cache the map between attribute types and our internal - // AttributeData data structures that contain AttributeUsageAttributes so we don't have to keep - // looking them up via reflection. - // - internal static class AttributeDataCache - { - - // BindingFlags used for all GetInfo() types of calls - private static readonly BindingFlags _getInfoBindingFlags = - BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic | - BindingFlags.Public | BindingFlags.Static; - - // Note: we use Hashtables instead of Dictionaries because they are thread safe for - // read operations without the need for explicit locking. - - // Hashtable of MemberInfos to their base MemberInfos, or null if there is no base MemberInfo - private static Hashtable _baseMemberMap = new Hashtable(); - - // Hashtable of attribute Types to their corresponding AttributeData classes - private static Hashtable _attributeDataCache = new Hashtable(); - - // Indicator for no MemberInfo in _baseMemberMap: Null value means the base MemberInfo wasn't - // looked up yet, _noMemberInfo value means it was looked up but it doesn't exist. - private static object _noMemberInfo = new object(); - - // Used for thread safety - private static object _syncObject = new object(); - - // This table gets populated once at initialization, so there is no need for a Hashtable here - private static Dictionary _baseMemberFinders; - - // Static Ctor to populate the lookup table for helper methods that know how - // to look up the base MemberInfo of a particular MemberType (ctor, method, event, ...) - [SuppressMessage(FxCop.Category.Performance, FxCop.Rule.InitializeReferenceTypeStaticFieldsInline)] - static AttributeDataCache() - { - _baseMemberFinders = new Dictionary(); - _baseMemberFinders[MemberTypes.Constructor] = new GetBaseMemberCallback(GetBaseConstructorInfo); - _baseMemberFinders[MemberTypes.Method] = new GetBaseMemberCallback(GetBaseMethodInfo); - _baseMemberFinders[MemberTypes.Property] = new GetBaseMemberCallback(GetBasePropertyInfo); - _baseMemberFinders[MemberTypes.Event] = new GetBaseMemberCallback(GetBaseEventInfo); - } - - // - // Gets the base MemberInfo for the specified MemberInfo. For types, - // the method returns the base type, if any. For methods, events, and properties - // the method returns the base method, event, or property, if they exists, null - // otherwise. - // - // MemberInfo to look up in the base class - // Specified MemberInfo in the base class if it exists, null otherwise. - internal static MemberInfo GetBaseMemberInfo(MemberInfo member) - { - object baseMember = _baseMemberMap[member]; - if (baseMember == _noMemberInfo) - { - return null; - } - - if (baseMember == null) - { - baseMember = CalculateBaseMemberInfo(member); - - // With Hashtable we only need to lock on writes - lock (_syncObject) - { - _baseMemberMap[member] = baseMember ?? _noMemberInfo; - } - } - - return (MemberInfo)baseMember; - } - - // - // Looks up the specified MemberInfo in the custom MetadataStore AttributeTables - // and returns any attributes associated with it as an enumeration. This method - // does not return any inherited attributes. - // - // Type to look up - // Member name to look up. If null, attributes associated - // with the type itself will be returned. - // AttributeTables to look in - // Attributes in the AttributeTables associated with the specified - // Type and member name. - internal static IEnumerable GetMetadataStoreAttributes(Type type, string memberName, AttributeTable[] tables) { - if (tables == null || tables.Length == 0) - { - yield break; - } - - foreach (AttributeTable table in tables) - { - if (table.ContainsAttributes(type)) - { - IEnumerable attrEnum; - if (memberName == null) - { - attrEnum = table.GetCustomAttributes(type); - } - else - { - attrEnum = table.GetCustomAttributes(type, memberName); - } - - foreach (object attr in attrEnum) - { - yield return attr; - } - } - } - } - - // - // Looks up custom attributes for the specified MemberInfo in CLR via reflection - // and returns them as an enumeration. This method does not return any - // inherited attributes. - // - // MemberInfo to look up - // Custom Attributes associated with the specified - // MemberInfo in the CLR. - internal static IEnumerable GetClrAttributes(MemberInfo member) - { - object[] attrs = member.GetCustomAttributes(false); - Fx.Assert(attrs != null, "It looks like GetCustomAttributes() CAN return null. Protect for it."); - return attrs; - } - - // - // Gets an existing instance of AttributeData associated with the - // specified attribute Type, or creates a new one and caches it for - // later. AttributeData is used as a cache for AttributeUsageAttributes - // so don't have to keep using reflection to get them. - // - // Attribute type to look up - // Instance of AttributeData associated with the specified - // attribute type. - internal static AttributeData GetAttributeData(Type attributeType) - { - AttributeData attrData = _attributeDataCache[attributeType] as AttributeData; - - if (attrData == null) - { - attrData = new AttributeData(attributeType); - - // With Hashtable we only need to lock on writes - lock (_syncObject) - { - _attributeDataCache[attributeType] = attrData; - } - } - - return attrData; - } - - // - // Tries to get the base MemberInfo associated with the specified - // member info, if any. - // - private static MemberInfo CalculateBaseMemberInfo(MemberInfo member) - { - Fx.Assert(member != null, "member parameter should not be null"); - - // Type is a special case that covers the majority of cases - Type type = member as Type; - if (type != null) - { - return type.BaseType; - } - - Type targetType = member.DeclaringType.BaseType; - - Fx.Assert( - _baseMemberFinders.ContainsKey(member.MemberType), - string.Format( - CultureInfo.CurrentCulture, - "Didn't know how to look up the base MemberInfo for member type {0}. " + - "Please update the list of known GetBaseInfoCallbacks in AttributeDataCache.", - member.MemberType)); - - MemberInfo baseMemberInfo = null; - - while (targetType != null && baseMemberInfo == null) - { - baseMemberInfo = _baseMemberFinders[member.MemberType](member, targetType); - targetType = targetType.BaseType; - } - - return baseMemberInfo; - } - - // - // Helper method that knows how to look up the base constructor of a class. However, - // since constructors can't derive from one another, this method always returns - // null. - // - private static MemberInfo GetBaseConstructorInfo(MemberInfo info, Type targetType) - { - return null; - } - - // - // Helper method that knows how to look up the base implementation of a virtual method. - // - private static MemberInfo GetBaseMethodInfo(MemberInfo info, Type targetType) - { - MethodInfo methodInfo = info as MethodInfo; - Fx.Assert(methodInfo != null, "It looks like MemberType did not match the type of MemberInfo: " + info.GetType().Name); - return targetType.GetMethod(methodInfo.Name, _getInfoBindingFlags, null, ToTypeArray(methodInfo.GetParameters()), null); - } - - // - // Helper method that knows how to look up the base implementation of a virtual property. - // - private static MemberInfo GetBasePropertyInfo(MemberInfo info, Type targetType) - { - PropertyInfo propInfo = info as PropertyInfo; - Fx.Assert(propInfo != null, "It looks like MemberType did not match the type of MemberInfo: " + info.GetType().Name); - return targetType.GetProperty(propInfo.Name, _getInfoBindingFlags, null, propInfo.PropertyType, ToTypeArray(propInfo.GetIndexParameters()), null); - } - - // - // Helper method that knows how to look up the base implementation of a virtual event. - // - private static MemberInfo GetBaseEventInfo(MemberInfo info, Type targetType) - { - EventInfo eventInfo = info as EventInfo; - Fx.Assert(eventInfo != null, "It looks like MemberType did not match the type of MemberInfo: " + info.GetType().Name); - return targetType.GetEvent(eventInfo.Name, _getInfoBindingFlags); - } - - // - // Helper that converts ParamenterInfo[] into Type[] - // - private static Type[] ToTypeArray(ParameterInfo[] parameterInfo) { - if (parameterInfo == null) - { - return null; - } - - Type[] parameterTypes = new Type[parameterInfo.Length]; - for (int i = 0; i < parameterInfo.Length; i++) - { - parameterTypes[i] = parameterInfo[i].ParameterType; - } - - return parameterTypes; - } - - // Delegate used to call specific methods to get a base MemberInfo from the given MemberInfo - private delegate MemberInfo GetBaseMemberCallback(MemberInfo member, Type targetType); - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/Metadata/MutableAttributeTable.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/Metadata/MutableAttributeTable.cs deleted file mode 100644 index f6d0338654a..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/Metadata/MutableAttributeTable.cs +++ /dev/null @@ -1,621 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Internal.Metadata -{ - - using System.Activities.Presentation.Internal.Properties; - using System; - using System.Collections; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.Globalization; - using System.Reflection; - using System.Windows; - using System.Activities.Presentation.Metadata; - using System.Runtime; - using System.Diagnostics.CodeAnalysis; - using System.Activities.Presentation; - - // - // This class is used by the attribute table builder to - // add attributes. It is then handed to AttributeTable - // and accessed in a read-only fashion. - // - internal class MutableAttributeTable - { - private static object[] _empty = new object[0]; - - private Dictionary _metadata; - - internal MutableAttributeTable() - { - _metadata = new Dictionary(); - } - - // - // Returns the types we're handing metadata for - // - internal IEnumerable AttributedTypes - { - get { return _metadata.Keys; } - } - - // - // Private helper to add a portion of an existing table. - // - private static void AddAttributeMetadata(TypeMetadata newMd, TypeMetadata existingMd) - { - if (newMd.TypeAttributes != null) - { - if (existingMd.TypeAttributes != null) - { - existingMd.TypeAttributes.AddRange(newMd.TypeAttributes); - } - else - { - existingMd.TypeAttributes = newMd.TypeAttributes; - } - } - } - - // - // Helper to add a enum of attributes ot an existing list - // - private static void AddAttributes(AttributeList list, IEnumerable attributes) - { - // Attributes are ordered so those at the end of the - // list take prececence over those at the front. - list.AddRange(attributes); - } - - internal void AddCallback(Type type, AttributeCallback callback) - { - Fx.Assert(type != null && callback != null, "type or callback parameter is null"); - AttributeList list = GetTypeList(type); - list.Add(callback); - } - - // - // Adds custom attrs for a type - // - internal void AddCustomAttributes(Type type, IEnumerable attributes) - { - Fx.Assert(type != null && attributes != null, "type or attributes parameter is null"); - AddAttributes(GetTypeList(type), attributes); - } - - // - // Adds custom attrs for a descriptor - // - internal void AddCustomAttributes(Type ownerType, MemberDescriptor descriptor, IEnumerable attributes) - { - Fx.Assert(ownerType != null && descriptor != null && attributes != null, "ownerType/descriptor/attributes is null"); - AddAttributes(GetMemberList(ownerType, descriptor.Name), attributes); - } - - // - // Adds custom attrs for a member - // - internal void AddCustomAttributes(Type ownerType, MemberInfo member, IEnumerable attributes) - { - Fx.Assert(ownerType != null && member != null && attributes != null, "ownertype/member/attributes parameter is null"); - AddAttributes(GetMemberList(ownerType, member.Name), attributes); - } - - // - // Adds custom attrs for a dp - // - internal void AddCustomAttributes(Type ownerType, DependencyProperty dp, IEnumerable attributes) - { - Fx.Assert(ownerType != null && dp != null && attributes != null, "ownerType/dp/attributes parameter is null"); - AddAttributes(GetMemberList(ownerType, dp.Name), attributes); - } - - // - // Adds custom attrs for a member name - // - internal void AddCustomAttributes(Type ownerType, string memberName, IEnumerable attributes) - { - Fx.Assert(ownerType != null && memberName != null && attributes != null, "ownerType/membername/attributes parameter is null"); - AddAttributes(GetMemberList(ownerType, memberName), attributes); - } - - // - // Private helper to add a portion of an existing table. - // - private static void AddMemberMetadata(TypeMetadata newMd, TypeMetadata existingMd) - { - if (newMd.MemberAttributes != null) - { - if (existingMd.MemberAttributes != null) - { - foreach (KeyValuePair kv in newMd.MemberAttributes) - { - AttributeList existing; - if (existingMd.MemberAttributes.TryGetValue(kv.Key, out existing)) - { - existing.AddRange(kv.Value); - } - else - { - existingMd.MemberAttributes.Add(kv.Key, kv.Value); - } - } - } - else - { - existingMd.MemberAttributes = newMd.MemberAttributes; - } - } - } - - // - // Adds an existing table. - // - internal void AddTable(MutableAttributeTable table) - { - Fx.Assert(table != null, "table parameter is null"); - foreach (KeyValuePair kv in table._metadata) - { - AddTypeMetadata(kv.Key, kv.Value); - } - } - - // - // Private helper to add a portion of an existing table. - // - private void AddTypeMetadata(Type type, TypeMetadata md) - { - TypeMetadata existing; - if (_metadata.TryGetValue(type, out existing)) - { - AddAttributeMetadata(md, existing); - AddMemberMetadata(md, existing); - } - else - { - _metadata.Add(type, md); - } - } - - // - // Returns true if this table contains attributes for the - // given type - // - internal bool ContainsAttributes(Type type) - { - Fx.Assert(type != null, "type parameter is null"); - return (_metadata.ContainsKey(type)); - } - - // - // Helper method that walks through an attribute list and expands all callbacks - // within it. - // - private void ExpandAttributes(Type type, AttributeList attributes) - { - Fx.Assert(!attributes.IsExpanded, "Should not call expand attributes with an expanded list."); - - // First, expand all the callbacks. This may add more attributes - // into our list - // - for (int idx = 0; idx < attributes.Count; idx++) - { - AttributeCallback callback = attributes[idx] as AttributeCallback; - while (callback != null) - { - attributes.RemoveAt(idx); - AttributeCallbackBuilder builder = new AttributeCallbackBuilder(this, type); - callback(builder); - - if (idx < attributes.Count) - { - callback = attributes[idx] as AttributeCallback; - } - else - { - callback = null; - } - } - } - } - - // - // Returns custom attributes for the type. - // - internal IEnumerable GetCustomAttributes(Type type) - { - Fx.Assert(type != null, "type parameter is null"); - - AttributeList attributes = GetExpandedAttributes(type, null, delegate(Type typeToGet, object callbackParam) - { - TypeMetadata md; - if (_metadata.TryGetValue(typeToGet, out md)) - { - return md.TypeAttributes; - } - return null; - }); - - if (attributes != null) - { - return attributes.AsReadOnly(); - } - - return _empty; - } - - // - // Returns custom attributes for the descriptor. - // - internal IEnumerable GetCustomAttributes(Type ownerType, MemberDescriptor descriptor) - { - Fx.Assert(ownerType != null && descriptor != null, "ownerType or descriptor parameter is null"); - return GetCustomAttributes(ownerType, descriptor.Name); - } - - // - // Returns custom attributes for the dp. - // - internal IEnumerable GetCustomAttributes(Type ownerType, DependencyProperty dp) - { - Fx.Assert(ownerType != null && dp != null, "ownerType or dp parameter is null"); - return GetCustomAttributes(ownerType, dp.Name); - } - - // - // Returns custom attributes for the member. - // - internal IEnumerable GetCustomAttributes(Type ownerType, MemberInfo member) - { - Fx.Assert(ownerType != null && member != null, "ownerType or memeber parameter is null"); - return GetCustomAttributes(ownerType, member.Name); - } - - // - // Returns custom attributes for the member. - // - internal IEnumerable GetCustomAttributes(Type ownerType, string memberName) - { - Fx.Assert(ownerType != null && memberName != null, "ownerType or memberName parameter is null"); - - AttributeList attributes = GetExpandedAttributes(ownerType, memberName, delegate(Type typeToGet, object callbackParam) - { - string name = (string)callbackParam; - TypeMetadata md; - - if (_metadata.TryGetValue(typeToGet, out md)) - { - - // If member attributes are null but type attributes are not, - // it is possible that expanding type attributes could cause - // member attributes to be added. Check. - - if (md.MemberAttributes == null && md.TypeAttributes != null && !md.TypeAttributes.IsExpanded) - { - ExpandAttributes(ownerType, md.TypeAttributes); - } - - if (md.MemberAttributes != null) - { - AttributeList list; - if (md.MemberAttributes.TryGetValue(name, out list)) - { - return list; - } - } - } - - return null; - }); - - if (attributes != null) - { - return attributes.AsReadOnly(); - } - - return _empty; - } - - // - // Helper to demand create the attribute list ofr a dependency property. - // - private AttributeList GetMemberList(Type ownerType, string memberName) - { - Fx.Assert(ownerType != null && memberName != null, "ownerType or memberName parameter is null"); - TypeMetadata md = GetTypeMetadata(ownerType); - - if (md.MemberAttributes == null) - { - md.MemberAttributes = new Dictionary(); - } - - AttributeList list; - if (!md.MemberAttributes.TryGetValue(memberName, out list)) - { - list = new AttributeList(); - md.MemberAttributes.Add(memberName, list); - } - - return list; - } - - // - // Expands a type attribute table for use. - // Attribute tables only contain attributes for - // the given type, and may have callbacks embedded - // within them. - // - private AttributeList GetExpandedAttributes(Type type, object callbackParam, GetAttributesCallback callback) - { - - // Do we have attributes to expand? - - AttributeList attributes = callback(type, callbackParam); - if (attributes != null) - { - - // If these attributes haven't been expanded yet, do that - // now. - - if (!attributes.IsExpanded) - { - - // We have a lock here because multiple people could be - // surfing type information at the same time from multiple - // threads. While we are read only once we are expanded, - // we do modify the list here to expand the callbacks and - // merge. Therefore, we need to acquire a lock. - - lock (attributes) - { - if (!attributes.IsExpanded) - { - ExpandAttributes(type, attributes); - attributes.IsExpanded = true; - } - } - } - } - - return attributes; - } - - // - // Helper to demand create the attribute list for a type. - // - private AttributeList GetTypeList(Type type) - { - Fx.Assert(type != null, "type parameter is null"); - TypeMetadata md = GetTypeMetadata(type); - if (md.TypeAttributes == null) - { - md.TypeAttributes = new AttributeList(); - } - return md.TypeAttributes; - } - - // - // Helper to demand create the type metadata. - // - private TypeMetadata GetTypeMetadata(Type type) - { - Fx.Assert(type != null, "type parameter is null"); - TypeMetadata md; - if (!_metadata.TryGetValue(type, out md)) - { - md = new TypeMetadata(); - _metadata.Add(type, md); - } - return md; - } - - - // - // Called by the MetadataStore to walk through all the metadata and - // ensure that it can be found on the appropriate types and members. - // Any asserts that come from here are bugs in the type description - // provider. - // - internal void DebugValidateProvider() - { -#if DEBUG - foreach (KeyValuePair kv in _metadata -) { - if (kv.Value.TypeAttributes != -null) { - AttributeCollection attrs = TypeDescriptor.GetAttributes(kv.Key); - foreach (object o in kv.Value -.TypeAttributes) { - Attribute a = o as Attribute; - if (a -!= null) { - bool found = false; - foreach (Attribute a2 - in attrs) { - if (a.TypeId.Equals -(a2.TypeId)) { - found = true; - break; - } - } - - Fx.Assert( - found, - string.Format(CultureInfo.CurrentCulture, "Attribute {0} on type {1} is missing from provider.", - a.GetType().Name, kv.Key.Name)); - } - } - } - - if (kv.Value -.MemberAttributes != null) { - foreach (KeyValuePair kvDesc -in kv.Value.MemberAttributes) { - PropertyDescriptor p; - EventDescriptor e; - AttributeCollection attrs = null; - string member = "unknown"; - - if ((p = TypeDescriptor.GetProperties(kv.Key)[kvDesc.Key]) != null) { - attrs = p.Attributes; - member = p.Name; - } - else if ((e = TypeDescriptor.GetEvents(kv.Key)[kvDesc.Key]) != null) { - attrs = e.Attributes; - member = e.Name; - } - else if ((p = DependencyPropertyDescriptor.FromName(kvDesc.Key, kv.Key, typeof( -DependencyObject))) != null) { - attrs = p.Attributes; - member = p.Name; - } - - if (attrs != null) { - foreach -(object o in kvDesc.Value) { - Attribute a = o as Attribute; - - if (a != null) { - bool found = false; - - foreach (Attribute a2 in attrs) { - -if (a.TypeId.Equals(a2.TypeId)) { - found = true; - break; - } - } - - Fx.Assert( - found, - string.Format(CultureInfo.CurrentCulture, "Attribute {0} on member {1}.{2} is missing from provider.", - a.GetType().Name, kv.Key.Name, member)); - } - } - } - } - } - } -#else -#endif - } - - // - // Performs validation of all metadata in the table. - // This expands all callbacks so it can be very expensive - // for large tables. - // - public void ValidateTable() - { - - List errors = null; - - foreach (KeyValuePair kv in _metadata) - { - - // Walk type attributes. We don't need to compare these - // to anything because there is no way for them to be - // invalid. We simply get them to ensure they don't throw - - GetCustomAttributes(kv.Key); - - // Walk member attributes. We need to ensure that all member descriptors - // of type LookupMemberDescriptor have matching members (property or event) - // on the target type. Other members are already validated by the fact - // that they exist. - - if (kv.Value.MemberAttributes != null) - { - - foreach (KeyValuePair kvMember in kv.Value.MemberAttributes) - { - - // Validate that the attribute expansion doesn't throw - GetCustomAttributes(kv.Key, kvMember.Key); - - // Validate that the member name matches a real proeprty/event and there - // are no duplicates - - PropertyDescriptor p = DependencyPropertyDescriptor.FromName(kvMember.Key, kv.Key, typeof(DependencyObject)); - EventDescriptor e = TypeDescriptor.GetEvents(kv.Key)[kvMember.Key]; - if (p == null && e == null) - { - p = TypeDescriptor.GetProperties(kv.Key)[kvMember.Key]; - } - - string errorMsg = null; - if (p == null && e == null) - { - errorMsg = string.Format( - CultureInfo.CurrentCulture, - Resources.Error_ValidationNoMatchingMember, - kvMember.Key, kv.Key.FullName); - } - else if (p != null && e != null) - { - errorMsg = string.Format( - CultureInfo.CurrentCulture, - Resources.Error_ValidationAmbiguousMember, - kvMember.Key, kv.Key.FullName); - } - - if (errorMsg != null) - { - if (errors == null) - { - errors = new List(); - } - errors.Add(errorMsg); - } - } - } - } - - // Did we get any errors? - if (errors != null) - { - throw FxTrace.Exception.AsError(new AttributeTableValidationException( - Resources.Error_TableValidationFailed, - errors)); - } - } - - // - // We have a generic attribute expansion routine - // that relies on someone else providing a mechanism - // for returning the base attribute list. If there - // is no base list, this callback can return null. - // - private delegate AttributeList GetAttributesCallback(Type type, object callbackParam); - - // - // All metadata for a type is stored here. - // - private class TypeMetadata - { - internal AttributeList TypeAttributes; - internal Dictionary MemberAttributes; - } - - // - // Individual attributes for a member or type are stored - // here. Attribute lists can be "expanded", so their - // callbacks are evaluated and their attributes are - // merged with their base attribute list. - // - private class AttributeList : List - { - private bool _isExpanded; - - internal bool IsExpanded - { - get { return _isExpanded; } - set { _isExpanded = value; } - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedChoiceEditor.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedChoiceEditor.cs deleted file mode 100644 index 3b2d8bf0429..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedChoiceEditor.cs +++ /dev/null @@ -1,59 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Automation -{ - using System; - using System.Windows; - using System.Windows.Automation.Peers; - using System.Windows.Data; - - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.ValueEditors; - - // - // Blend's ChoiceEditor that we augment with our an AutomationPeer - // - internal class AutomatedChoiceEditor : ChoiceEditor - { - - // - // AutomationValueConverter is used to expose an IValueConverter that the - // ChoiceEditorAutomationPeer uses to convert the selected item into a - // string exposed through the automation APIs. If no converver is specified - // (default), we call ToString() on the item. - // - public static DependencyProperty AutomationValueConverterProperty = DependencyProperty.Register( - "AutomationValueConverter", - typeof(IValueConverter), - typeof(AutomatedChoiceEditor), - new PropertyMetadata(null)); - - internal event DependencyPropertyChangedEventHandler DependencyPropertyChanged; - - // - // Gets or set AutomationValueConverter - // - public IValueConverter AutomationValueConverter - { - get { return (IValueConverter)this.GetValue(AutomationValueConverterProperty); } - set { this.SetValue(AutomationValueConverterProperty, value); } - } - - protected override AutomationPeer OnCreateAutomationPeer() - { - return new HiddenUIElementAutomationPeer(this); - } - - // Expose DependencyPropertyChanged event to which the AutomationPeer listens, broadcasting - // its own set of automation events as needed. - protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) - { - if (DependencyPropertyChanged != null) - { - DependencyPropertyChanged(this, e); - } - - base.OnPropertyChanged(e); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedComboBox.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedComboBox.cs deleted file mode 100644 index eeb336a89f0..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedComboBox.cs +++ /dev/null @@ -1,38 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Automation -{ - using System; - using System.Diagnostics.CodeAnalysis; - using System.Windows.Automation.Peers; - using System.Windows.Controls; - - // - // Standard ComboBox. However, it uses AutomatedListBoxItemAutomationPeer to represent - // all items within it, which is our class and which allows us to return user-friendly - // representation of all Cider structures exposed through automation. - // - [SuppressMessage("Microsoft.Maintainability", "CA1501:AvoidExcessiveInheritance")] - internal class AutomatedComboBox : ComboBox - { - - protected override AutomationPeer OnCreateAutomationPeer() - { - return new AutomatedComboBoxAutomationPeer(this); - } - - private class AutomatedComboBoxAutomationPeer : ComboBoxAutomationPeer - { - public AutomatedComboBoxAutomationPeer(AutomatedComboBox owner) - : base(owner) - { - } - - protected override ItemAutomationPeer CreateItemAutomationPeer(object item) - { - return new AutomatedListBoxItemAutomationPeer(item, this); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedListBox.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedListBox.cs deleted file mode 100644 index 4a597e31128..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedListBox.cs +++ /dev/null @@ -1,38 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Automation -{ - using System; - using System.Diagnostics.CodeAnalysis; - using System.Windows.Controls; - using System.Windows.Automation.Peers; - - // - // Standard ListBox. However, it uses AutomatedListBoxItemAutomationPeer to represent - // all items within it, which is our class and which allows us to return user-friendly - // representation of all Cider structures exposed through automation. - // - [SuppressMessage("Microsoft.Maintainability", "CA1501:AvoidExcessiveInheritance")] - internal class AutomatedListBox : ListBox - { - - protected override AutomationPeer OnCreateAutomationPeer() - { - return new AutomatedListBoxAutomationPeer(this); - } - - private class AutomatedListBoxAutomationPeer : ListBoxAutomationPeer - { - public AutomatedListBoxAutomationPeer(ListBox owner) - : base(owner) - { - } - - protected override ItemAutomationPeer CreateItemAutomationPeer(object item) - { - return new AutomatedListBoxItemAutomationPeer(item, this); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedListBoxItemAutomationPeer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedListBoxItemAutomationPeer.cs deleted file mode 100644 index 3a9a827cdfd..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/AutomatedListBoxItemAutomationPeer.cs +++ /dev/null @@ -1,32 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Automation -{ - using System; - using System.Globalization; - using System.Windows.Automation.Peers; - - using System.Activities.Presentation.PropertyEditing; - - using System.Activities.Presentation.Internal.PropertyEditing.Editors; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - - // - // Cider-specific wrapper for ListBoxItemAutomationPeer that overrides GetNameCore() - // and returns a user-friendly name for all Cider structures exposed through automation. - // - internal class AutomatedListBoxItemAutomationPeer : ListBoxItemAutomationPeer - { - - public AutomatedListBoxItemAutomationPeer(object item, SelectorAutomationPeer owner) - : base(item, owner) - { - } - - protected override string GetNameCore() - { - return EditorUtilities.GetDisplayName(this.Item); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/CategoryContainerAutomationPeer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/CategoryContainerAutomationPeer.cs deleted file mode 100644 index 1af6d568a3c..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/CategoryContainerAutomationPeer.cs +++ /dev/null @@ -1,660 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Automation -{ - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.Text; - using System.Windows; - using System.Windows.Automation; - using System.Windows.Automation.Peers; - using System.Windows.Automation.Provider; - using System.Windows.Controls; - using System.Windows.Media; - - using System.Runtime; - using System.Activities.Presentation.PropertyEditing; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - - using System.Activities.Presentation.Internal.Properties; - using System.Activities.Presentation.Internal.PropertyEditing.Model; - using System.Activities.Presentation.Internal.PropertyEditing.Selection; - - // - // This class contains the core logic for CategoryContainerAutomationPeer. It's constructor is - // private because it can be instantiated in two different ways, which are exposed through - // static methods: CreateStandAloneAutomationPeer() and CreateItemAutomationPeer(). - // - // CreateStandAloneAutomationPeer() returns an AutomationPeer that is agnostic of its parent - // CreateItemAutomationPeer() returns an AutomationPeer where the parent is assumed to be an ItemsControl. - // - // Because in the CategoryList : ItemsControl class we manually override GetContainerForItemOverride() - // as a way of reducing control count in PI, we need to provide both versions of the - // CategoryContainerAutomationPeer. - // - internal class CategoryContainerAutomationPeer : IExpandCollapseProvider, IScrollItemProvider - { - - private CiderCategoryContainer _container; - private AutomationPeer _itemAutomationPeer; - - // Private ctor called from two public, static accessors - private CategoryContainerAutomationPeer(CiderCategoryContainer container, AutomationPeer itemPeer) - { - Fx.Assert(container != null, "CategoryContainer not specified."); - Fx.Assert(itemPeer != null, "CategoryContainerItemAutomationPeer not specified."); - _container = container; - _itemAutomationPeer = itemPeer; - - } - - // - // Gets the expand / collapse state of the contained CategoryContainer - // - public ExpandCollapseState ExpandCollapseState - { - get { - if (_container == null) - { - return ExpandCollapseState.Collapsed; - } - - return _container.Expanded ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed; - } - } - - // IScrollItemProvider Members - - // - // Creates a CategoryContainerAutomationPeer that can be returned directly from - // the CiderCategoryContainer control itself. - // - // Container to automate - // Instance of CategoryContainerAutomationPeer that can be returned directly from - // the CiderCategoryContainer control itself - public static UIElementAutomationPeer CreateStandAloneAutomationPeer(CiderCategoryContainer container) - { - return new CategoryContainerStandAloneAutomationPeer(container); - } - - // - // Creates a CategoryContainerAutomationPeer that can be returned for CategoryContainers - // belonging to a CategoryList control - // - // CategoryEntry instance used by ItemsControl - // Container to automate - // Parent AutomationPeer - // Instance of CategoryContainerAutomationPeer that can be returned for CategoryContainers - // belonging to a CategoryList control - public static ItemAutomationPeer CreateItemAutomationPeer(ModelCategoryEntry category, CiderCategoryContainer container, CategoryListAutomationPeer parentAutomationPeer) - { - return new CategoryContainerItemAutomationPeer(category, container, parentAutomationPeer); - } - - // Gets the children of the contained CategoryContainer, returning AutomationPeers - // for CategoryEditors followed by AutomationPeers for any left-over properties - private List GetChildrenCore() - { - List children = new List(); - - if (_container != null) - { - AddCategoryEditors(children, VisualTreeUtils.GetNamedChild(_container, "PART_BasicCategoryEditors"), Resources.PropertyEditing_BasicCategoryEditors); - AddCategoryProperties(children, VisualTreeUtils.GetNamedChild(_container, "PART_BasicPropertyList")); - - if (_container.Expanded) - { - - Expander advancedExpander = VisualTreeUtils.GetNamedChild(_container, "PART_AdvancedExpander"); - - if (advancedExpander != null && - advancedExpander.Visibility == Visibility.Visible) - { - children.Add(new AdvancedCategoryContainerAutomationPeer(_container, advancedExpander)); - } - } - } - - return children; - } - - // Adds AutomationPeers for all CategoryEditors displayed within the contained CategoryContainer - private static void AddCategoryEditors(List peers, ItemsControl editors, string containerDisplayName) - { - if (editors == null || editors.Items.Count == 0) - { - return; - } - - peers.Add(new CategoryEditorListAutomationPeer(containerDisplayName, editors)); - } - - // Adds AutomationPeers for all PropertyEntries not consumed by the CategoryEditors within this - // CategoryContainer - private static void AddCategoryProperties(List peers, ItemsControl properties) - { - if (properties == null) - { - return; - } - - int childCount = properties.Items.Count; - - for (int i = 0; i < childCount; i++) - { - PropertyContainer propertyContainer = properties.ItemContainerGenerator.ContainerFromIndex(i) as PropertyContainer; - - if (propertyContainer != null) - { - peers.Add(new PropertyContainerAutomationPeer(propertyContainer)); - } - } - } - - // Gets the implementation of the specified pattern if one exists. - // Currently supported patterns: ExpandCollapse - private object GetPattern(PatternInterface patternInterface) - { - if (patternInterface == PatternInterface.ExpandCollapse) - { - return this; - } - else if (patternInterface == PatternInterface.ScrollItem) - { - return this; - } - - return null; - } - - // Returns the name of the represented category - private string GetNameCore() - { - if (_container != null) - { - return _container.Category.CategoryName; - } - - return string.Empty; - } - - // Return "CategoryContainer" - private static string GetClassNameCore() - { - return typeof(CategoryContainer).Name; - } - - // Gets the help text to associated with the contained CategoryContainer - private static string GetHelpTextCore() - { - return Resources.PropertyEditing_CategoryContainerAutomationPeerHelp; - } - - // IExpandCollapseProvider Members - - // - // Collapses the contained CategoryContainer - // - public void Collapse() - { - if (_container != null) - { - _container.Expanded = false; - } - } - - // - // Expands the contained CategoryContainer - // - public void Expand() - { - if (_container != null) - { - _container.Expanded = true; - } - } - - // - // Scrolls the contained CategoryContainer into view - // - public void ScrollIntoView() - { - if (_container != null) - { - _container.BringIntoView(); - } - } - - - // RaiseSelectionEventsForScreenReader - - // - // This public method is called when parent creates the CategoryContainerItemAutomationPeer - // in the GetChildrenCore, thus listening to the changes in the IsSelectedProperty. - // - public void AddFocusEvents() - { - if (_container != null) - { - HookUpFocusEvents(VisualTreeUtils.GetNamedChild(_container, "PART_MainExpander"), OnIsSelectedValueChanged); - } - } - - // - // Private helper function to listen to the changes in the IsSelectedProperty, - // which then fires the OnValueChanged event. - // - // Expander control - // ValueChanged event - private static void HookUpFocusEvents(Expander expander, EventHandler valueChangedEvent) - { - if (expander != null) - { - FrameworkElement expanderGrid = VisualTreeUtils.GetNamedChild(expander, "PART_BasicSection"); - if (expanderGrid != null) - { - DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(PropertySelection.IsSelectedProperty, typeof(Grid)); - if (dpd != null) - { - dpd.AddValueChanged(expanderGrid, valueChangedEvent); - } - } - } - } - - // - // The actual event handler, that fires when the IsSelected DP changes. - // Here we raise the AutomationFocus event. - // - // Expander - // EventArgs - private void OnIsSelectedValueChanged(object sender, EventArgs e) - { - // Add logic to respond to "Selection" - bool curVal = PropertySelection.GetIsSelected(sender as DependencyObject); - if (curVal) - { - _itemAutomationPeer.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged); - } - } - - - - // - // This public method is called when parent creates the CategoryContainerItemAutomationPeer - // in the GetChildrenCore, thus clearing off all the event listeners before we add new ones - // - public void RemoveFocusEvents() - { - if (_container != null) - { - UnHookFocusEvents(VisualTreeUtils.GetNamedChild(_container, "PART_MainExpander"), OnIsSelectedValueChanged); - } - } - - // - // Private method to unhook the ValueChanged event. - // - // Expander - // ValueChanged event - private static void UnHookFocusEvents(Expander expander, EventHandler valueChangedEvent) - { - if (expander != null) - { - FrameworkElement expanderGrid = VisualTreeUtils.GetNamedChild(expander, "PART_BasicSection"); - if (expanderGrid != null) - { - DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(PropertySelection.IsSelectedProperty, typeof(Grid)); - if (dpd != null) - { - dpd.RemoveValueChanged(expanderGrid, valueChangedEvent); - } - } - } - } - - // end RaiseSelectionEventsForScreenReader - - // - // Helper AutomationPeer that represents CategoryContainerAutomationPeer when the CategoryContainer - // is hosted in a CategoryList control. All of its methods delegate to CategoryContainerAutomationPeer - // - internal class CategoryContainerItemAutomationPeer : ItemAutomationPeer, IAutomationFocusChangedEventSource - { - - private CategoryContainerAutomationPeer _coreLogic; - private List _children; - - public CategoryContainerItemAutomationPeer( - ModelCategoryEntry item, - CiderCategoryContainer container, - CategoryListAutomationPeer parentAutomationPeer) - : base(item, parentAutomationPeer) - { - _coreLogic = new CategoryContainerAutomationPeer(container, this); - _coreLogic.AddFocusEvents(); - } - - // Implementation of this method is specific to CategoryContainerItemAutomationPeer - protected override AutomationControlType GetAutomationControlTypeCore() - { - return AutomationControlType.List; - } - - protected override List GetChildrenCore() - { - _children = _coreLogic.GetChildrenCore(); - return _children; - } - - protected override string GetNameCore() - { - return _coreLogic.GetNameCore(); - } - - protected override string GetClassNameCore() - { - return CategoryContainerAutomationPeer.GetClassNameCore(); - } - - protected override string GetHelpTextCore() - { - return CategoryContainerAutomationPeer.GetHelpTextCore(); - } - - public override object GetPattern(PatternInterface patternInterface) - { - return _coreLogic.GetPattern(patternInterface); - } - - // IAutomationFocusChangedEventSource Members - public void UnloadEventHook() - { - _coreLogic.RemoveFocusEvents(); - if (_children != null) - { - foreach (AutomationPeer peer in _children) - { - IAutomationFocusChangedEventSource unhookEventPeer = peer as IAutomationFocusChangedEventSource; - if (unhookEventPeer != null) - { - unhookEventPeer.UnloadEventHook(); - } - } - } - } - } - - // - // Automation peer we use to display the list of CategoryEditors - // - private class CategoryEditorListAutomationPeer : ItemsControlAutomationPeer - { - - private string _displayName; - - // Note: the display name we use here is for completeness only. This class is hidden - // from screen readers. - public CategoryEditorListAutomationPeer(string displayName, ItemsControl owner) - : base(owner) - { - _displayName = displayName ?? string.Empty; - } - - protected override ItemAutomationPeer CreateItemAutomationPeer(object item) - { - return new CategoryEditorAutomationPeer(item, this); - } - - protected override string GetClassNameCore() - { - return typeof(ItemsControl).Name; - } - protected override string GetNameCore() - { - return _displayName; - } - protected override bool IsControlElementCore() - { - return false; - } - protected override bool IsContentElementCore() - { - return false; - } - - private class CategoryEditorAutomationPeer : ItemAutomationPeer - { - - public CategoryEditorAutomationPeer(object item, CategoryEditorListAutomationPeer parent) - : base(item, parent) - { - } - - public override object GetPattern(PatternInterface patternInterface) - { - return null; - } - protected override AutomationControlType GetAutomationControlTypeCore() - { - return AutomationControlType.Custom; - } - protected override string GetClassNameCore() - { - return typeof(CategoryEditor).Name; - } - protected override string GetNameCore() - { - return Item == null ? string.Empty : Item.GetType().Name; - } - protected override bool IsContentElementCore() - { - return true; - } - protected override bool IsControlElementCore() - { - return true; - } - } - } - - // - // Helper AutomationPeer for the advanced portion of the CategoryContainer - // - private class AdvancedCategoryContainerAutomationPeer : ExpanderAutomationPeer, IAutomationFocusChangedEventSource - { - - private CiderCategoryContainer _container; - private Expander _expander; - private List _children; - - public AdvancedCategoryContainerAutomationPeer(CiderCategoryContainer container, Expander expander) - : base(expander) - { - Fx.Assert(container != null, "CategoryContainer not specified."); - Fx.Assert(expander != null, "Expander not specified."); - _expander = expander; - _container = container; - AddFocusEvents(); - } - - // - // This public method is called when parent creates the CategoryContainerItemAutomationPeer - // in the GetChildrenCore, thus listening to the changes in the IsSelectedProperty. - // - private void AddFocusEvents() - { - if (_container != null) - { - HookUpFocusEvents(VisualTreeUtils.GetNamedChild(_container, "PART_AdvancedExpander"), OnIsSelectedValueChanged); - } - } - - protected override List GetChildrenCore() - { - _children = new List(); - if (_container != null) - { - CategoryContainerAutomationPeer.AddCategoryEditors(_children, VisualTreeUtils.GetNamedChild(_container, "PART_AdvancedCategoryEditors"), Resources.PropertyEditing_AdvancedCategoryEditors); - CategoryContainerAutomationPeer.AddCategoryProperties(_children, VisualTreeUtils.GetNamedChild(_container, "PART_AdvancedPropertyList")); - } - //Add focus events for Subproperty editor - foreach (AutomationPeer peer in _children) - { - PropertyContainerAutomationPeer pcAutomationPeer = peer as PropertyContainerAutomationPeer; - if (pcAutomationPeer != null) - { - pcAutomationPeer.AddFocusEvents(); - } - } - return _children; - } - - protected override string GetNameCore() - { - return _expander.Header.ToString(); - } - - // - // Private helper function to listen to the changes in the IsSelectedProperty, - // which then fires the OnValueChanged event. - // - // Expander control - // ValueChanged event - private static void HookUpFocusEvents(Expander expander, EventHandler valueChangedEvent) - { - if (expander != null) - { - FrameworkElement expanderGrid = VisualTreeUtils.GetNamedChild(expander, "PART_AdvancedSection"); - if (expanderGrid != null) - { - DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(PropertySelection.IsSelectedProperty, typeof(Grid)); - if (dpd != null) - { - dpd.AddValueChanged(expanderGrid, valueChangedEvent); - } - } - } - } - - // - // The actual event handler, that fires when the IsSelected DP changes. - // Here we raise the AutomationFocus event for the - // Advanced (More Properties) properties expander. - // - // Expander - // EventArgs - private void OnIsSelectedValueChanged(object sender, EventArgs e) - { - // Add logic to respond to "Selection" - bool curVal = PropertySelection.GetIsSelected(sender as DependencyObject); - if (curVal) - { - this.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged); - } - } - - // - // This public method is called when parent creates the CategoryContainerItemAutomationPeer - // in the GetChildrenCore, thus clearing off all the event listeners before we add new ones - // - public void RemoveFocusEvents() - { - if (_container != null) - { - UnHookFocusEvents(VisualTreeUtils.GetNamedChild(_container, "PART_AdvancedExpander"), OnIsSelectedValueChanged); - } - } - - // - // Private method to unhook the ValueChanged event. - // - // Expander - // ValueChanged event - private static void UnHookFocusEvents(Expander expander, EventHandler valueChangedEvent) - { - if (expander != null) - { - FrameworkElement expanderGrid = VisualTreeUtils.GetNamedChild(expander, "PART_AdvancedSection"); - if (expanderGrid != null) - { - DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(PropertySelection.IsSelectedProperty, typeof(Grid)); - if (dpd != null) - { - dpd.RemoveValueChanged(expanderGrid, valueChangedEvent); - } - } - } - } - - // IAutomationFocusChangedEventSource Members - public void UnloadEventHook() - { - RemoveFocusEvents(); - if (_children != null) - { - foreach (AutomationPeer peer in _children) - { - IAutomationFocusChangedEventSource unhookEventPeer = peer as IAutomationFocusChangedEventSource; - if (unhookEventPeer != null) - { - unhookEventPeer.UnloadEventHook(); - } - } - } - } - } - - // - // Helper AutomationPeer that represents CategoryContainerAutomationPeer when the CategoryContainer - // sits on its own. All of its methods delegate to CategoryContainerAutomationPeer - // - private class CategoryContainerStandAloneAutomationPeer : UIElementAutomationPeer, IAutomationFocusChangedEventSource - { - - private CategoryContainerAutomationPeer _coreLogic; - - public CategoryContainerStandAloneAutomationPeer(CiderCategoryContainer container) - : base(container) - { - _coreLogic = new CategoryContainerAutomationPeer(container, this); - _coreLogic.AddFocusEvents(); - } - - protected override List GetChildrenCore() - { - return _coreLogic.GetChildrenCore(); - } - - protected override string GetNameCore() - { - return _coreLogic.GetNameCore(); - } - - protected override string GetClassNameCore() - { - return CategoryContainerAutomationPeer.GetClassNameCore(); - } - - protected override string GetHelpTextCore() - { - return CategoryContainerAutomationPeer.GetHelpTextCore(); - } - - public override object GetPattern(PatternInterface patternInterface) - { - return _coreLogic.GetPattern(patternInterface); - } - - // IAutomationFocusChangedEventSource Members - - public void UnloadEventHook() - { - _coreLogic.RemoveFocusEvents(); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/CategoryListAutomationPeer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/CategoryListAutomationPeer.cs deleted file mode 100644 index c31d46aae03..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/CategoryListAutomationPeer.cs +++ /dev/null @@ -1,120 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Automation -{ - using System; - using System.Collections.Generic; - using System.Diagnostics; - using System.Globalization; - using System.Text; - using System.Windows; - using System.Windows.Automation; - using System.Windows.Automation.Peers; - using System.Windows.Automation.Provider; - using System.Windows.Controls; - using System.Windows.Media; - - using System.Activities.Presentation.PropertyEditing; - using System.Activities.Presentation; - - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - using System.Activities.Presentation.Internal.PropertyEditing.Model; - using System.Activities.Presentation.Internal.PropertyEditing.Selection; - using System.Activities.Presentation.Internal.Properties; - - // - // AutomationPeer for CategoryList class - // - internal class CategoryListAutomationPeer : ItemsControlAutomationPeer, IAutomationFocusChangedEventSource - { - - private CategoryList _control; - // Children list. - private List _children; - - // - // Basic ctor - // - // Contained CategoryList - public CategoryListAutomationPeer(CategoryList owner) - : base(owner) - { - if (owner == null) - { - throw FxTrace.Exception.ArgumentNull("owner"); - } - - _control = owner; - _children = new List(); - } - - protected override ItemAutomationPeer CreateItemAutomationPeer(object item) - { - - ItemAutomationPeer peer = CategoryContainerAutomationPeer.CreateItemAutomationPeer( - item as ModelCategoryEntry, - _control.ItemContainerGenerator.ContainerFromItem(item) as CiderCategoryContainer, - this); - - //Add each item to the children's list - _children.Add(peer); - - return peer; - } - - protected override string GetClassNameCore() - { - return typeof(ItemsControl).Name; - } - - protected override string GetNameCore() - { - return Resources.PropertyEditing_CategoryList; - } - - // We use the ItemStatus to convey read-only property selection status - protected override string GetItemStatusCore() - { - FrameworkElement selection = _control.Selection; - string status; - - if (selection != null) - { - ISelectionStop selectionStop = PropertySelection.GetSelectionStop(selection); - status = selectionStop == null ? null : selectionStop.Description; - - if (status == null) - { - status = string.Format( - CultureInfo.CurrentCulture, - Resources.PropertyEditing_SelectionStatus_Unknown, - selection.GetType().Name); - } - } - else - { - status = Resources.PropertyEditing_SelectionStatus_Empty; - } - - return status; - } - - // IAutomationFocusChangedEventSource Members - public void UnloadEventHook() - { - if (_children != null) - { - foreach (AutomationPeer peer in _children) - { - IAutomationFocusChangedEventSource unhookEventPeer = peer as IAutomationFocusChangedEventSource; - if (unhookEventPeer != null) - { - unhookEventPeer.UnloadEventHook(); - } - } - } - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/HiddenUIElementAutomationPeer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/HiddenUIElementAutomationPeer.cs deleted file mode 100644 index 54c378b2b32..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/HiddenUIElementAutomationPeer.cs +++ /dev/null @@ -1,22 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Automation -{ - using System.Windows.Automation.Peers; - using System.Windows; - // Implementation of UIElementAutomationPeer that in and of itself does not show up on - // a screen reader's radar, but that does expose any of its children that should - class HiddenUIElementAutomationPeer : UIElementAutomationPeer - { - public HiddenUIElementAutomationPeer(UIElement owner) - : base(owner) - { - } - - protected override bool IsControlElementCore() - { - return false; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/IAutomationFocusChangedEventSource.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/IAutomationFocusChangedEventSource.cs deleted file mode 100644 index 0aaf5fffbf9..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/IAutomationFocusChangedEventSource.cs +++ /dev/null @@ -1,15 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Internal.PropertyEditing.Automation -{ - using System; - using System.Collections.Generic; - using System.Text; - - internal interface IAutomationFocusChangedEventSource - { - void UnloadEventHook(); - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/PropertyContainerAutomationPeer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/PropertyContainerAutomationPeer.cs deleted file mode 100644 index 08ce7b719e9..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/PropertyContainerAutomationPeer.cs +++ /dev/null @@ -1,206 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Automation -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.ComponentModel; - using System.Text; - using System.Windows; - using System.Windows.Automation; - using System.Windows.Automation.Peers; - using System.Windows.Automation.Provider; - using System.Windows.Controls; - using System.Windows.Media; - - using System.Activities.Presentation; - using System.Activities.Presentation.PropertyEditing; - - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - using System.Activities.Presentation.Internal.PropertyEditing.Selection; - - // - // AutomationPeer for PropertyContainer - // - internal class PropertyContainerAutomationPeer : UIElementAutomationPeer, IValueProvider, IScrollItemProvider, IAutomationFocusChangedEventSource - { - - private PropertyContainer _container; - - // - // Basic ctor - // - // - public PropertyContainerAutomationPeer(PropertyContainer container) - : base(container) - { - if (container == null) - { - throw FxTrace.Exception.ArgumentNull("container"); - } - - _container = container; - } - - // - // Gets a value indicating whether the contained PropertyContainer is read-only - // - public bool IsReadOnly - { - get { return _container.PropertyEntry.IsReadOnly || !_container.PropertyEntry.PropertyValue.CanConvertFromString; } - } - - // - // Gets the value of the property within the PropertyContainer - // - public string Value - { - get { return _container.PropertyEntry.PropertyValue.StringValue; } - } - - - // IScrollItemProvider Members - - // - // This public method is called when parent creates the CategoryContainerItemAutomationPeer - // in the GetChildrenCore, thus listening to the changes in the IsSelectedProperty. - // - internal void AddFocusEvents() - { - if (_container != null) - { - HookUpFocusEvents(_container, OnIsSelectedValueChanged); - } - } - - // - // "PropertyContainer" - // - // "PropertyContainer" - protected override string GetClassNameCore() - { - return typeof(PropertyContainer).Name; - } - - // - // Returns the name of the contained property - // - // - protected override string GetNameCore() - { - return _container.PropertyEntry == null ? string.Empty : _container.PropertyEntry.DisplayName; - } - - // - // Currently supported patterns: Value - // - // - // - public override object GetPattern(PatternInterface patternInterface) - { - if (patternInterface == PatternInterface.Value) - { - return this; - } - else if (patternInterface == PatternInterface.ScrollItem) - { - return this; - } - - return base.GetPattern(patternInterface); - } - - // - // Private helper function to listen to the changes in the IsSelectedProperty, - // which then fires the OnValueChanged event. - // - // Expander control - // ValueChanged event - private static void HookUpFocusEvents(PropertyContainer container, EventHandler valueChangedEvent) - { - if (container != null) - { - DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(PropertySelection.IsSelectedProperty, typeof(PropertyContainer)); - if (dpd != null) - { - dpd.AddValueChanged(container, valueChangedEvent); - } - } - } - - // - // The actual event handler, that fires when the IsSelected DP changes. - // Here we raise the AutomationFocus event for the - // Advanced (More Properties) properties expander. - // - // Expander - // EventArgs - private void OnIsSelectedValueChanged(object sender, EventArgs e) - { - // Add logic to respond to "Selection" - bool curVal = PropertySelection.GetIsSelected(sender as DependencyObject); - if (curVal) - { - this.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged); - } - } - - // - // This public method is called when parent creates the CategoryContainerItemAutomationPeer - // in the GetChildrenCore, thus clearing off all the event listeners before we add new ones - // - public void RemoveFocusEvents() - { - if (_container != null) - { - UnHookFocusEvents(_container, OnIsSelectedValueChanged); - } - } - - // - // Private method to unhook the ValueChanged event. - // - // Expander - // ValueChanged event - private static void UnHookFocusEvents(PropertyContainer container, EventHandler valueChangedEvent) - { - if (container != null) - { - DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(PropertySelection.IsSelectedProperty, typeof(PropertyContainer)); - if (dpd != null) - { - dpd.RemoveValueChanged(container, valueChangedEvent); - } - } - } - - // IValueProvider Members - - // - // Sets the value of the property within the PropertyContainer - // - // Value to set - public void SetValue(string value) - { - _container.PropertyEntry.PropertyValue.StringValue = value; - } - - // - // Scrolls the contained PropertyContainer into view, if it's within a scrolling control - // - public void ScrollIntoView() - { - _container.BringIntoView(); - } - - - // IAutomationFocusChangedEventSource Members - public void UnloadEventHook() - { - RemoveFocusEvents(); - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/PropertyInspectorAutomationPeer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/PropertyInspectorAutomationPeer.cs deleted file mode 100644 index 1ee3df07bbf..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/PropertyInspectorAutomationPeer.cs +++ /dev/null @@ -1,145 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Automation -{ - using System; - using System.Collections.Generic; - using System.Windows.Automation.Peers; - using System.Windows.Controls; - using System.Windows; - - using System.Activities.Presentation; - using System.Activities.Presentation.Internal.Properties; - using System.Windows.Input; - - // - // AutomationPeer for PropertyInspector - // - internal class PropertyInspectorAutomationPeer : UIElementAutomationPeer - { - - private PropertyInspector _inspector; - - // Current list of children automation peers. - private List _children; - - public PropertyInspectorAutomationPeer(PropertyInspector owner) - : base(owner) - { - if (owner == null) - { - throw FxTrace.Exception.ArgumentNull("owner"); - } - - _inspector = owner; - } - - // - // Gets a list of AutomationPeers that contains the following: - // Type text box - // Name text box - // List of CategoryContainerAutomationPeers - // - // - protected override List GetChildrenCore() - { - // If children list is not null and contains AutomationPeer that implements IAutomationFocusChangedEventSource - // Then, unhook the automation focus events before clearing the list - // Else, create a new one. - if (_children != null) - { - foreach (AutomationPeer peer in _children) - { - IAutomationFocusChangedEventSource unhookEventPeer = peer as IAutomationFocusChangedEventSource; - if (unhookEventPeer != null) - { - unhookEventPeer.UnloadEventHook(); - } - } - _children.Clear(); - } - else - { - _children = new List(); - } - _children.Add(new TextBlockAutomationPeer(_inspector.SelectionTypeLabel)); - _children.Add(new UIElementAutomationPeer(_inspector.PropertyToolBar)); - _children.Add(new InfoTextBlockAutomationPeer(_inspector.UninitializedLabel)); - _children.Add(new InfoTextBlockAutomationPeer(_inspector.NoSearchResultsLabel)); - _children.Add(new CategoryListAutomationPeer(_inspector.CategoryList)); - - return _children; - } - - protected override Point GetClickablePointCore() - { - // return a point that, when clicked, selects the grid without selecting - // any of the rows - return this.Owner.PointToScreen(new Point(10, 10)); - } - - protected override string GetHelpTextCore() - { - return Resources.PropertyEditing_PropertyInspectorAutomationPeerHelp; - } - - protected override string GetNameCore() - { - return Resources.PropertyEditing_PropertyInspector; - } - - protected override string GetClassNameCore() - { - return typeof(PropertyInspector).Name; - } - - // The following automation peers provide accessiblity support (Raise automation events on receiving keyboard focus) - // This is necessary for ACC-TOOLS especially screen readers like JAWS. - // We cannot use the base AutomationPeers (like UIElementAutomationPeer) and *have* to derive from the respective types - // since the actual implementation of the handler when the focus event differs from element to element. - // So we cannot use single base class to achieve the desired goal. - // - - - private class InfoTextBlockAutomationPeer : TextBlockAutomationPeer, IAutomationFocusChangedEventSource - { - - private TextBlock _informationLabel; - - public InfoTextBlockAutomationPeer(TextBlock informationLabel) - : base(informationLabel) - { - if (informationLabel == null) - { - throw FxTrace.Exception.ArgumentNull("informationLabel"); - } - _informationLabel = informationLabel; - _informationLabel.PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(OnPreviewGotKeyboardFocus); - } - - // - // PreviewGotKeyboardFocus event to raise the "AutomationFocus" event. - // - // TextBlock - // KeyboardFocusChangedEventArgs - void OnPreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) - { - this.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged); - } - - protected override AutomationPeer GetLabeledByCore() - { - return new TextBlockAutomationPeer(_informationLabel); - } - - // IAutomationFocusChangedEventSource Members - - public void UnloadEventHook() - { - Owner.PreviewGotKeyboardFocus -= new KeyboardFocusChangedEventHandler(OnPreviewGotKeyboardFocus); - } - - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/SubPropertyEditorAutomationPeer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/SubPropertyEditorAutomationPeer.cs deleted file mode 100644 index 6d6a089cbca..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/SubPropertyEditorAutomationPeer.cs +++ /dev/null @@ -1,156 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Automation -{ - using System; - using System.Collections.Generic; - using System.Windows; - using System.Windows.Automation; - using System.Windows.Automation.Peers; - using System.Windows.Automation.Provider; - using System.Windows.Controls; - using System.Windows.Media; - - using System.Activities.Presentation.PropertyEditing; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.ValueEditors; - - using System.Activities.Presentation.Internal.PropertyEditing.Editors; - using System.Activities.Presentation.Internal.Properties; - - // - // AutomationPeer for the SubPropertyEditor - // - internal class SubPropertyEditorAutomationPeer : UIElementAutomationPeer, IExpandCollapseProvider - { - - private SubPropertyEditor _editor; - List _children; - - public SubPropertyEditorAutomationPeer(SubPropertyEditor editor) - : base(editor) - { - _editor = editor; - - // Hook into the VisualsChanged event so that this peer can invalidate - // itself appropriately - if (editor != null) - { - editor.VisualsChanged += new EventHandler(OnEditorVisualsChanged); - } - - _children = new List(); - - } - - // - // Gets the ExpandCollapse state of the sub-properties - // - public ExpandCollapseState ExpandCollapseState - { - get { - return _editor.IsExpanded ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed; - } - } - - - protected override string GetNameCore() - { - return Resources.PropertyEditing_SubPropertyEditorAutomationName; - } - - protected override string GetClassNameCore() - { - return typeof(SubPropertyEditor).Name; - } - - // Support the ExpandCollapse pattern - public override object GetPattern(PatternInterface patternInterface) - { - if (patternInterface == PatternInterface.ExpandCollapse) - { - return this; - } - - return base.GetPattern(patternInterface); - } - - protected override List GetChildrenCore() - { - if (_children != null) - { - foreach (AutomationPeer peer in _children) - { - IAutomationFocusChangedEventSource unhookEventPeer = peer as IAutomationFocusChangedEventSource; - if (unhookEventPeer != null) - { - unhookEventPeer.UnloadEventHook(); - } - } - _children.Clear(); - } - - // See if we have access to the QuickTypes combo box (it may or may not be available) - AutomatedChoiceEditor choiceEditor = VisualTreeUtils.GetNamedChild(_editor, "PART_ValueEditor"); - - // If we do, present it as one of our children - if (choiceEditor != null) - { - _children.Add(new HiddenUIElementAutomationPeer(choiceEditor)); - } - - // Add any sub-properties - ItemsControl properties = VisualTreeUtils.GetNamedChild(_editor, "PART_SubPropertyList"); - - if (properties != null) - { - int childCount = properties.Items.Count; - - for (int i = 0; i < childCount; i++) - { - PropertyContainer propertyContainer = properties.ItemContainerGenerator.ContainerFromIndex(i) as PropertyContainer; - - if (propertyContainer != null) - { - PropertyContainerAutomationPeer peer = new PropertyContainerAutomationPeer(propertyContainer); - _children.Add(peer); - } - - } - } - - return _children; - } - - private void OnEditorVisualsChanged(object sender, EventArgs e) - { - this.InvalidatePeer(); - } - - // IExpandCollapseProvider Members - - // - // Attempts to collapse the sub-properties - // - public void Collapse() - { - if (_editor != null) - { - _editor.IsExpanded = false; - } - } - - // - // Attempts to expand the sub-properties - // - public void Expand() - { - if (_editor != null && - _editor.PropertyEntry != null && - _editor.PropertyEntry.PropertyValue.HasSubProperties == true) - { - _editor.IsExpanded = true; - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/TextFormatConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/TextFormatConverter.cs deleted file mode 100644 index fa413e97a31..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Automation/TextFormatConverter.cs +++ /dev/null @@ -1,50 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Automation -{ - using System; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Windows.Data; - using System.Activities.Presentation; - - // - // Simple converter that uses a format string to convert a value into a display string - // This class is referenced in XAML. - // - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class TextFormatConverter : IValueConverter - { - - private string _format; - - // - // Gets or sets the format string to apply - // - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public string Format - { - get { - return _format; - } - set { - _format = value; - } - } - - // IValueConverter Members - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - value = value ?? "null"; - return string.Format(culture ?? CultureInfo.CurrentCulture, _format ?? "{0}", value.ToString()); - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw FxTrace.Exception.AsError(new InvalidOperationException()); - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CategoryList.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CategoryList.cs deleted file mode 100644 index cd5a3a4784a..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CategoryList.cs +++ /dev/null @@ -1,1224 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Windows; - using System.Windows.Automation.Peers; - using System.Windows.Controls; - using System.Windows.Input; - using System.Windows.Threading; - - using System.Activities.Presentation; - using System.Activities.Presentation.PropertyEditing; - - using System.Activities.Presentation.Internal.PropertyEditing.Automation; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - using System.Activities.Presentation.Internal.PropertyEditing.Model; - using System.Activities.Presentation.Internal.PropertyEditing.Selection; - using System.Activities.Presentation.Internal.PropertyEditing.State; - - // - // Wrapper around ItemsControl that knows how to contain and display CategoryEntries, - // deals with AutomationPeers, and persists the open and closed state of individual - // CategoryContainers. - // - // This class should ideally be internal, but Avalon can't handle attached properties - // (which this class defines) on internal classes. - // - internal class CategoryList : ItemsControl, IEnumerable, IStateContainer, INotifyPropertyChanged - { - - // This guy is static so that its values persist across designers and CategoryList instances - private static CategoryStateContainer _categoryStates = new CategoryStateContainer(); - - // This guy is not because it caches FilterString, which is specific to each CategoryList instance - private IStateContainer _stateContainer; - - // Used for property selection - private FrameworkElement _selection; - private PropertySelectionMode _selectionMode; - - // Used for property filtering - private string _filterString; - private PropertyFilter _currentFilter; - private bool _hasAnyFilterMatches = true; - private ICommand _clearFilterCommand; - - // Miscelaneous - private SharedPropertyValueColumnWidthContainer _sharedWidthContainer; - - [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")] - static CategoryList() - { - // Make CategoryList non-focusable by default - UIElement.FocusableProperty.OverrideMetadata(typeof(CategoryList), new FrameworkPropertyMetadata(false)); - - // Mark the uber-CategoryList as the scope for property selection - PropertySelection.IsSelectionScopeProperty.OverrideMetadata(typeof(CategoryList), new PropertyMetadata(true)); - } - - // - // Basic ctor - // - [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] - public CategoryList() - { - - _stateContainer = new AggregateStateContainer( - new CategoryListStateContainer(this), - _categoryStates); - - // Setup the shared width container - _sharedWidthContainer = new SharedPropertyValueColumnWidthContainer(); - SharedPropertyValueColumnWidthContainer.SetOwningSharedPropertyValueColumnWidthContainer(this, _sharedWidthContainer); - - // When someone new gets focus, we may need to mess around with selected property, so listen to the event - this.AddHandler(FocusManager.GotFocusEvent, new RoutedEventHandler(OnSomeoneGotFocus)); - - // When editing is done in the value editor, shift focus back to the selected property - this.CommandBindings.Add(new CommandBinding(PropertyValueEditorCommands.FinishEditing, OnFinishEditing)); - - // Need to call this method from a UI thread because some of Sparkle's value editors rely on it - UIThreadDispatcher.InitializeInstance(); - } - - // - // Event fired whenever a new CategoryContainer instance is generated - // - public event ContainerGeneratedHandler ContainerGenerated; - - // AutomationPeer - - public event PropertyChangedEventHandler PropertyChanged; - - public int Count - { - get { - return this.Items.Count; - } - } - - // - // Gets or sets the filter string to apply to the shown properties. - // Setting this value will automatically apply the filter to the shown properties. - // - public string FilterString - { - get { - return _filterString; - } - set { - if (string.IsNullOrEmpty(value)) - { - value = null; - } - - if (_filterString != value) - { - _filterString = value; - _currentFilter = new PropertyFilter(_filterString); - RefreshFilter(); - this.OnPropertyChanged("FilterString"); - } - } - } - - // - // Command-wrapper for the ClearFilter method - // - public ICommand ClearFilterCommand - { - get { - if (_clearFilterCommand == null) - { - _clearFilterCommand = new DelegateCommand(this.ClearFilter); - } - return _clearFilterCommand; - } - } - - // - // Gets a value indicating whether there are any categories or properties that - // match the current filter string - // - public bool HasAnyFilterMatches - { - get { - return _hasAnyFilterMatches; - } - private set { - if (_hasAnyFilterMatches != value) - { - _hasAnyFilterMatches = value; - this.OnPropertyChanged("HasAnyFilterMatches"); - } - } - } - - // - // Gets the currently selected visual. - // - public FrameworkElement Selection - { - get { - return _selection; - } - } - - // - // Gets or sets the path to the currently selected item in the CategoryList. - // Only "sticky" selections will return a valid SelectionPath - otherwise - // null is returned. Setting this property changes the selection if the specified path - // can be resolved to a FrameworkElement to select and sets the SelectionMode to - // Sticky. - // - public SelectionPath SelectionPath - { - get { - if (_selection == null) - { - return null; - } - if (this.SelectionMode != PropertySelectionMode.Sticky) - { - return null; - } - - ISelectionStop selectionStop = PropertySelection.GetSelectionStop(_selection); - if (selectionStop == null) - { - return null; - } - - return selectionStop.Path; - } - set { - SetSelectionPath(value); - } - } - - // - // Gets or sets the current SelectionMode - // - private PropertySelectionMode SelectionMode - { - get { return _selectionMode; } - set { _selectionMode = value; } - } - - public CategoryEntry this[int index] { - get { - return (CategoryEntry)this.Items[index]; - } - } - - protected override AutomationPeer OnCreateAutomationPeer() - { - return new CategoryListAutomationPeer(this); - } - - - // Convenience Accessors - - public void Insert(int index, CategoryEntry category) - { - if (category == null) - { - throw FxTrace.Exception.ArgumentNull("category"); - } - - this.Items.Insert(index, category); - } - - public void InsertAlphabetically(CategoryEntry category) - { - - // POSSIBLE OPTIMIZATION: optimize using the fact that the list of categories in this - // collection is ordered. - int index = 0; - for (; index < this.Count; index++) - { - if (string.Compare(category.CategoryName, this[index].CategoryName, StringComparison.CurrentCulture) < 0) - { - break; - } - } - - this.Insert(index, category); - } - - public void RemoveAt(int index) - { - this.Items.RemoveAt(index); - } - - - // Command Handlers - - private void OnFinishEditing(object sender, ExecutedRoutedEventArgs e) - { - // Re-focus the selected selection stop - this.SynchronizeSelectionFocus(StealFocusMode.Always); - } - - - // IStateContainer - - public void RestoreState(object state) - { - _stateContainer.RestoreState(state); - } - - public object RetrieveState() - { - return _stateContainer.RetrieveState(); - } - - // This override both gets rid of the inbetween ContentPresenter and - // it makes the CategoryContainer available as an instance in PrepareContainerForItemOverride() - protected override DependencyObject GetContainerForItemOverride() - { - return new CiderCategoryContainer(); - } - - // Set the expansion state on the CategoryContainer based on an existing container - // or a cached value for the contained category - protected override void PrepareContainerForItemOverride(DependencyObject element, object item) - { - CiderCategoryContainer container = element as CiderCategoryContainer; - CategoryEntry category = item as CategoryEntry; - - if (container != null && category != null) - { - - // Ideally, we would want to initalize the expansion state here. However, - // in collection editor, Blend messes around with the expansion state _after_ - // the call to this method, which breaks our ability to remember which categories - // were open and which were closed. So, we set the state here (because Blend's - // search logic relies on it to be set by this point) and _reset_ it in the Loaded - // event handler. - - // Look into stored state - CategoryState state = _categoryStates.GetCategoryState(category.CategoryName); - container.Expanded = state.CategoryExpanded; - container.AdvancedSectionPinned = state.AdvancedSectionExpanded; - - // Hook into other event handlers that we care about (including the Loaded event) - container.Loaded += new RoutedEventHandler(OnContainerLoaded); - container.Unloaded += new RoutedEventHandler(OnContainerUnloaded); - - if (ContainerGenerated != null) - { - ContainerGenerated(this, new ContainerGeneratedEventArgs(container)); - } - } - else - { - Debug.Fail("CategoryList should only be populated with CategoryEntries."); - } - - base.PrepareContainerForItemOverride(element, item); - } - - // Re-initialize the expansion state here and hook into the ExpandedChanged and - // AdvancedSectionPinnedChanged events, because by now Blend may have ----ed those - // two values up (see comment in PrepareContainerForItemOverride() ) - private void OnContainerLoaded(object sender, RoutedEventArgs e) - { - CiderCategoryContainer container = sender as CiderCategoryContainer; - - if (container != null) - { - - CategoryEntry category = container.Category; - if (category != null) - { - // Look into stored state - CategoryState state = _categoryStates.GetCategoryState(category.CategoryName); - container.Expanded = state.CategoryExpanded; - container.AdvancedSectionPinned = state.AdvancedSectionExpanded; - - // Hook into these events here, because Blend won't mess the state up at this point - container.ExpandedChanged += new EventHandler(OnContainerExpandedChanged); - container.AdvancedSectionPinnedChanged += new EventHandler(OnAdvancedSectionPinnedChanged); - } - } - else - { - Debug.Fail("CategoryList expects the individual items to be CiderCategoryContainers"); - } - } - - private void OnContainerUnloaded(object sender, RoutedEventArgs e) - { - CiderCategoryContainer container = sender as CiderCategoryContainer; - if (container != null) - { - // Unhook from any events that we used to care about - container.ExpandedChanged -= new EventHandler(OnContainerExpandedChanged); - container.AdvancedSectionPinnedChanged -= new EventHandler(OnAdvancedSectionPinnedChanged); - container.Loaded -= new RoutedEventHandler(OnContainerLoaded); - container.Unloaded -= new RoutedEventHandler(OnContainerUnloaded); - } - else - { - Debug.Fail("Couldn't clean up event binding and store container state."); - } - } - - private void OnContainerExpandedChanged(object sender, EventArgs e) - { - // If we are in "Filter-applied" mode, don't store the expansion state, since applying - // the filter automatically expands everything that matches that filter - if (_currentFilter != null && !_currentFilter.IsEmpty) - { - return; - } - - CiderCategoryContainer container = sender as CiderCategoryContainer; - if (container != null) - { - CategoryEntry category = container.Category; - if (category != null) - { - CategoryState state = _categoryStates.GetCategoryState(container.Category.CategoryName); - state.CategoryExpanded = container.Expanded; - } - } - } - - private void OnAdvancedSectionPinnedChanged(object sender, EventArgs e) - { - // If we are in "Filter-applied" mode, don't store the expansion state, since applying - // the filter automatically expands everything that matches that filter - if (_currentFilter != null && !_currentFilter.IsEmpty) - { - return; - } - - CiderCategoryContainer container = sender as CiderCategoryContainer; - if (container != null) - { - CategoryEntry category = container.Category; - if (category != null) - { - CategoryState state = _categoryStates.GetCategoryState(container.Category.CategoryName); - state.AdvancedSectionExpanded = container.AdvancedSectionPinned; - } - } - } - - // Searching - - // - // Applies the current filter to the existing list of categories and properties - // and updates the value of HasAnyFilterMatches. This class does not update itself - // automatically when new CategoryEntries are added or removed, so call this method - // explicitly when things change. - // - public void RefreshFilter() - { - bool? matchesFilter = null; - - foreach (CategoryBase category in this.Items) - { - matchesFilter = matchesFilter == null ? false : matchesFilter; - matchesFilter |= ApplyFilter(_currentFilter, category); - } - - this.HasAnyFilterMatches = matchesFilter == null ? true : (bool)matchesFilter; - } - - // - // Clears the current property filter, if any - // - public void ClearFilter() - { - this.FilterString = null; - } - - // Applies the specified filter to the specified category, returning a boolean indicating - // whether anything in that category matched the filter or not - private static bool ApplyFilter(PropertyFilter filter, CategoryBase category) - { - category.ApplyFilter(filter); - return category.MatchesFilter || category.BasicPropertyMatchesFilter || category.AdvancedPropertyMatchesFilter; - } - - - // Property Selection - - // - // Sets the SelectionMode back to default. This is a common enough - // operation that it makes sense to abstract it to its own method. - // - private void ResetSelectionMode() - { - SelectionMode = PropertySelectionMode.Default; - } - - // - // Updates property selection to the specified SelectionPath (if any) - // or the specified default property. Returns true if some property was selected, - // false otherwise (such as in the case when no properties are showing). - // - // SelectionPath to select. Takes precedence over default property. - // Property to select when no SelectionPath is specified or - // if the path cannot be resolved. - // SelectionPath to use when all else fails. May be null. - // True if some property was selected, false otherwise (such as in the case - // when no properties are showing). - public bool UpdateSelectedProperty( - SelectionPath stickyPath, - string defaultPropertyName, - SelectionPath fallbackPath) - { - - // First, try selecting the given stickyPath, if any - // - if (stickyPath == null || !SetSelectionPath(stickyPath)) - { - ResetSelectionMode(); - } - - bool propertySelected; - - if (SelectionMode == PropertySelectionMode.Default) - { - - // Then, try finding and selecting the default property - // - propertySelected = defaultPropertyName == null ? false : SelectDefaultProperty(defaultPropertyName); - if (!propertySelected && fallbackPath != null) - { - - // And if that fails, go to the specified fallback SelectionPath, - // if any - // - propertySelected = SetSelectionPath(fallbackPath); - } - - // Make sure that we are still in Default selection mode - // at this point - // - ResetSelectionMode(); - } - else - { - propertySelected = true; - } - - return propertySelected; - } - - private bool SetSelectionPath(SelectionPath path) - { - // Dummy, this variable is only to satisfy SetSelectionPath(SelectionPath path, out bool pendingGeneration) - bool isPendingGenerationDummy; - return SetSelectionPath(path, out isPendingGenerationDummy); - } - - // Attempts to resolve the specified path and set it as the current selection, returning - // true or false based on success. If the path is found, selection is set to Sticky. - // If the UI is not ready, return false and pendingGeneration is true. - internal bool SetSelectionPath(SelectionPath path, out bool pendingGeneration) - { - DependencyObject newSelection = SelectionPathResolver.ResolveSelectionPath(this, path, out pendingGeneration); - if (newSelection != null) - { - SelectAndFocus(newSelection, StealFocusMode.OnlyIfCategoryListHasFocusWithin); - this.SelectionMode = PropertySelectionMode.Sticky; - return true; - } - - return false; - } - - // When the user clicks somewhere, we try to find the closest parent with IsSelectionStop DP set to true and - // select it. - // - protected override void OnPreviewMouseDown(MouseButtonEventArgs e) - { - Select(e.OriginalSource as DependencyObject); - base.OnPreviewMouseDown(e); - } - - // If we set Focus in OnMouseDown, it would be overwritten by the time the mouse went up. So, we set the focus - // in OnMouseUp() to make sure it sticks - // - protected override void OnPreviewMouseUp(MouseButtonEventArgs e) - { - base.OnPreviewMouseUp(e); - SynchronizeSelectionFocus(StealFocusMode.OnlyIfCurrentSelectionDoesNotHaveFocusWithin); - } - - // When a UIElement gets focus, we try to find the parent PropertyContainer and make sure - // it's selected - // - private void OnSomeoneGotFocus(object source, RoutedEventArgs e) - { - Select(e.OriginalSource as DependencyObject); - } - - // We only synchronize the IsSelected object with keyboard focus when the CategoryList itself - // has focus. If it doesn't we don't want to accidentally steal focus from somewhere else - // (say the design surface when the user is just tabbing through objects on it). However, once - // the CategoryList itself gains focus, we do want to synchronize the IsSelected object with - // keyboard focus so that Tabs and keyboard navigation works correctly. - // - protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e) - { - - bool hasKeyboardFocus = (bool)e.NewValue; - - if (hasKeyboardFocus) - { - // We just gained keyboard focus. Make sure we [....] up the current property selection - // with the keyboard focus, so that navigation works. - SynchronizeSelectionFocus(StealFocusMode.OnlyIfCurrentSelectionDoesNotHaveFocusWithin); - } - - base.OnIsKeyboardFocusWithinChanged(e); - } - - // Helper method that ensures that the element marked as IsSelected also has focus. - // If it cannot receive focus, we look for its closest visual child that can - // - private void SynchronizeSelectionFocus(StealFocusMode focusMode) - { - // Is there something to select? - if (_selection == null) - { - return; - } - - // Are we even allowed to mess around with focus or does someone else on the - // design surface have focus right now and we should just let them have it? - if (focusMode == StealFocusMode.OnlyIfCategoryListHasFocusWithin && !this.IsKeyboardFocusWithin) - { - return; - } - - if (focusMode == StealFocusMode.OnlyIfCurrentSelectionDoesNotHaveFocusWithin && _selection.IsKeyboardFocusWithin) - { - return; - } - - FrameworkElement focusableElement = VisualTreeUtils.FindFocusableElement(_selection); - - if (focusableElement != null) - { - focusableElement.Focus(); - } - } - - // Attempt to select the right thing for the specified default property name: - // - // * If there is a common DefaultProperty among selected objects AND there is a CategoryEditor consuming it, - // select the CategoryEditor - // - // * If there is a common DefaultProperty among selected objects AND there is NO CategoryEditor consuming it, - // select the property itself - // - // * If there is no common DefaultProperty, select the first common category - // - // * Otherwise fail by returning false - // - private bool SelectDefaultProperty(string defaultPropertyName) - { - return SelectDefaultPropertyHelper(defaultPropertyName, true); - } - - private bool SelectDefaultPropertyHelper(string defaultPropertyName, bool firstTime) - { - if (string.IsNullOrEmpty(defaultPropertyName)) - { - return false; - } - - ModelCategoryEntry defaultPropertyCategory; - PropertyEntry defaultProperty = FindPropertyEntry(defaultPropertyName, out defaultPropertyCategory); - CategoryEditor defaultCategoryEditor = FindCategoryEditor(defaultProperty, defaultPropertyCategory); - UIElement element = null; - bool elementPendingGeneration = false; - - // Try to look up the correct UIElement to select - // - if (defaultCategoryEditor != null) - { - element = FindCategoryEditorVisual(defaultCategoryEditor, defaultPropertyCategory, out elementPendingGeneration); - } - else if (defaultProperty != null) - { - element = FindPropertyEntryVisual(defaultProperty, defaultPropertyCategory, out elementPendingGeneration); - } - else if (this.Count > 0) - { - // Nothing found, so select the first selectable thing in the list - element = PropertySelection.FindNeighborSelectionStop(this, SearchDirection.Next); - elementPendingGeneration = false; - } - - // If the UIElement was found, select it. Otherwise, if it should exist but it wasn't generated yet, - // wait until it is and try again. - // - if (element != null) - { - - SelectAndFocus(element, StealFocusMode.OnlyIfCategoryListHasFocusWithin); - - // Ensure that we are in Default SelectionMode because calling SelectAndFocus automatically switches us - // to Sticky mode - // - ResetSelectionMode(); - - } - else if (elementPendingGeneration && firstTime) - { - - // Set the firstTime flag to false, to prevent any infinite loops should things go wrong - this.Dispatcher.BeginInvoke( - DispatcherPriority.Loaded, - new SelectDefaultPropertyHelperDelegate(SelectDefaultPropertyHelper), - defaultPropertyName, - false); - - } - else if (elementPendingGeneration && !firstTime) - { - elementPendingGeneration = false; - } - - return element != null || elementPendingGeneration; - } - - // Find the closest IsSelectable parent, select it and set focus on it. - // - private void SelectAndFocus(DependencyObject element, StealFocusMode focusMode) - { - Select(element); - SynchronizeSelectionFocus(focusMode); - } - - // Find the closest IsSelectable parent and select it. Don't mess with focus. - // - private void Select(DependencyObject visualSource) - { - if (visualSource != null) - { - FrameworkElement selection = PropertySelection.FindParentSelectionStop(visualSource); - - if (selection != _selection) - { - - // Unselect anything that was selected previously - if (_selection != null) - { - PropertySelection.SetIsSelected(_selection, false); - } - - _selection = selection; - - // Select whatever we need to select now - if (_selection != null) - { - PropertySelection.SetIsSelected(_selection, true); - - // Bring the full PropertyContainer into view, if one exists - FrameworkElement focusableElement = VisualTreeUtils.FindFocusableElement(_selection) ?? _selection; - FrameworkElement parentPropertyContainer = VisualTreeUtils.FindVisualAncestor(focusableElement); - FrameworkElement bringIntoViewElement = parentPropertyContainer ?? focusableElement; - - bringIntoViewElement.BringIntoView(); - - // As soon as the user manually selects a property, automatically switch to Sticky mode - _selectionMode = PropertySelectionMode.Sticky; - } - } - } - } - - - // Keyboard Navigation - - protected override void OnKeyDown(KeyEventArgs e) - { - - // Intercept Up, Down, Left, Right key strokes and use them to navigate around the - // the control - // - if (e.Key == Key.Left || e.Key == Key.Right || e.Key == Key.Up || e.Key == Key.Down) - { - if (_selection != null && !e.Handled) - { - if (object.Equals( - Keyboard.FocusedElement, - VisualTreeUtils.FindFocusableElement(_selection))) - { - - ISelectionStop selectionStop = PropertySelection.GetSelectionStop(_selection); - if (selectionStop != null) - { - - if (selectionStop.IsExpandable) - { - if ((e.Key == Key.Right && !selectionStop.IsExpanded) || - (e.Key == Key.Left && selectionStop.IsExpanded)) - { - - selectionStop.IsExpanded = !selectionStop.IsExpanded; - e.Handled = true; - } - } - - } - - if (!e.Handled) - { - - SearchDirection direction = e.Key == Key.Up || e.Key == Key.Left ? SearchDirection.Previous : SearchDirection.Next; - FrameworkElement nextStop = PropertySelection.FindNeighborSelectionStop(_selection, direction); - - // If need to select something, select it - if (nextStop != null) - { - SelectAndFocus(nextStop, StealFocusMode.Always); - } - - e.Handled = true; - } - } - } - } - - base.OnKeyDown(e); - } - - // SharedPropertyValueColumnWidth State Logic - - protected override Size ArrangeOverride(Size arrangeBounds) - { - - // Set the content width, rather than the entire container width - object gridLength = this.FindResource("OpenCloseColumnGridLength"); - if (gridLength != null && gridLength is GridLength) - { - _sharedWidthContainer.ContainerWidth = arrangeBounds.Width - ((GridLength)gridLength).Value; - } - else - { - _sharedWidthContainer.ContainerWidth = arrangeBounds.Width; - } - - return base.ArrangeOverride(arrangeBounds); - } - - // Visual Lookup Helpers - - // - // Looks for and returns the PropertyContainer used to represent the specified PropertyEntry. Returns - // null if not found. - // - // PropertyEntry to look up - // Category to examine - // Set to true if the specified property exists in a collapsed container - // (CategoryContainer or an advanced section). If so, the section is expanded, but the visual does not - // exist yet and should be requested later. - // - // PropertyContainer for the specified PropertyEntry if found, null otherwise - internal PropertyContainer FindPropertyEntryVisual(PropertyEntry property, CategoryEntry parentCategory, out bool pendingGeneration) - { - pendingGeneration = false; - - if (property == null || parentCategory == null) - { - return null; - } - - if (property.MatchesFilter == false) - { - return null; - } - - CiderCategoryContainer categoryContainer = this.ItemContainerGenerator.ContainerFromItem(parentCategory) as CiderCategoryContainer; - if (categoryContainer == null) - { - return null; - } - - // Expand the parent category, if it isn't already - if (!categoryContainer.Expanded) - { - categoryContainer.Expanded = true; - pendingGeneration = true; - } - - // Expand the parent advanced section, if any and if it isn't already - if (property.IsAdvanced && !categoryContainer.AdvancedSectionPinned) - { - categoryContainer.AdvancedSectionPinned = true; - pendingGeneration = true; - } - - bool pendingGenerationTemp; - PropertyContainer propertyContainer = categoryContainer.ContainerFromProperty(property, out pendingGenerationTemp); - pendingGeneration |= pendingGenerationTemp; - - if (propertyContainer != null) - { - pendingGeneration = false; - } - - return propertyContainer; - } - - // - // Looks for and returns CategoryContainer for the specified CategoryEntry. Returns null if not - // found. - // - // CategoryEntry to look for. - // Corresponding CategoryContainer if found, null otherwise. - internal CategoryContainer FindCategoryEntryVisual(CategoryEntry category) - { - if (category == null) - { - return null; - } - - CiderCategoryContainer categoryContainer = this.ItemContainerGenerator.ContainerFromItem(category) as CiderCategoryContainer; - return categoryContainer; - } - - // - // Looks for and returns the UIElement used to represent the specified CategoryEditor. Returns - // null if not found. - // - // CategoryEditor to look for. - // Category to look in. - // Set to true if the specified editor exists in a collapsed container - // (CategoryContainer or an advanced section). If so, the section is expanded, but the visual does not - // exist yet and should be requested later. - // UIElement for the specified CategoryEditor if found, null otherwise - internal UIElement FindCategoryEditorVisual(CategoryEditor editor, ModelCategoryEntry category, out bool pendingGeneration) - { - pendingGeneration = false; - - if (editor == null || category == null) - { - return null; - } - - UIElement editorVisual = null; - - CiderCategoryContainer categoryContainer = this.ItemContainerGenerator.ContainerFromItem(category) as CiderCategoryContainer; - if (categoryContainer == null) - { - return null; - } - - // Expand the parent category, if it isn't already - if (!categoryContainer.Expanded) - { - categoryContainer.Expanded = true; - pendingGeneration = true; - } - - // Expand the parent advanced section, if any and if it isn't already - if (!categoryContainer.AdvancedSectionPinned && ExtensibilityAccessor.GetIsAdvanced(editor)) - { - categoryContainer.AdvancedSectionPinned = true; - pendingGeneration = true; - } - - bool pendingGenerationTemp; - editorVisual = categoryContainer.ContainerFromEditor(editor, out pendingGenerationTemp); - pendingGeneration |= pendingGenerationTemp; - - if (editorVisual != null) - { - pendingGeneration = false; - } - - return editorVisual; - } - - // Logical Lookup Helpers - - // - // Looks for a CategoryEntry contained in this list with the given name - // - // Name to look for - // CategoryEntry with the specified name if found, null otherwise - internal CategoryEntry FindCategory(string name) - { - if (name == null) - { - throw FxTrace.Exception.ArgumentNull("name"); - } - - foreach (CategoryEntry category in this.Items) - { - if (category.CategoryName.Equals(name)) - { - return category; - } - } - - return null; - } - - // - // Looks for the PropertyEntry and its parent CategoryEntry for the specified property - // - // Property to look for - // Parent CategoryEntry of the given property - // Corresponding PropertyEntry if found, null otherwise. - internal PropertyEntry FindPropertyEntry(string propertyName, out ModelCategoryEntry parentCategory) - { - parentCategory = null; - if (propertyName == null) - { - return null; - } - - foreach (ModelCategoryEntry category in this.Items) - { - PropertyEntry property = category[propertyName]; - if (property != null) - { - parentCategory = category; - return property; - } - } - - return null; - } - - // - // Looks for the CategoryEditor of the specified type and returns it if found. - // - // Type name of the editor to look for. - // CategoryEntry that the editor belongs to, if found. - // CategoryEditor instance of the given type name if found, null otherwise. - internal CategoryEditor FindCategoryEditor(string editorTypeName, out ModelCategoryEntry category) - { - category = null; - if (string.IsNullOrEmpty(editorTypeName) || this.Items == null) - { - return null; - } - - foreach (ModelCategoryEntry currentCategory in this.Items) - { - foreach (CategoryEditor editor in currentCategory.CategoryEditors) - { - if (string.Equals(editorTypeName, editor.GetType().Name)) - { - category = currentCategory; - return editor; - } - } - } - - return null; - } - - // Find the first CategoryEditor that consumes the specified property in the specified category. - // - private static CategoryEditor FindCategoryEditor(PropertyEntry property, ModelCategoryEntry parentCategory) - { - if (property == null || parentCategory == null) - { - return null; - } - - foreach (CategoryEditor editor in parentCategory.CategoryEditors) - { - if (editor.ConsumesProperty(property)) - { - return editor; - } - } - - return null; - } - - - // IEnumerable Members - - public IEnumerator GetEnumerator() - { - foreach (CategoryBase categoryBase in this.Items) - { - yield return categoryBase; - } - } - - // IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - - - // INotifyPropertyChanged Members - - private void OnPropertyChanged(string propertyName) - { - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); - } - } - - private delegate void MethodInvoker(); - - // Delegate for SelectDefaultPropertyHelper method so that we can invoke it on Render priority if the - // appropriate UIElements have not been generated yet - // - private delegate bool SelectDefaultPropertyHelperDelegate(string defaultPropertyName, bool firstTime); - - // Enum that defines how and when we steal keyboard focus from the rest of the application - // when the property selection changes - // - private enum StealFocusMode - { - Always, - OnlyIfCategoryListHasFocusWithin, - OnlyIfCurrentSelectionDoesNotHaveFocusWithin - } - - // Manages state specific to this CategoryList instance - private class CategoryListStateContainer : IStateContainer - { - - private CategoryList _parent; - private IStateContainer _containers; - - public CategoryListStateContainer(CategoryList parent) - { - if (parent == null) - { - throw FxTrace.Exception.ArgumentNull("parent"); - } - _parent = parent; - } - - private IStateContainer Containers - { - get { - if (_containers == null) - { - _containers = new AggregateStateContainer( - new FilterStringStateContainer(_parent), - new PropertyValueWidthStateContainer(_parent)); - } - - return _containers; - } - } - - public object RetrieveState() - { - return Containers.RetrieveState(); - } - - public void RestoreState(object state) - { - Containers.RestoreState(state); - } - - // FilterStringStateContainer - - // StateContainer responsible for the FilterString - // - private class FilterStringStateContainer : IStateContainer - { - private CategoryList _parent; - - public FilterStringStateContainer(CategoryList parent) - { - if (parent == null) - { - throw FxTrace.Exception.ArgumentNull("parent"); - } - _parent = parent; - } - - public object RetrieveState() - { - return _parent.FilterString; - } - - public void RestoreState(object state) - { - string filterString = state as string; - if (!string.IsNullOrEmpty(filterString)) - { - _parent.FilterString = filterString; - } - } - } - - // PropertyValueWidthStateContainer - - // StateContainer responsible for the width of the property value column - // - private class PropertyValueWidthStateContainer : IStateContainer - { - private CategoryList _parent; - - public PropertyValueWidthStateContainer(CategoryList parent) - { - if (parent == null) - { - throw FxTrace.Exception.ArgumentNull("parent"); - } - _parent = parent; - } - - public object RetrieveState() - { - return _parent._sharedWidthContainer.ValueColumnPercentage.ToString(CultureInfo.InvariantCulture); - } - - public void RestoreState(object state) - { - string stateString = state as string; - if (stateString == null) - { - return; - } - - double percentage; - if (!double.TryParse(stateString, NumberStyles.Float, CultureInfo.InvariantCulture, out percentage)) - { - Debug.Fail("Invalid PI state: " + stateString); - return; - } - - if (percentage >= 0 && percentage <= 1) - { - _parent._sharedWidthContainer.ValueColumnPercentage = percentage; - } - else - { - Debug.Fail("Invalid percentage width stored in PI state: " + percentage.ToString(CultureInfo.InvariantCulture)); - } - } - } - - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CategoryNameMap.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CategoryNameMap.cs deleted file mode 100644 index 94cfa805989..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CategoryNameMap.cs +++ /dev/null @@ -1,52 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System; - using System.Collections.Generic; - - // - // Helper class that looks up (and keeps a map of) category names and their localized versions. - // - internal static class CategoryNameMap - { - - private static Dictionary _cache = new Dictionary(); - - // - // Gets the localized value of the specified category name. If the input string - // is already localized, it won't be found in Cider's resources and, hence, it - // will be returned as is. - // - // Note that we pull category names from CategoryAttributes which already look up - // the localized version for common categories, such as "Misc", "Layout" and "Appearance", - // by default. This method just takes care of the few others that are WPF-specific and that - // we want to be localized as well. - // - // Category name to look up - // Translated version of the category name or the original name if not found. - public static string GetLocalizedCategoryName(string categoryName) - { - if (categoryName == null) - { - return null; - } - - string localizedCategoryName; - if (_cache.TryGetValue(categoryName, out localizedCategoryName)) - { - return localizedCategoryName; - } - - localizedCategoryName = GetLocalizedWPFCategoryName(categoryName) ?? categoryName; - _cache[categoryName] = localizedCategoryName; - return localizedCategoryName; - } - - private static string GetLocalizedWPFCategoryName(string categoryName) - { - return (string)System.Activities.Presentation.Internal.Properties.Resources.ResourceManager.GetString(string.Concat("PropertyCategory", categoryName.Replace(' ', '_'))); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CiderCategoryContainer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CiderCategoryContainer.cs deleted file mode 100644 index 0152a220153..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CiderCategoryContainer.cs +++ /dev/null @@ -1,363 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Collections.Specialized; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Text; - using System.Windows; - using System.Windows.Automation.Peers; - using System.Windows.Controls; - - using System.Activities.Presentation.PropertyEditing; - using Blend = System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - - using System.Activities.Presentation.Internal.PropertyEditing.Automation; - using System.Activities.Presentation.Internal.PropertyEditing.Model; - using System.Activities.Presentation.Internal.PropertyEditing.Selection; - - // - // HACK: wrapper around Sparkle's CategoryContainer that doesn't come with - // any initial set of visuals, since we re-brand the control ourselves. - // Sparkle doesn't plan to change this code before they ship, so we need - // this work-around. - // - internal class CiderCategoryContainer : Blend.CategoryContainer - { - - private static readonly DependencyPropertyKey IsEmptyPropertyKey = DependencyProperty.RegisterReadOnly( - "IsEmpty", - typeof(bool), - typeof(CiderCategoryContainer), - new PropertyMetadata(true, null, new CoerceValueCallback(CiderCategoryContainer.CoerceIsEmpty))); - - // - // IsEmpty property indicates whether this CategoryContainer contains any editors or unconsumed properties. - // If the value is true, UI for this container will hide itself - // - public static readonly DependencyProperty IsEmptyProperty = IsEmptyPropertyKey.DependencyProperty; - - // - // Property indicating whether the header for the category should be rendered or not - // - public static DependencyProperty ShowCategoryHeaderProperty = DependencyProperty.Register( - "ShowCategoryHeader", - typeof(bool), - typeof(CiderCategoryContainer), - new PropertyMetadata(true)); - - // Exposed ItemsControls that know how to convert objects into their - // visual counterparts - private ItemsControl _basicCategoryEditorsContainer; - private ItemsControl _advancedCategoryEditorsContainer; - private ItemsControl _basicPropertyContainersContainer; - private ItemsControl _advancedPropertyContainersContainer; - private bool _UIHooksInitialized; - - // Keyboard navigation helpers - private CategorySelectionStop _basicCategorySelectionStop; - private CategorySelectionStop _advancedCategorySelectionStop; - - public CiderCategoryContainer() - : - base(false) - { - - // Note: this logic, along with the IsEmpty DP should be pushed into the base class - this.BasicCategoryEditors.CollectionChanged += new NotifyCollectionChangedEventHandler(OnContentChanged); - this.AdvancedCategoryEditors.CollectionChanged += new NotifyCollectionChangedEventHandler(OnContentChanged); - this.UnconsumedBasicProperties.CollectionChanged += new NotifyCollectionChangedEventHandler(OnContentChanged); - this.UnconsumedAdvancedProperties.CollectionChanged += new NotifyCollectionChangedEventHandler(OnContentChanged); - } - - // IsEmpty ReadOnly DP - - // Events that would have ideally been baked in the base class - public event EventHandler ExpandedChanged; - public event EventHandler AdvancedSectionPinnedChanged; - - // - // Gets the value for IsEmpty DP - // - public bool IsEmpty - { - get { return (bool)this.GetValue(IsEmptyProperty); } - } - - // - // Gets or set the value of ShowCategoryHeaderProperty - // - public bool ShowCategoryHeader - { - get { return (bool)this.GetValue(ShowCategoryHeaderProperty); } - set { this.SetValue(ShowCategoryHeaderProperty, value); } - } - - // - // Wrapper around the ExpandedProperty that keyboard navigation understands. Called from Xaml. - // - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public ISelectionStop BasicCategorySelectionStop - { - get { - if (_basicCategorySelectionStop == null) - { - _basicCategorySelectionStop = new CategorySelectionStop(this, false); - } - - return _basicCategorySelectionStop; - } - } - - // - // Wrapper around the AdvancedSectionPinnedProperty that keyboard navigation understands - // - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public ISelectionStop AdvancedCategorySelectionStop - { - get { - if (_advancedCategorySelectionStop == null) - { - _advancedCategorySelectionStop = new CategorySelectionStop(this, true); - } - - return _advancedCategorySelectionStop; - } - } - - private ItemsControl BasicCategoryEditorsContainer - { - get { - // - // If called before the UI itself is rendered, this property - // will return null, which needs to be handled by the caller - // - EnsureUIHooksInitialized(); - return _basicCategoryEditorsContainer; - } - } - - private ItemsControl AdvancedCategoryEditorsContainer - { - get { - // - // If called before the UI itself is rendered, this property - // will return null, which needs to be handled by the caller - // - EnsureUIHooksInitialized(); - return _advancedCategoryEditorsContainer; - } - } - - private ItemsControl BasicPropertyContainersContainer - { - get { - // - // If called before the UI itself is rendered, this property - // will return null, which needs to be handled by the caller - // - EnsureUIHooksInitialized(); - return _basicPropertyContainersContainer; - } - } - - private ItemsControl AdvancedPropertyContainersContainer - { - get { - // - // If called before the UI itself is rendered, this property - // will return null, which needs to be handled by the caller - // - EnsureUIHooksInitialized(); - return _advancedPropertyContainersContainer; - } - } - - private static object CoerceIsEmpty(DependencyObject obj, object value) - { - CiderCategoryContainer theThis = obj as CiderCategoryContainer; - - if (theThis == null) - { - return value; - } - - return theThis.BasicCategoryEditors.Count == 0 && - theThis.UnconsumedBasicProperties.Count == 0 && - theThis.AdvancedCategoryEditors.Count == 0 && - theThis.UnconsumedAdvancedProperties.Count == 0; - } - - private void OnContentChanged(object sender, NotifyCollectionChangedEventArgs e) - { - this.CoerceValue(IsEmptyProperty); - } - - // ShowCategoryHeader DP - - // In Cider and unlike in Blend, we expose all properties (browsable and non-browsable) through the - // property editing object model. Hence, we need to make sure that the UI representing it (CategoryContainer) - // does the filtering instead. This is by design and, for consistency, it should be pushed into Blend as well - protected override void AddProperty(PropertyEntry property, ObservableCollection unconsumedProperties, ObservableCollection referenceOrder, ObservableCollection categoryEditors) - { - - // Is this property browsable? - ModelPropertyEntry modelPropertyEntry = property as ModelPropertyEntry; - if (modelPropertyEntry != null && !modelPropertyEntry.IsBrowsable) - { - return; - } - - // Yes, so we can safely add it to the list - base.AddProperty(property, unconsumedProperties, referenceOrder, categoryEditors); - } - - // - // Attempts to look up the corresponding PropertyContainer to the specified PropertyEntry - // - // Property to look up - // Set to true if the specified property may have a container - // but the visual does not exist yet and should be requested later. - // Corresponding PropertyContainer, if found, null otherwise - public PropertyContainer ContainerFromProperty(PropertyEntry property, out bool pendingGeneration) - { - pendingGeneration = false; - if (property == null) - { - return null; - } - - if (this.BasicPropertyContainersContainer != null) - { - PropertyContainer propertyContainer = this.BasicPropertyContainersContainer.ItemContainerGenerator.ContainerFromItem(property) as PropertyContainer; - if (propertyContainer != null) - { - return propertyContainer; - } - } - - if (this.AdvancedPropertyContainersContainer != null) - { - PropertyContainer propertyContainer = this.AdvancedPropertyContainersContainer.ItemContainerGenerator.ContainerFromItem(property) as PropertyContainer; - if (propertyContainer != null) - { - return propertyContainer; - } - } - - if (!_UIHooksInitialized) - { - pendingGeneration = true; - } - - return null; - } - - // - // Attempts to look up the corresponding UI representation of the specified CategoryEditor - // - // Editor to look up - // Set to true if the specified editor may have a container - // but the visual does not exist yet and should be requested later. - // UI representation of the specified CategoryEditor, if found, null otherwise. - public UIElement ContainerFromEditor(CategoryEditor editor, out bool pendingGeneration) - { - pendingGeneration = false; - if (editor == null) - { - return null; - } - - if (this.BasicCategoryEditorsContainer != null) - { - UIElement categoryEditor = this.BasicCategoryEditorsContainer.ItemContainerGenerator.ContainerFromItem(editor) as UIElement; - if (categoryEditor != null) - { - return categoryEditor; - } - } - - if (this.AdvancedCategoryEditorsContainer != null) - { - UIElement categoryEditor = this.AdvancedCategoryEditorsContainer.ItemContainerGenerator.ContainerFromItem(editor) as UIElement; - if (categoryEditor != null) - { - return categoryEditor; - } - } - - if (!_UIHooksInitialized) - { - pendingGeneration = true; - } - - return null; - } - - protected override AutomationPeer OnCreateAutomationPeer() - { - return CategoryContainerAutomationPeer.CreateStandAloneAutomationPeer(this); - } - - // This method fires ExpandedChanged and AdvancedSectionPinnedChanged events. Ideally we would include - // these events in Blend.CategoryContainer, but the assembly containing that class has already been locked - protected override void OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) - { - base.OnPropertyChanged(e); - - if (e.Property == ExpandedProperty && - ExpandedChanged != null) - { - ExpandedChanged(this, EventArgs.Empty); - } - - if (e.Property == AdvancedSectionPinnedProperty && - AdvancedSectionPinnedChanged != null) - { - AdvancedSectionPinnedChanged(this, EventArgs.Empty); - } - } - - // Returns true if the hooks should have already been generated - // false otherwise. - // - private bool EnsureUIHooksInitialized() - { - if (_UIHooksInitialized) - { - return true; - } - - _basicCategoryEditorsContainer = VisualTreeUtils.GetNamedChild(this, "PART_BasicCategoryEditors"); - _advancedCategoryEditorsContainer = VisualTreeUtils.GetNamedChild(this, "PART_AdvancedCategoryEditors"); - _basicPropertyContainersContainer = VisualTreeUtils.GetNamedChild(this, "PART_BasicPropertyList"); - _advancedPropertyContainersContainer = VisualTreeUtils.GetNamedChild(this, "PART_AdvancedPropertyList"); - - if (_basicCategoryEditorsContainer == null && - _advancedCategoryEditorsContainer == null && - _basicPropertyContainersContainer == null && - _advancedPropertyContainersContainer == null) - { - - return false; - } - - if (_basicCategoryEditorsContainer == null || - _advancedCategoryEditorsContainer == null || - _basicPropertyContainersContainer == null || - _advancedPropertyContainersContainer == null) - { - - Debug.Fail("UI for CategoryContainer changed. Need to update CiderCategoryContainer logic."); - } - - _UIHooksInitialized = true; - return true; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CiderCategoryLayoutContainer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CiderCategoryLayoutContainer.cs deleted file mode 100644 index 35fbce91307..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CiderCategoryLayoutContainer.cs +++ /dev/null @@ -1,35 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Windows; - using Blend = System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - using System.Activities.Presentation.Internal.PropertyEditing.Selection; - - // - // Container for CategoryEditors - fancy wrapper for ItemsControl that eliminates the need - // for extra bindings. - // - // This class is referenced from XAML - // - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class CiderCategoryLayoutContainer : Blend.CategoryLayoutContainer - { - - protected override void PrepareContainerForItemOverride(DependencyObject element, object item) - { - base.PrepareContainerForItemOverride(element, item); - - if (item != null) - { - string editorTypeName = item.GetType().Name; - - // Make each CategoryEditor its own selection stop - PropertySelection.SetSelectionStop(element, new CategoryEditorSelectionStop(editorTypeName)); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CiderStandardCategoryLayout.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CiderStandardCategoryLayout.cs deleted file mode 100644 index 6621bccfab2..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/CiderStandardCategoryLayout.cs +++ /dev/null @@ -1,102 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System.Diagnostics.CodeAnalysis; - using System.Windows; - - using System.Activities.Presentation.PropertyEditing; - - using Blend = System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - using System.Activities.Presentation.Internal.PropertyEditing.Selection; - using System.Activities.Presentation.Internal.PropertyEditing.State; - - // - // Container for PropertyContainers - fancy wrapper for ItemsControl that eliminates the need - // for intermediate ContentControls. - // - // This class is referenced from XAML - // - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class CiderStandardCategoryLayout : Blend.StandardCategoryLayout - { - - protected override void PrepareContainerForItemOverride(DependencyObject element, object item) - { - base.PrepareContainerForItemOverride(element, item); - - if (element != null) - { - PropertyEntry property = ((PropertyContainer)element).PropertyEntry; - - if (property != null) - { - // Make each PropertyContainer its own selection stop - PropertySelection.SetSelectionStop(element, new PropertySelectionStop(property)); - } - - PropertyContainer container = element as PropertyContainer; - if (container != null) - { - container.Loaded += new RoutedEventHandler(OnPropertyContainerLoaded); - } - } - } - - private void OnPropertyContainerLoaded(object sender, RoutedEventArgs e) - { - PropertyContainer container = sender as PropertyContainer; - if (container != null) - { - - // When each PropertyContainer gets loaded, restore its ActiveEditMode - // based on stored state - // - container.ActiveEditMode = PropertyActiveEditModeStateContainer.Instance.GetActiveEditMode(container.PropertyEntry); - - // HACK: Here, we would want to hook into the ActiveEditModeChanged - // event to store (and restore) the correct expaded state to each - // value editor across domain reloads. However, we already shipped - // System.Activities.Presentation.dll which contains the PropertyContainer - // class and it's dangerous to add new events to this assembly at this - // point. Once we refactor MWD, we need to add this new event and - // simplify this code. In the meanwhile, we can cheat and accomplish - // the same effect by listening to SizeChanged event, which _will_ - // change when the expanded value editor is pinned down. It will also - // change at other times (user-triggered resize events, etc.), but - // it shouldn't cause any noticeable perf degradation. - // - container.SizeChanged += new SizeChangedEventHandler(OnPropertyContainerSizeChanged); - container.Unloaded += new RoutedEventHandler(OnPropertyContainerUnloaded); - } - } - - // When the size of each PropertyContainer changes, assume that ActiveEditMode - // may have been changed and record its current state - // - private void OnPropertyContainerSizeChanged(object sender, SizeChangedEventArgs e) - { - PropertyContainer container = sender as PropertyContainer; - if (container != null && container.IsLoaded) - { - PropertyActiveEditModeStateContainer.Instance.StoreActiveEditMode(container.PropertyEntry, container.ActiveEditMode); - } - } - - // When each PropertyContainer gets unloaded, stop listening to all events so - // that it can be garbage collected - // - private void OnPropertyContainerUnloaded(object sender, RoutedEventArgs e) - { - PropertyContainer container = sender as PropertyContainer; - - if (container != null) - { - container.SizeChanged -= new SizeChangedEventHandler(OnPropertyContainerSizeChanged); - container.Loaded -= new RoutedEventHandler(OnPropertyContainerLoaded); - container.Unloaded -= new RoutedEventHandler(OnPropertyContainerUnloaded); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/ContainerGeneratedEventArgs.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/ContainerGeneratedEventArgs.cs deleted file mode 100644 index 2b7efa035f3..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/ContainerGeneratedEventArgs.cs +++ /dev/null @@ -1,40 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System; - using System.Activities.Presentation; - - // - // EventArgs we use to fire CategoryList.ContainerGenerated event - // - internal class ContainerGeneratedEventArgs : EventArgs - { - - private CiderCategoryContainer _container; - - public ContainerGeneratedEventArgs(CiderCategoryContainer container) - { - if (container == null) - { - throw FxTrace.Exception.ArgumentNull("container"); - } - _container = container; - } - - public CiderCategoryContainer Container - { - get { - return _container; - } - } - } - - // - // Used in conjunction with ContainerGeneratedEventArgs - // - // - // - internal delegate void ContainerGeneratedHandler(object sender, ContainerGeneratedEventArgs e); -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/EditModeSwitchButtonKeyboardFix.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/EditModeSwitchButtonKeyboardFix.cs deleted file mode 100644 index c77f41ffa39..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/EditModeSwitchButtonKeyboardFix.cs +++ /dev/null @@ -1,155 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Windows; - using System.Windows.Input; - using System.Windows.Threading; - using System.Activities.Presentation.PropertyEditing; - using System.Runtime; - using System.Activities.Presentation; - - // - // This is a fix for a bug in EditModeSwitchButton which lives in System.Activities.Presentation and - // which has already been locked as an assembly. EditModeSwitchButton only responds to MouseDown - // events to make sure that the opening of the popup extended editor works correctly. However, - // that means that it will never respond to keyboard or automation events. To fix it, this class - // offers up an attached DP that, when used, hooks into events offered by EditModeSwitchButton - // to correct this issue and still have the button do the right thing even if mouse is not involved - // in invoking the button. - // - // This class is associated with every instance of EditModeSwitchButton using a setter in the - // EditModeSwitchButton style: - // - // <Style TargetType="{x:Type PropertyEditing:EditModeSwitchButton}" BasedOn="{StaticResource {x:Type Button}}"> - // ... - // <Setter Property="Internal:EditModeSwitchButtonKeyboardFix.ApplyFix" Value="True" /> - // - - class EditModeSwitchButtonKeyboardFix - { - - // - // Property used to correct a problem with EditModeSwitchButton. This property should only be - // applied to EditModeSwitchButton class instances. - // - public static readonly DependencyProperty ApplyFixProperty = DependencyProperty.RegisterAttached( - "ApplyFix", - typeof(bool), - typeof(EditModeSwitchButtonKeyboardFix), - new PropertyMetadata(false, new PropertyChangedCallback(OnApplyFixPropertyChanged))); - - private bool _clickInitiatedByMouse; - - private EditModeSwitchButtonKeyboardFix(EditModeSwitchButton button) - { - button.Click += new RoutedEventHandler(OnEditModeSwitchButtonClick); - button.PreviewMouseLeftButtonUp += new MouseButtonEventHandler(OnEditModeSwitchButtonPreviewMouseLeftButtonUp); - } - - // - // Gets the value of ApplyFix property from the specified DependencyObject. - // - // - // - public static bool GetApplyFix(DependencyObject obj) - { - if (obj == null) - { - throw FxTrace.Exception.ArgumentNull("obj"); - } - - return (bool)obj.GetValue(ApplyFixProperty); - } - - // - // Sets the value of ApplyFix property onto the specified DependencyObject. Only - // instances of EditModeSwitchButton classes should be used as the targets of this property. - // - // - // - public static void SetApplyFix(DependencyObject obj, bool value) - { - if (obj == null) - { - throw FxTrace.Exception.ArgumentNull("obj"); - } - - obj.SetValue(ApplyFixProperty, value); - } - - [SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults")] - private static void OnApplyFixPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) - { - EditModeSwitchButton button = obj as EditModeSwitchButton; - if (button == null) - { - Debug.Fail("EditModeSwitchButtonKeyboardFix.ApplyFix fix can only be applied to EditModeSwitchButton instances."); - return; - } - if (object.Equals(e.NewValue, true)) - { - // Instantiating this class will make itself hook into EditModeSwitchButton's events, - // hence not be chewed up by garbage collector - new EditModeSwitchButtonKeyboardFix(button); - } - } - - private void OnEditModeSwitchButtonPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) - { - _clickInitiatedByMouse = true; - - ((DispatcherObject)sender).Dispatcher.BeginInvoke(DispatcherPriority.Input, new MethodInvoker(delegate() - { - _clickInitiatedByMouse = false; - })); - } - - private void OnEditModeSwitchButtonClick(object sender, RoutedEventArgs e) - { - if (_clickInitiatedByMouse) - { - return; - } - - EditModeSwitchButton button = e.OriginalSource as EditModeSwitchButton; - Fx.Assert(button != null, "Expected to see the EditModeSwitchButton at this point."); - if (button == null) - { - return; - } - - // At this point the click was initiated using the Invoke AutomationPeer pattern or - // by using the keyboard. So, make sure that the EditModeSwitchButton.OnMouseDown - // button still executes. - // Invoke the appropriate command - switch (button.TargetEditMode) - { - case PropertyContainerEditMode.Inline: - PropertyValueEditorCommands.ShowInlineEditor.Execute(null, button); - break; - case PropertyContainerEditMode.ExtendedPopup: - PropertyValueEditorCommands.ShowExtendedPopupEditor.Execute(null, button); - break; - case PropertyContainerEditMode.ExtendedPinned: - PropertyValueEditorCommands.ShowExtendedPinnedEditor.Execute(null, button); - break; - case PropertyContainerEditMode.Dialog: - PropertyValueEditorCommands.ShowDialogEditor.Execute(null, button); - break; - default: - Debug.Fail(string.Format( - CultureInfo.CurrentCulture, - "EditModeSwitchButtonKeyboardFix does not yet support PropertyContainerEditMode '{0}'.", - button.TargetEditMode.ToString())); - break; - } - } - private delegate void MethodInvoker(); - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/BoolViewEditor.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/BoolViewEditor.cs deleted file mode 100644 index ee406e06936..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/BoolViewEditor.cs +++ /dev/null @@ -1,19 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System.Windows; - using System.Activities.Presentation.PropertyEditing; - using System.Activities.Presentation.Internal.PropertyEditing.Resources; - - // - // Simple PropertyValueEditor that uses the BoolViewTemplate (see StylesCore.Editors.xaml) - // - internal class BoolViewEditor : PropertyValueEditor - { - public BoolViewEditor() - : - base(PropertyInspectorResources.GetResources()["BoolViewTemplate"] as DataTemplate) { } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/EditorUtilities.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/EditorUtilities.cs deleted file mode 100644 index a9e9e78a4c0..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/EditorUtilities.cs +++ /dev/null @@ -1,111 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System; - using System.Collections; - using System.Globalization; - using System.Reflection; - using System.Activities.Presentation.PropertyEditing; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - - // - // Collection of utilities used by the various value editors - // - internal static class EditorUtilities - { - - // Key = Type, Value = bool - private static Hashtable _cachedLookups = new Hashtable(); - - // - // Checks to see whether the specified Type is concrete and has a default constructor. - // That information if both returned and cached for future reference. - // - // NOTE: This method does not handle structs correctly because it will return FALSE - // for struct types, which is incorrect. However, this bug has its counter-part in - // System.Activities.Presentation.dll where the default NewItemFactory only instantiates - // non-struct classes. Both of these need to be fixed at the same time because - // they are used in conjunction. However, MWD is currently locked. - // - // - // Type to verify - // True if the specified type is concrete and has a default constructor, - // false otherwise. - public static bool IsConcreteWithDefaultCtor(Type type) - { - - object returnValue = _cachedLookups[type]; - if (returnValue == null) - { - if (type == null || type.IsAbstract) - { - returnValue = false; - } - else - { - ConstructorInfo defaultCtor = type.GetConstructor(Type.EmptyTypes); - returnValue = (defaultCtor != null && defaultCtor.IsPublic); - } - - _cachedLookups[type] = returnValue; - } - - return (bool)returnValue; - } - - // - // Substitutes user-friendly display names for values of properties - // - // Item to attempt to identify - // String value for the item (guaranteed to be non-null) - public static string GetDisplayName(object item) - { - if (item == null) - { - return string.Empty; - } - - // Display a user-friendly string for PropertyValues - PropertyValue propertyValue = item as PropertyValue; - if (propertyValue != null) - { - return PropertyValueToDisplayNameConverter.Instance.Convert( - propertyValue, typeof(string), null, CultureInfo.CurrentCulture).ToString(); - } - - // Display a user-friendly string for NewItemFactoryTypeModels - NewItemFactoryTypeModel model = item as NewItemFactoryTypeModel; - if (model != null) - { - return NewItemFactoryTypeModelToDisplayNameConverter.Instance.Convert( - model, typeof(string), null, CultureInfo.CurrentCulture).ToString(); - } - - // Otherwise, resort to ToString() implementation - return item.ToString(); - } - - // - // Tests whether a type t is a nullable enum type - // - // The type object to be tested - // A bool indicating the test result - public static bool IsNullableEnumType(Type t) - { - if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)) - { - Type[] genericArgs = t.GetGenericArguments(); - if (genericArgs != null && genericArgs.Length == 1) - { - return genericArgs[0].IsEnum; - } - } - - return false; - } - - public const string NullString = "(null)"; - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/FlagEditor.xaml.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/FlagEditor.xaml.cs deleted file mode 100644 index 1b1fa52633d..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/FlagEditor.xaml.cs +++ /dev/null @@ -1,138 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System.Windows.Controls; - using System.Windows; - using System.Windows.Data; - using System.Windows.Input; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.ValueEditors; - using System.Activities.Presentation.PropertyEditing; - using System.Windows.Media; - using System.Windows.Threading; - - partial class FlagEditor : ComboBox - { - bool isCommitting = false; - - public static readonly DependencyProperty FlagTypeProperty = - DependencyProperty.Register("FlagType", typeof(Type), typeof(FlagEditor), new PropertyMetadata(null)); - - public Type FlagType - { - get { return (Type)GetValue(FlagTypeProperty); } - set { SetValue(FlagTypeProperty, value); } - } - - public FlagEditor() - { - InitializeComponent(); - } - - void Cancel() - { - BindingExpression binding = this.GetBindingExpression(ComboBox.TextProperty); - binding.UpdateTarget(); - } - - void Commit() - { - // In case of error, the popup can make the control lose focus; we don't want to commit twice. - if (!this.isCommitting) - { - BindingExpression binding = this.GetBindingExpression(ComboBox.TextProperty); - if (binding != null) - { - this.isCommitting = true; - try - { - binding.UpdateSource(); - } - catch (ArgumentException exception) - { - ErrorReporting.ShowErrorMessage(exception.Message); - binding.UpdateTarget(); - } - this.isCommitting = false; - } - } - } - - void Finish() - { - ValueEditorUtils.ExecuteCommand(PropertyValueEditorCommands.FinishEditing, this, null); - } - - protected override void OnPreviewKeyDown(KeyEventArgs e) - { - if (e.Key == Key.Down) - { - this.IsDropDownOpen = true; - e.Handled = true; - } - if (e.Key == Key.Enter || e.Key == Key.Return) - { - if (this.IsDropDownOpen) - { - this.IsDropDownOpen = false; - } - this.Commit(); - if ((e.KeyboardDevice.Modifiers & ModifierKeys.Shift) == 0) - { - this.Finish(); - } - //Handle this event so that the combo box item is not applied to the text box on "Enter". - e.Handled = true; - } - else if (e.Key == Key.Escape) - { - this.Cancel(); - } - base.OnPreviewKeyDown(e); - } - - protected override void OnDropDownOpened(EventArgs e) - { - base.OnDropDownOpened(e); - this.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => - { - // The item should contains the panel we placed in the combobox, - // and we should always have one and only one item. - ComboBoxItem comboBoxItem = - this.ItemContainerGenerator.ContainerFromIndex(0) as ComboBoxItem; - if (comboBoxItem != null && VisualTreeHelper.GetChildrenCount(comboBoxItem) > 0) - { - comboBoxItem.Focusable = false; - StackPanel panel = VisualTreeHelper.GetChild(comboBoxItem, 0) as StackPanel; - if (panel != null && VisualTreeHelper.GetChildrenCount(panel) > 0) - { - // focus on the first UIElement on the panel. - UIElement item = VisualTreeHelper.GetChild(panel, 0) as UIElement; - if (item != null) - { - item.Focus(); - } - } - } - - })); - } - - protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e) - { - if (!this.IsKeyboardFocusWithin) - { - this.Commit(); - } - base.OnLostKeyboardFocus(e); - } - - protected override void OnDropDownClosed(EventArgs e) - { - this.Commit(); - base.OnDropDownClosed(e); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/FlagPanel.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/FlagPanel.cs deleted file mode 100644 index 783742c5af0..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/FlagPanel.cs +++ /dev/null @@ -1,121 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System.Windows.Controls; - using System.Windows.Data; - using System.Globalization; - using System.Windows; - using System.Windows.Automation; - using System.Runtime; - sealed class FlagPanel : StackPanel - { - public static readonly DependencyProperty FlagStringProperty = - DependencyProperty.Register("FlagString", typeof(string), typeof(FlagPanel), new PropertyMetadata(string.Empty)); - - public static readonly DependencyProperty FlagTypeProperty = DependencyProperty.Register( - "FlagType", - typeof(Type), - typeof(FlagPanel), - new PropertyMetadata(null, new PropertyChangedCallback(OnFlagTypeChanged))); - - public Type FlagType - { - get { return (Type)GetValue(FlagTypeProperty); } - set { SetValue(FlagTypeProperty, value); } - } - - public string FlagString - { - get { return (string)GetValue(FlagStringProperty); } - set { SetValue(FlagStringProperty, value); } - } - - static void OnFlagTypeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) - { - Type flagType = args.NewValue as Type; - Fx.Assert(flagType == null || flagType.IsEnum, "FlagType should be null or enum"); - Fx.Assert(flagType == null || Attribute.IsDefined(flagType, typeof(FlagsAttribute)), "FlagType should be null or have flags attribute"); - - if (flagType == null) - { - return; - } - - int index = 0; - FlagPanel panel = sender as FlagPanel; - string[] flagNames = flagType.GetEnumNames(); - string zeroValueString = Enum.ToObject(flagType, 0).ToString(); - foreach (string flagName in flagNames) - { - if (zeroValueString.Equals("0") || !flagName.Equals(zeroValueString)) - { - CheckBox checkBox = new CheckBox(); - panel.Children.Add(checkBox); - checkBox.Content = flagName; - checkBox.DataContext = panel; - checkBox.SetValue(AutomationProperties.AutomationIdProperty, flagName); - Binding binding = new Binding("FlagString"); - binding.Mode = BindingMode.TwoWay; - binding.Converter = new CheckBoxStringConverter(index); - binding.ConverterParameter = panel; - checkBox.SetBinding(CheckBox.IsCheckedProperty, binding); - index++; - } - } - } - - sealed class CheckBoxStringConverter : IValueConverter - { - int index; - - public CheckBoxStringConverter(int index) - { - this.index = index; - } - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - string str = (value as string).ToUpperInvariant(); - FlagPanel panel = parameter as FlagPanel; - if (str.Contains((panel.Children[this.index] as CheckBox).Content.ToString().ToUpperInvariant())) - { - return true; - } - else - { - return false; - } - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - FlagPanel panel = parameter as FlagPanel; - string str = string.Empty; - for (int i = 0; i < panel.Children.Count; i++) - { - if ((i != this.index && ((bool)(panel.Children[i] as CheckBox).IsChecked)) || - (i == this.index && (bool)value)) - { - if (!string.IsNullOrEmpty(str)) - { - str += ", "; - } - str += (panel.Children[i] as CheckBox).Content.ToString(); - } - } - if (string.IsNullOrEmpty(str)) - { - Type flagType = panel.FlagType; - Fx.Assert(flagType != null && flagType.IsEnum, "FlagType should be enum"); - Fx.Assert(Attribute.IsDefined(flagType, typeof(FlagsAttribute)), "FlagType should have flags attribute"); - - return Enum.ToObject(flagType, 0).ToString(); - } - return str; - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/FlagStringConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/FlagStringConverter.cs deleted file mode 100644 index 87bffe98791..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/FlagStringConverter.cs +++ /dev/null @@ -1,75 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System.Windows.Data; - using System.Globalization; - using System.Collections.Generic; - using System.Runtime; - using System.Collections; - sealed class FlagStringConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value != null) - { - return value.ToString(); - } - else - { - return string.Empty; - } - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - Type flagType = parameter as Type; - Fx.Assert(flagType != null && flagType.IsEnum, "TargetType should be enum"); - Fx.Assert(Attribute.IsDefined(flagType, typeof(FlagsAttribute)), "FlagType should have flags attribute"); - - if (value == null) - { - return Enum.ToObject(flagType, 0); - } - - string str = (value as string).ToUpperInvariant(); - str = str.Trim(); - if (str.Equals(string.Empty) || str.Equals("0")) - { - return Enum.ToObject(flagType, 0); - } - - Dictionary flagDictionary = GenerateFlagDictionary(flagType); - int flagsIntValue = 0; - string[] names = str.Split(','); - foreach (string name in names) - { - string flagName = name.Trim(); - if (flagDictionary.ContainsKey(flagName)) - { - flagsIntValue |= (int)flagDictionary[flagName]; - flagDictionary.Remove(flagName); - } - else - { - throw FxTrace.Exception.AsError(new ArgumentException(string.Format(CultureInfo.CurrentUICulture, SR.InvalidFlagName, value, flagType.Name))); - } - } - return Enum.ToObject(flagType, flagsIntValue); - } - - static Dictionary GenerateFlagDictionary(Type flagType) - { - Dictionary flagDictionary = new Dictionary(); - string[] flagNames = flagType.GetEnumNames(); - Array flagValues = flagType.GetEnumValues(); - for (int i = 0; i < flagNames.Length; i++) - { - flagDictionary.Add(flagNames[i].ToUpperInvariant(), flagValues.GetValue(i)); - } - return flagDictionary; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/ImageSourceToImageConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/ImageSourceToImageConverter.cs deleted file mode 100644 index 353272678b3..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/ImageSourceToImageConverter.cs +++ /dev/null @@ -1,47 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System; - using System.Globalization; - using System.Diagnostics.CodeAnalysis; - using System.Windows.Controls; - using System.Windows.Data; - using System.Windows.Media; - - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - using System.Activities.Presentation; - - // - // Converter that takes an object and either returns it - // or wraps it in an Image control if the object is of type ImageSource. - // This class gets instantiated from XAML. - // - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class ImageSourceToImageConverter : IValueConverter - { - // IValueConverter Members - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - - ImageSource imageSource = value as ImageSource; - - if (imageSource == null) - { - return value; - } - - Image image = new Image(); - image.Source = imageSource; - return image; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw FxTrace.Exception.AsError(new InvalidOperationException()); - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/NewItemFactoryTypeModelToDisplayNameConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/NewItemFactoryTypeModelToDisplayNameConverter.cs deleted file mode 100644 index b2264b53458..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/NewItemFactoryTypeModelToDisplayNameConverter.cs +++ /dev/null @@ -1,62 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System; - using System.Windows.Data; - using System.Globalization; - - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - using System.Activities.Presentation; - - // - // Converts an instance of NewItemFactoryTypeModel to its appropriate display name. - // One way binding to NewItemFactoryTypeModel's DisplayName property also works, but - // for the sake of having a single place that converts NewItemFactoryTypeModel to - // strings, we expose this internal converter. - // - internal class NewItemFactoryTypeModelToDisplayNameConverter : IValueConverter - { - - private static NewItemFactoryTypeModelToDisplayNameConverter _instance; - - // - // Static instance accessor for all non-XAML related conversion needs - // - public static NewItemFactoryTypeModelToDisplayNameConverter Instance - { - get { - if (_instance == null) - { - _instance = new NewItemFactoryTypeModelToDisplayNameConverter(); - } - - return _instance; - } - } - - // Converts an instance of NewItemFactoryTypeModel to its appropriate display name - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - - if (typeof(string).IsAssignableFrom(targetType)) - { - - NewItemFactoryTypeModel model = value as NewItemFactoryTypeModel; - if (model != null) - { - return model.DisplayName ?? string.Empty; - } - } - - return string.Empty; - } - - // This class is only a one-way converter - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw FxTrace.Exception.AsError(new InvalidOperationException()); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/NonZeroToBoolConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/NonZeroToBoolConverter.cs deleted file mode 100644 index 2ea67c599a6..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/NonZeroToBoolConverter.cs +++ /dev/null @@ -1,49 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System; - using System.Collections; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Windows.Data; - using System.Activities.Presentation; - - // - // Converts ints >0 to true, everything else to false. This class is instantiated from XAML. - // - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class NonZeroToBoolConverter : IValueConverter - { - - private bool _invert; - - // - // If set to false, NonZeroToBoolConverter.Convert() converts 0 to false and !0 to true. - // If set to true, the result is inverted. - // - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public bool Invert - { - get { return _invert; } - set { _invert = value; } - } - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (targetType == typeof(bool) && value is int) - { - return (((int)value) > 0) ^ _invert; - } - - return false; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw FxTrace.Exception.AsError(new NotImplementedException()); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/PropertyValueToDisplayNameConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/PropertyValueToDisplayNameConverter.cs deleted file mode 100644 index dfde667aed5..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/PropertyValueToDisplayNameConverter.cs +++ /dev/null @@ -1,107 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System; - using System.Collections.Generic; - using System.Diagnostics; - using System.Globalization; - using System.Text; - using System.Windows.Data; - - using System.Activities.Presentation.PropertyEditing; - using System.Activities.Presentation; - - using System.Activities.Presentation.Internal.PropertyEditing.Model; - using System.Activities.Presentation.Internal.Properties; - - // - // ValueConverter that takes an instance of PropertyValue and returns a display name for - // it. The returned name consists of the value Type name as well as its x:Name property - // if it is defined. - // - internal class PropertyValueToDisplayNameConverter : IValueConverter - { - - private static PropertyValueToDisplayNameConverter _instance; - - // - // Static instance accessor for all non-XAML related conversion needs - // - public static PropertyValueToDisplayNameConverter Instance - { - get { - if (_instance == null) - { - _instance = new PropertyValueToDisplayNameConverter(); - } - - return _instance; - } - } - - // Converts an instance of PropertyValue to its appropriate display name - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - - if (typeof(string).IsAssignableFrom(targetType)) - { - - PropertyValue propertyValue = value as PropertyValue; - if (propertyValue != null) - { - - ModelPropertyEntryBase propertyEntry = propertyValue.ParentProperty as ModelPropertyEntryBase; - - // Figure out the value type name - string valueTypeName = string.Empty; - if (propertyEntry != null) - { - valueTypeName = propertyEntry.CommonValueType == null ? string.Empty : propertyEntry.CommonValueType.Name; - } - else - { - Debug.Fail("PropertyValueToDisplayNameConverter is being used for something other than ModelPropertyValues. Re-evaluate the correctness of its logic."); - - // Fallback mechanism - object rawPropertyValue = propertyValue.Value; - if (rawPropertyValue != null) - { - valueTypeName = rawPropertyValue.GetType().Name; - } - } - - // See if there is a regular name - string propertyName = ModelUtilities.GetPropertyName(propertyValue); - - if (string.IsNullOrEmpty(propertyName)) - { - // Type only - return string.Format( - culture, - Resources.PropertyEditing_CollectionItemDisplayFormatType, - valueTypeName); - } - else - { - // Type and name - return string.Format( - culture, - Resources.PropertyEditing_CollectionItemDisplayFormatTypeAndName, - valueTypeName, - propertyName); - } - } - } - - return string.Empty; - } - - // This class is only a one-way converter - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw FxTrace.Exception.AsError(new NotImplementedException()); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/PropertyValueToStandardValuesConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/PropertyValueToStandardValuesConverter.cs deleted file mode 100644 index 58550c64bf5..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/PropertyValueToStandardValuesConverter.cs +++ /dev/null @@ -1,146 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System; - using System.Collections; - using System.ComponentModel; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Windows.Data; - - using System.Runtime; - using System.Activities.Presentation; - using System.Activities.Presentation.PropertyEditing; - using System.Activities.Presentation.Internal.Properties; - using System.Activities.Presentation.Internal.PropertyEditing.Model; - - // - // Retrieves StandardValues from a passed in PropertyValue, making sure that if a TypeConverter - // exists and if it supports ConvertToString() method, it will be called on each value contained - // in the StandardValues collection. - // This class is instantiated through XAML - // - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class PropertyValueToStandardValuesConverter : IValueConverter - { - // IValueConverter Members - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - - Fx.Assert(typeof(IEnumerable).IsAssignableFrom(targetType), "Expecting IEnumerable as the targetType"); - - PropertyValue propertyValue = value as PropertyValue; - if (propertyValue == null) - { - return null; - } - - ModelPropertyEntryBase parentProperty = (ModelPropertyEntryBase)propertyValue.ParentProperty; - return new ConvertedStandardValuesCollection(parentProperty, culture); - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw FxTrace.Exception.AsError(new InvalidOperationException()); - } - - - // - // An implementation of ICollection that defers access to the standard - // values collection. Accessing the StandardValues collection may be - // expensive, so we defer it until we absolutely need it. - // - private class ConvertedStandardValuesCollection : ICollection - { - - private ModelPropertyEntryBase _property; - private CultureInfo _culture; - private ICollection _contents; - - internal ConvertedStandardValuesCollection(ModelPropertyEntryBase property, CultureInfo culture) - { - _property = property; - _culture = culture; - } - - public int Count - { - get { return Contents.Count; } - } - - public bool IsSynchronized - { - get { return false; } - } - - public object SyncRoot - { - get { return Contents.SyncRoot; } - } - - // IEnumerable Members - - private ICollection Contents - { - get { - if (_contents == null) - { - ICollection standardValues = _property.StandardValues; - TypeConverter converter = _property.Converter; - - if (standardValues != null && (converter == null || !converter.CanConvertTo(typeof(string)))) - { - _contents = standardValues; - } - else - { - ArrayList convertedStandardValues = new ArrayList(standardValues == null ? 0 : standardValues.Count); - if (standardValues != null) - { - foreach (object standardValue in standardValues) - { - convertedStandardValues.Add(converter.ConvertToString(null, _culture, standardValue)); - } - } - _contents = convertedStandardValues; - } - - // PS 107537: Special-case handling for nullable enum types - if (EditorUtilities.IsNullableEnumType(_property.PropertyType)) - { - ArrayList filteredStandardValues = new ArrayList(); - filteredStandardValues.Add(EditorUtilities.NullString); - foreach (var i in (ArrayList)_contents) - { - if (i != null) - { - filteredStandardValues.Add(i); - } - } - _contents = filteredStandardValues; - } - } - - return _contents; - } - } - - // ICollection Members - - public void CopyTo(Array array, int index) - { - Contents.CopyTo(array, index); - } - - public IEnumerator GetEnumerator() - { - return Contents.GetEnumerator(); - } - - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/RTLValueConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/RTLValueConverter.cs deleted file mode 100644 index 9c002083e48..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/RTLValueConverter.cs +++ /dev/null @@ -1,58 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - - using System; - using System.Collections; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Windows.Data; - using System.Windows; - using System.Activities.Presentation.Internal.PropertyEditing.Model; - using System.Activities.Presentation.Internal.PropertyEditing.Resources; - using System.Activities.Presentation.PropertyEditing; - using System.Activities.Presentation; - using System.Runtime; - - // - // Checks the property entry and converts it - // to appropriate FlowDirection value which is returned back. - // - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class RTLValueConveter : IMultiValueConverter - { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { - FlowDirection returnValue = FlowDirection.LeftToRight; - Fx.Assert(values.Length == 3, "Incorrect values in the MultiValueConverter!"); - if (values.Length == 3) - { - ModelPropertyEntry propertyEntry = values[1] as ModelPropertyEntry; - if (propertyEntry != null) - { - if (!propertyEntry.DisplayName.Equals("Name")) - { - if (targetType == typeof(FlowDirection)) - { - object propertyValue = values[0]; - if (propertyValue == null || propertyValue.GetType() == typeof(string)) - { - //customize it to controls FlowDirection Property - returnValue = (FlowDirection)PropertyInspectorResources.GetResources()["SelectedControlFlowDirectionRTL"]; - } - } - } - } - } - return returnValue; - } - - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { - throw FxTrace.Exception.AsError(new NotImplementedException()); - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/SubPropertyEditor.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/SubPropertyEditor.cs deleted file mode 100644 index f2cdbcde75c..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/SubPropertyEditor.cs +++ /dev/null @@ -1,630 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.ComponentModel; - using System.Globalization; - using System.Windows; - using System.Windows.Automation.Peers; - using System.Windows.Controls; - using System.Windows.Data; - - using System.Runtime; - using System.Activities.Presentation.Model; - using System.Activities.Presentation.PropertyEditing; - - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - - using System.Activities.Presentation.Internal.PropertyEditing.Automation; - using System.Activities.Presentation.Internal.PropertyEditing.Model; - using ModelUtilities = System.Activities.Presentation.Internal.PropertyEditing.Model.ModelUtilities; - using System.Activities.Presentation.Internal.PropertyEditing.Resources; - using System.Activities.Presentation.Internal.PropertyEditing.Selection; - using System.Activities.Presentation.Internal.PropertyEditing.State; - - // - // We use the SubPropertyEditor to replace the entire property row - // when the property exposes its subproperties. This control is _not_ - // just used within the value-editing portion of a property row. - // We cheat because we can. - // - internal class SubPropertyEditor : Control, INotifyPropertyChanged, ISelectionStop - { - - // - // PropertyEntry is used to store the currently displayed PropertyEntry - // - public static readonly DependencyProperty PropertyEntryProperty = DependencyProperty.Register( - "PropertyEntry", - typeof(PropertyEntry), - typeof(SubPropertyEditor), - new PropertyMetadata(null, new PropertyChangedCallback(OnPropertyEntryChanged))); - - // - // Boolean used to indicate whether the sub-properties are being shown or not. As an optimization, - // we don't actually expose the PropertyValue's sub-properties through SelectiveSubProperties until - // the sub-property expando-pane has been open at least once. - // - public static readonly DependencyProperty IsExpandedProperty = DependencyProperty.Register( - "IsExpanded", - typeof(bool), - typeof(SubPropertyEditor), - new PropertyMetadata(false, new PropertyChangedCallback(OnIsExpandedChanged))); - - // - // Exposes the currently selected QuickType in the QuickType drop-down. Essentially, - // the value of this DP is plumbed through to reflect the value of _quickTypeView.CurrentItem - // - public static readonly DependencyProperty CurrentQuickTypeProperty = DependencyProperty.Register( - "CurrentQuickType", - typeof(NewItemFactoryTypeModel), - typeof(SubPropertyEditor), - new PropertyMetadata(null, new PropertyChangedCallback(OnCurrentQuickTypeChanged))); - - private ICollectionView _quickTypeView; - private ObservableCollection _quickTypeCollection; - private bool _ignoreInternalChanges; - private bool _exposedSubProperties; - - private ItemsControl _subPropertyListControl; - - // - // Basic ctor - // - public SubPropertyEditor() - { - _quickTypeCollection = new ObservableCollection(); - - _quickTypeView = CollectionViewSource.GetDefaultView(_quickTypeCollection); - _quickTypeView.CurrentChanged += new EventHandler(OnCurrentQuickTypeChanged); - } - - // Automation - - public event PropertyChangedEventHandler PropertyChanged; - - // Internal event we fire for the sake of SubPropertyEditorAutomationPeer that - // causes it to refresh its offered set of children - internal event EventHandler VisualsChanged; - - public PropertyEntry PropertyEntry - { - get { return (PropertyEntry)this.GetValue(PropertyEntryProperty); } - set { this.SetValue(PropertyEntryProperty, value); } - } - - public bool IsExpanded - { - get { return (bool)this.GetValue(IsExpandedProperty); } - set { this.SetValue(IsExpandedProperty, value); } - } - - public NewItemFactoryTypeModel CurrentQuickType - { - get { return (NewItemFactoryTypeModel)this.GetValue(CurrentQuickTypeProperty); } - set { this.SetValue(CurrentQuickTypeProperty, value); } - } - - // - // Gets a flag indicating whether QuickTypes exist - // - public bool HasQuickTypes - { - get { - return _quickTypeCollection.Count > 0; - } - } - - // - // Returns a list of available QuickTypes (collection of NewItemFactoryTypeModel instances) - // - public ICollectionView QuickTypes - { - get { - return _quickTypeView; - } - } - - // - // Exposes PropertyValue.SubProperties when the IsExpanded flag first gets set to true - // and forever thereafter (or at least until the current PropertyValue changes and we - // collapse the sub-properties) - // - public IEnumerable SelectiveSubProperties - { - get { - if (!_exposedSubProperties) - { - if (!this.IsExpanded) - { - yield break; - } - - _exposedSubProperties = true; - } - - PropertyEntry parent = this.PropertyEntry; - if (parent == null) - { - yield break; - } - - foreach (ModelPropertyEntry subProperty in parent.PropertyValue.SubProperties) - { - if (subProperty.IsBrowsable) - { - yield return subProperty; - } - } - } - } - - // - // Gets a flag indicating whether the sub-property editor can be expanded or not. - // - public bool IsExpandable - { - get { return this.HasQuickTypes && this.CurrentQuickType != null; } - } - - // - // Gets a SelectionPath to itself. - // - public SelectionPath Path - { - get { return PropertySelectionPathInterpreter.Instance.ConstructSelectionPath(this.PropertyEntry); } - } - - // - // Gets a description of the contained property - // to expose through automation - // - public string Description - { - get { - PropertyEntry property = this.PropertyEntry; - if (property != null) - { - return string.Format( - CultureInfo.CurrentCulture, - Properties.Resources.PropertyEditing_SelectionStatus_Property, - this.PropertyEntry.PropertyName); - } - - return string.Empty; - } - } - - - // - // Exposes the ItemsControl used to display the list of sub-properties. UI-specific - // - private ItemsControl SubPropertyListControl - { - get { - if (_subPropertyListControl == null) - { - _subPropertyListControl = VisualTreeUtils.GetNamedChild(this, "PART_SubPropertyList"); - Fx.Assert(_subPropertyListControl != null, "UI for SubPropertyEditor changed. Need to update SubPropertyEditor class logic."); - } - - return _subPropertyListControl; - } - } - - - // Keyboard Navigation - - protected override AutomationPeer OnCreateAutomationPeer() - { - return new SubPropertyEditorAutomationPeer(this); - } - - - // Properties - - // PropertyEntry DP - - // When the displayed PropertyEntry changes, make sure we update the UI and hook into the - // new PropertyEntry's notification mechanism - private static void OnPropertyEntryChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) - { - SubPropertyEditor theThis = obj as SubPropertyEditor; - if (theThis == null) - { - return; - } - - PropertyEntry oldValue = e.OldValue as PropertyEntry; - if (oldValue != null) - { - oldValue.PropertyValue.RootValueChanged -= new EventHandler(theThis.OnPropertyValueRootValueChanged); - } - - PropertyEntry newValue = e.NewValue as PropertyEntry; - if (newValue != null) - { - newValue.PropertyValue.RootValueChanged += new EventHandler(theThis.OnPropertyValueRootValueChanged); - } - - theThis.RefreshVisuals(); - } - - private void OnPropertyValueRootValueChanged(object sender, EventArgs e) - { - if (_ignoreInternalChanges) - { - return; - } - - RefreshVisuals(); - } - - - // IsExpanded DP - - private static void OnIsExpandedChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) - { - SubPropertyEditor theThis = obj as SubPropertyEditor; - if (theThis == null) - { - return; - } - - bool newIsExpanded = (bool)e.NewValue; - PropertyEntry containedProperty = theThis.PropertyEntry; - - // Store the new expansion state - if (containedProperty != null) - { - PropertyState state = PropertyStateContainer.Instance.GetPropertyState( - ModelUtilities.GetCachedSubPropertyHierarchyPath(containedProperty)); - state.SubPropertiesExpanded = newIsExpanded; - } - - // If we are expanded but we never exposed the sub-properties to anyone before, - // fire a signal saying that a list of sub-properties may be now available, so that - // UI DataBindings refresh themselves - if (newIsExpanded == true && - theThis._exposedSubProperties == false) - { - theThis.FireSubPropertiesListChangedEvents(); - } - } - - // CurrentQuickType DP - - // This method gets called when the DP changes - private static void OnCurrentQuickTypeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) - { - SubPropertyEditor theThis = obj as SubPropertyEditor; - if (theThis == null) - { - return; - } - - if (theThis._ignoreInternalChanges) - { - return; - } - - theThis._quickTypeView.MoveCurrentTo(e.NewValue); - - theThis.ExpandSubProperties(); - theThis.FireSubPropertiesListChangedEvents(); - } - - // This method gets called when the CurrentItem on _quickTypeView changes - private void OnCurrentQuickTypeChanged(object sender, EventArgs e) - { - if (_ignoreInternalChanges) - { - return; - } - - NewItemFactoryTypeModel selectedTypeModel = _quickTypeView.CurrentItem as NewItemFactoryTypeModel; - - if (selectedTypeModel == null) - { - return; - } - - Fx.Assert(this.PropertyEntry != null, "PropertyEntry should not be null"); - if (this.PropertyEntry == null) - { - return; - } - - bool previousValue = IgnoreInternalChanges(); - try - { - this.PropertyEntry.PropertyValue.Value = selectedTypeModel.CreateInstance(); - } - finally - { - NoticeInternalChanges(previousValue); - } - } - - - protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) - { - if (e.Property == PropertyContainer.OwningPropertyContainerProperty) - { - - // A quick and dirty way to register this instance as the implementation of - // ISelectionBranchPoint that controls the expansion / collapse of this control - // - OnOwningPropertyContainerChanged((PropertyContainer)e.OldValue, (PropertyContainer)e.NewValue); - - } - - base.OnPropertyChanged(e); - } - - private void OnOwningPropertyContainerChanged(PropertyContainer oldValue, PropertyContainer newValue) - { - if (oldValue != null) - { - PropertySelection.ClearSelectionStop(oldValue); - PropertySelection.ClearIsSelectionStopDoubleClickTarget(oldValue); - } - - if (newValue != null) - { - PropertySelection.SetSelectionStop(newValue, this); - PropertySelection.SetIsSelectionStopDoubleClickTarget(newValue, true); - } - } - - - // Visual Lookup Helpers - - // - // Looks for and returns the specified sub-property - // - // Sub-property to look up - // Corresponding PropertyEntry if found, null otherwise. - internal PropertyEntry FindSubPropertyEntry(string propertyName) - { - if (string.IsNullOrEmpty(propertyName)) - { - return null; - } - - foreach (PropertyEntry property in SelectiveSubProperties) - { - if (property.PropertyName.Equals(propertyName)) - { - return property; - } - } - - return null; - } - - // - // Looks for and returns the PropertyContainer used to display - // the specified PropertyEntry - // - // Property to look for - // Corresponding PropertyContainer if found, null otherwise. - internal PropertyContainer FindSubPropertyEntryVisual(PropertyEntry property) - { - if (property == null) - { - return null; - } - - ItemsControl subPropertyListControl = this.SubPropertyListControl; - if (subPropertyListControl == null) - { - return null; - } - - return subPropertyListControl.ItemContainerGenerator.ContainerFromItem(property) as PropertyContainer; - } - - - // Helpers - - private void RefreshVisuals() - { - RefreshQuickTypes(); - RestoreIsExpandedState(); - FireVisualsChangedEvents(); - } - - private void RefreshQuickTypes() - { - bool previousValue = IgnoreInternalChanges(); - try - { - _quickTypeCollection.Clear(); - - PropertyEntry containedProperty = this.PropertyEntry; - if (containedProperty == null) - { - return; - } - - ModelProperty property = ((ModelPropertyEntry)containedProperty).FirstModelProperty; - Type containerValueType = ((ModelPropertyEntryBase)containedProperty).CommonValueType; - NewItemFactoryTypeModel selectedFactoryModel = null; - Type defaultItemType = GetDefaultItemType(property); - - // Find all elligible NewItemFactoryTypes declared through metadata - IEnumerable factoryModels = - ExtensibilityAccessor.GetNewItemFactoryTypeModels( - property, - ResourceUtilities.GetDesiredTypeIconSize(this)); - - if (factoryModels != null) - { - foreach (NewItemFactoryTypeModel factoryModel in factoryModels) - { - _quickTypeCollection.Add(factoryModel); - - if (selectedFactoryModel == null) - { - if (object.Equals(containerValueType, factoryModel.Type)) - { - selectedFactoryModel = factoryModel; - } - } - - if (defaultItemType != null && - object.Equals(defaultItemType, factoryModel.Type)) - { - defaultItemType = null; - } - } - } - - //add a null value - user should always have an option to clear property value - NewItemFactoryTypeModel nullTypeFactoryTypeModel = - new NewItemFactoryTypeModel(null, new NullItemFactory()); - - // Add a default item type based on the property type (if it wasn't also added through - // metadata) - if (defaultItemType != null) - { - NewItemFactoryTypeModel defaultItemFactoryTypeModel = new NewItemFactoryTypeModel(defaultItemType, new NewItemFactory()); - _quickTypeCollection.Add(defaultItemFactoryTypeModel); - - if (selectedFactoryModel == null) - { - if (object.Equals(containerValueType, defaultItemFactoryTypeModel.Type)) - { - selectedFactoryModel = defaultItemFactoryTypeModel; - } - else if (containerValueType == null) - { - selectedFactoryModel = nullTypeFactoryTypeModel; - } - } - } - - _quickTypeCollection.Add(nullTypeFactoryTypeModel); - - // Make sure the currently selected value on the CollectionView reflects the - // actual value of the property - _quickTypeView.MoveCurrentTo(selectedFactoryModel); - this.CurrentQuickType = selectedFactoryModel; - } - finally - { - NoticeInternalChanges(previousValue); - } - } - - private static Type GetDefaultItemType(ModelProperty property) - { - if (property == null) - { - return null; - } - - Type propertyType = property.PropertyType; - if (EditorUtilities.IsConcreteWithDefaultCtor(propertyType)) - { - return propertyType; - } - - return null; - } - - private void RestoreIsExpandedState() - { - bool newIsExpanded = false; - PropertyEntry property = this.PropertyEntry; - - if (property != null) - { - PropertyState state = PropertyStateContainer.Instance.GetPropertyState( - ModelUtilities.GetCachedSubPropertyHierarchyPath(property)); - newIsExpanded = state.SubPropertiesExpanded; - } - - this.IsExpanded = newIsExpanded; - _exposedSubProperties = false; - } - - private void ExpandSubProperties() - { - this.IsExpanded = true; - } - - - // Change Notification Helpers - - private bool IgnoreInternalChanges() - { - bool previousValue = _ignoreInternalChanges; - _ignoreInternalChanges = true; - return previousValue; - } - - private void NoticeInternalChanges(bool previousValue) - { - _ignoreInternalChanges = previousValue; - } - - private void FireVisualsChangedEvents() - { - // Fire updated events - OnPropertyChanged("HasQuickTypes"); - OnPropertyChanged("QuickTypes"); - FireSubPropertiesListChangedEvents(); - } - - private void FireSubPropertiesListChangedEvents() - { - OnPropertyChanged("IsExpandable"); - OnPropertyChanged("SelectiveSubProperties"); - - if (VisualsChanged != null) - { - VisualsChanged(this, EventArgs.Empty); - } - } - - - // INotifyPropertyChanged Members - - private void OnPropertyChanged(string propertyName) - { - Fx.Assert(!string.IsNullOrEmpty(propertyName), "Can't raise OnPropertyChanged event without a valid property name."); - - if (PropertyChanged != null) - { - this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); - } - } - - // ISelectionStop Members - - //NullItemFactory - this class is used to provide a null entry in quick types list - it is required to allow user - //to clear value of an object. - sealed class NullItemFactory : NewItemFactory - { - public override object CreateInstance(Type type) - { - //no input type is allowed - we never create instance of anything - Fx.Assert(type == null, "NullItemFactory supports only null as type parameter"); - return null; - } - - public override string GetDisplayName(Type type) - { - //no input type is allowed - we always return (null) string - Fx.Assert(type == null, "NullItemFactory supports only null as type parameter"); - return "(null)"; - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/SubPropertyViewEditor.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/SubPropertyViewEditor.cs deleted file mode 100644 index 30b45fab955..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/SubPropertyViewEditor.cs +++ /dev/null @@ -1,46 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System; - using System.Windows; - using System.Activities.Presentation.PropertyEditing; - using System.Activities.Presentation.Internal.PropertyEditing.Resources; - - // - // SubPropertyViewEditor is a "fake" value editor. We only use it as a marker that exposes - // MarkerSubPropertyTemplate as its editor DataTemplates. The XAML code for PropertyContainer - // specifically looks for these markers and it switches its InlineRowTemplate to a - // sub-property-specific inline row template when found. - // - internal class SubPropertyViewEditor : ExtendedPropertyValueEditor - { - - private static SubPropertyViewEditor _instance; - - // This class can have a private ctor because we instantiate it through code, - // not through XAML or attributes - private SubPropertyViewEditor() - : base( - PropertyInspectorResources.GetResources()["MarkerSubPropertyTemplate"] as DataTemplate, - PropertyInspectorResources.GetResources()["MarkerSubPropertyTemplate"] as DataTemplate) - { - } - - // - // Gets the static instance of this class - // - public static SubPropertyViewEditor Instance - { - get { - if (_instance == null) - { - _instance = new SubPropertyViewEditor(); - } - - return _instance; - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/ValueToToolTipConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/ValueToToolTipConverter.cs deleted file mode 100644 index 67476dd8d15..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/ValueToToolTipConverter.cs +++ /dev/null @@ -1,35 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Windows.Data; - using System.Runtime; - using System.Activities.Presentation; - - // - // A converter that takes a value of a property and a boolean indicating whether it - // is being edited and returns a string to use for the editor tool tip. - // This class gets instantiated from XAML. - // - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class ValueToToolTipConverter : IMultiValueConverter - { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { - Fx.Assert(values != null && values.Length == 2, "Invalid values passed into ValueToToolTipConverter"); - - bool isEditing = (bool)values[1]; - string value = isEditing ? null : EditorUtilities.GetDisplayName(values[0]); - - return string.IsNullOrEmpty(value) ? null : value; - } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { - throw FxTrace.Exception.AsError(new NotImplementedException()); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/newitemfactorytypemodeltotypenameconverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/newitemfactorytypemodeltotypenameconverter.cs deleted file mode 100644 index 91decef940f..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/newitemfactorytypemodeltotypenameconverter.cs +++ /dev/null @@ -1,41 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System; - using System.Windows.Data; - using System.Globalization; - - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - using System.Activities.Presentation; - - // - // Converts an instance of NewItemFactoryTypeModel to its contained Type name. - // - internal class NewItemFactoryTypeModelToTypeNameConverter : IValueConverter - { - - // Converts an instance of NewItemFactoryTypeModel to its corresponding type name - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - - if (typeof(string).IsAssignableFrom(targetType)) - { - NewItemFactoryTypeModel model = value as NewItemFactoryTypeModel; - if (model != null && model.Type != null) - { - return model.Type.Name; - } - } - - return string.Empty; - } - - // This class is only a one-way converter - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw FxTrace.Exception.AsError(new InvalidOperationException()); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/quickitemtemplateselector.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/quickitemtemplateselector.cs deleted file mode 100644 index fdee3bb8598..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Editors/quickitemtemplateselector.cs +++ /dev/null @@ -1,63 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Editors -{ - using System; - using System.Diagnostics.CodeAnalysis; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Media; - - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.ValueEditors; - - // - // DataTemplateSelector we use in some instances of ChoiceEditor (namely sub-property editor) - // to detect whether the given item is being displayed in the popup or as an inline item. - // Based on that determination, it returns the appropriate DataTemplate. This is a work-around - // for the problem where we can't determine which NewItemTypeFactory instantiated a given instance. - // Hence, we show the instance Type inline the ComboBox and the factory DisplayName in the drop-down. - // Ideally, we would want to use a different control to handle this scenario. - // - internal class QuickItemTemplateSelector : DataTemplateSelector - { - - private DataTemplate _popupTemplate; - private DataTemplate _inlineTemplate; - - public DataTemplate PopupTemplate - { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - get { return _popupTemplate; } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - set { _popupTemplate = value; } - } - - public DataTemplate InlineTemplate - { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - get { return _inlineTemplate; } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - set { _inlineTemplate = value; } - } - - public override DataTemplate SelectTemplate(object item, DependencyObject container) - { - return HasChoiceEditorParent(container) ? _inlineTemplate : _popupTemplate; - } - - private bool HasChoiceEditorParent(DependencyObject element) - { - while (element != null) - { - element = VisualTreeHelper.GetParent(element); - if (element != null && typeof(ChoiceEditor).IsAssignableFrom(element.GetType())) - { - return true; - } - } - - return false; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/ExtensibilityAccessor.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/ExtensibilityAccessor.cs deleted file mode 100644 index 002837b49a8..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/ExtensibilityAccessor.cs +++ /dev/null @@ -1,941 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Windows; - using System.Windows.Data; - using System.Windows.Markup; - - using System.Activities.Presentation.Model; - using System.Activities.Presentation.PropertyEditing; - - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - - using System.Activities.Presentation.Internal.PropertyEditing.Editors; - using ModelUtilities = System.Activities.Presentation.Internal.PropertyEditing.Model.ModelUtilities; - - // - // Static helper class that contains all extensibility-related code. No other code - // under PropertyEditing should be looking up attributes and interpretting them. - // In most cases, the methods here delegate to Sparkle's binaries to make sure that - // both products behave consistently. - // - internal static class ExtensibilityAccessor - { - - // Cache of Types to their respective DefaultProperties - private static Dictionary _defaultPropertyCache = new Dictionary(); - - // - // Gets the name of the category that the specified ModelProperty belongs to - // - // ModelProperty to examine - // Name of the category that the specified ModelProperty belongs to - public static string GetCategoryName(ModelProperty property) - { - CategoryAttribute attribute = GetAttribute(property); - - if (attribute == null || string.IsNullOrEmpty(attribute.Category)) - { - return CategoryAttribute.Default.Category; - } - else - { - return attribute.Category; - } - } - - // - // Gets the StandardValues that are exposed by the specified TypeConverter - // - // TypeConverter to examine - // StandardValues that are exposed by the specified TypeConverter - public static ArrayList GetStandardValues(TypeConverter converter) - { - if (converter == null) - { - return null; - } - - if (!converter.GetStandardValuesSupported()) - { - return null; - } - - ICollection values = converter.GetStandardValues(); - if (values == null) - { - return null; - } - - // unwrap ModelItems if that's what the converter gives us - ArrayList convertedValues = new ArrayList(values.Count); - foreach (object value in values) - { - ModelItem item = value as ModelItem; - if (item != null) - { - convertedValues.Add(item.GetCurrentValue()); - } - else - { - convertedValues.Add(value); - } - } - - return convertedValues; - } - - // - // Gets a flag indicating if a further call to GetStandardValues will - // give back a non-zero collection. - // - // The type converter to check. - // True if the type converter supports standard values. - public static bool GetStandardValuesSupported(TypeConverter converter) - { - return (converter != null && converter.GetStandardValuesSupported()); - } - - // - // Look for and return any custom PropertyValueEditor defined for the specified ModelProperty - // - // ModelProperty to examine - // A custom PropertyValueEditor for the specified ModelProperty (may be null) - public static PropertyValueEditor GetCustomPropertyValueEditor(ModelProperty property) - { - if (property == null) - { - return null; - } - - PropertyValueEditor editor = ExtensibilityMetadataHelper.GetValueEditor(property.Attributes, MessageLogger.Instance); - - //if property is a generic type, check for designer defined at generic type definition - if (editor == null && property.PropertyType.IsGenericType) - { - Type genericType = property.PropertyType.GetGenericTypeDefinition(); - editor = ExtensibilityMetadataHelper.GetValueEditor(TypeDescriptor.GetAttributes(genericType), MessageLogger.Instance); - } - - return editor; - } - // - // Returns an instance of SubPropertyEditor if the specified ModelProperty can be edited - // using sub-properties, null otherwise. - // - // ModelProperty to examine - // An instance of SubPropertyEditor if the specified ModelProperty can be edited - // using sub-properties, null otherwise. - public static PropertyValueEditor GetSubPropertyEditor(ModelProperty property) - { - if (property == null) - { - return null; - } - - if (property.Converter == null || - property.Converter.GetPropertiesSupported() == false) - { - // if it's a property of a generic type, check for converter defined at the property of generic type definition - if (property.Parent.ItemType.IsGenericType) - { - Type genericType = property.Parent.ItemType.GetGenericTypeDefinition(); - PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(genericType); - PropertyDescriptor propertyDescriptor = properties.Find(property.Name, false); - if (propertyDescriptor != null) - { - // wrap the converter and check if it supports GetProperties() - TypeConverter converter = new ModelTypeConverter(((IModelTreeItem)property.Parent).ModelTreeManager, propertyDescriptor.Converter); - if (converter.GetPropertiesSupported()) - { - return SubPropertyViewEditor.Instance; - } - } - } - - return null; - } - - //Dont support Arrays - if (typeof(Array).IsAssignableFrom(property.PropertyType)) - { - return null; - } - - return SubPropertyViewEditor.Instance; - } - - // - // ----s open the specified Type and looks for EditorAttributes that represent - // CategoryEditors - returns the Types of those editors, if any are found, as a list - // - // Type to ---- open - // List of CategoryEditors associated with the specified type, if any. Null otherwise. - public static IEnumerable GetCategoryEditorTypes(Type ownerType) - { - - List editorTypes = null; - - foreach (EditorAttribute editorAttribute in GetAttributes(ownerType)) - { - - // A ---- attempt at using the same extensibility code - Type editorType = ExtensibilityMetadataHelper.GetCategoryEditorType(editorAttribute, MessageLogger.Instance); - if (editorType == null) - { - continue; - } - - if (editorTypes == null) - { - editorTypes = new List(); - } - - editorTypes.Add(editorType); - } - - return editorTypes; - } - - // - // Decides whether the specified ModelProperty should be advanced - // - // ModelProperty to look up - // True if the property should be advanced, false otherwise - public static bool GetIsAdvanced(ModelProperty property) - { - EditorBrowsableAttribute browsable = GetAttribute(property); - - if (browsable == null) - { - return false; - } - - return browsable.State == EditorBrowsableState.Advanced; - } - - // - // Decides whether the specified CategoryEditor should be advanced. - // Note: Blend uses custom, baked-in logic to determine whether a given CategoryEditor - // is advanced or not. The logic is the same as the one here, but we can't share it - // because they don't expose it. In v2, this is definitely something we should share. - // - // CategoryEditor to look up - // True if the specified editor should be advanced, false otherwise - public static bool GetIsAdvanced(CategoryEditor editor) - { - EditorBrowsableAttribute browsable = GetAttribute(editor.GetType()); - - if (browsable == null) - { - return false; - } - - return browsable.State == EditorBrowsableState.Advanced; - } - - // - // Looks up the DefaultPropertyAttribute on the given type and returns the default property, - // if any. - // - // Type to look up - // Default property associated with the specified type, if any. - public static string GetDefaultProperty(Type type) - { - if (type == null) - { - return null; - } - - string defaultProperty; - if (_defaultPropertyCache.TryGetValue(type, out defaultProperty)) - { - return defaultProperty; - } - - DefaultPropertyAttribute dpa = GetAttribute(type); - defaultProperty = dpa == null ? null : dpa.Name; - defaultProperty = defaultProperty == null ? null : defaultProperty.Trim(); - _defaultPropertyCache[type] = defaultProperty; - return defaultProperty; - } - - // - // Attempts to look up a custom display name from the DisplayNameAttribute. - // Returns null if the attribute is not defined. - // - // ModelProperty to examine - // Custom DisplayName for the property, if any. - public static string GetDisplayName(ModelProperty property) - { - DisplayNameAttribute displayNameAttribute = GetAttribute(property); - - if (displayNameAttribute == null) - { - return null; - } - - string displayName = displayNameAttribute.DisplayName; - if (string.IsNullOrEmpty(displayName)) - { - return null; - } - - return displayName; - } - - // - // Gets the description associated with the specified ModelProperty - // - // ModelProperty to examine - // The description associated with the specified ModelProperty - public static string GetDescription(ModelProperty property) - { - DescriptionAttribute description = GetAttribute(property); - - if (description == null || string.IsNullOrEmpty(description.Description)) - { - return DescriptionAttribute.Default.Description; - } - - return description.Description; - } - - // - // Instantiates a TypeConverter from a potential TypeConverterAttribute, if one exists. - // - // ModelItem to examine - // Instantiated TypeConverter from a potential TypeConverterAttribute, if one exists, - // null otherwise. - public static TypeConverter GetTypeConverter(ModelItem item) - { - return InstantiateTypeConverter(GetAttribute(item)); - } - - // - // Gets the TypeConverter associated with the specified ModelProperty, returning - // null when no TypeConverter is found. - // - // property to examine - // Associated TypeConverter if one exists, null otherwise. - public static TypeConverter GetTypeConverter(ModelProperty property) - { - return property == null ? null : property.Converter; - } - - // - // Computes the IsReadOnly flag for the specified set of properties, ORing - // results together for sets of properties larger than 1. - // - // Properties to examine - // Delegate that evaluates the IsMixedValue flag for - // the passed in property values (added as an optimization, since we don't always require - // the value and it may be computationally expensive) - // Flag indicating whether the set of properties is read only or not - public static bool IsReadOnly(List properties, IsMixedValueEvaluator isMixedValueEvaluator) - { - if (properties == null || properties.Count == 0) - { - Debug.Fail("ExtensibilityAccessor.IsReadOnly: No properties specified."); - return true; - } - - Type propertyType = properties[0].PropertyType; - - // ILists are readonly only if value is null - if (typeof(IList).IsAssignableFrom(propertyType)) - { - - if (OrReadOnlyValues(properties)) - { - IList list = null; - if (isMixedValueEvaluator != null) - { - list = isMixedValueEvaluator() ? null : (ModelUtilities.GetSafeRawValue(properties[0]) as IList); - } - else - { - Debug.Fail("No delegate to evaluate IsMixedValue specified."); - } - - if (list == null) - { - return true; - } - } - - return false; - } - - // Arrays and ICollections are readonly - if (typeof(Array).IsAssignableFrom(propertyType) || typeof(ICollection).IsAssignableFrom(propertyType)) - { - return true; - } - - // Types that implement ONLY ICollection<> or ONLY IList<> (meaning they - // don't also implement ICollection or IList, which we handle above) - // are also readonly - if (ModelUtilities.ImplementsICollection(propertyType) || ModelUtilities.ImplementsIList(propertyType)) - { - return true; - } - - // Otherwise, go off of the IsReadOnly value in ModelProperty - return OrReadOnlyValues(properties); - } - - - // - // Looks up and returns the BrowsableAttribute on the specified property. - // - // ModelProperty to examine - // True, if the property is marked as browsable, false if it is - // marked as non-browsable, null if it is unmarked. - public static bool? IsBrowsable(ModelProperty property) - { - if (property == null) - { - return false; - } - - // Check if the Browsable(true) attribute is explicitly defined. - BrowsableAttribute browsable = GetAttribute(property); - - // If explicit browsable then honor that. - if (browsable != null) - { - return browsable.Browsable; - } - return null; - } - - // - // Gets the PropertyOrder token associated with the given ModelProperty - // - // ModelProperty to examine - // Associated PropertyOrder token if one exists, null otherwise. - public static PropertyOrder GetPropertyOrder(ModelProperty property) - { - if (property == null) - { - return null; - } - - PropertyOrderAttribute attr = GetAttribute(property); - if (attr == null) - { - return null; - } - - return attr.Order; - } - - // - // Returns the list of NewItemTypesAttributes that are associated with the - // specified ModelProperty. Note that we should never be returning attributes - // from any of the public methods of ExtensibilityAccessor. The only reason - // why we do so here is to pass them to a Blend API that requires it. However, - // this is a design flaw and we should not follow suite elsewhere. - // This method is guaranteed not to return null. - // - // ModelProperty instance to look up - // List of NewItemTypesSttributes associated with the given ModelProperty. - public static List GetNewItemTypesAttributes(ModelProperty property) - { - - List newItemTypesList = new List(); - - foreach (NewItemTypesAttribute newItemTypesAttribute in GetAttributes(property)) - { - - // if there is no custom ItemFactory defined - if (newItemTypesAttribute.FactoryType == typeof(NewItemFactory)) - { - foreach (Type type in newItemTypesAttribute.Types) - { - //Check if the type "IsConcreteWithDefaultCtor" - if (EditorUtilities.IsConcreteWithDefaultCtor(type)) - { - newItemTypesList.Add(new NewItemTypesAttribute(type)); - } - } - } - else - { - newItemTypesList.Add(newItemTypesAttribute); - } - } - return newItemTypesList; - } - - // - // Examines the specified ModelProperty for NewItemTypesAttributes and, if found, returns - // an enumerable of all NewItemFactoryTypeModels specified through them. - // - // ModelProperty instance to look up - // Returns an enumerable of all NewItemFactoryTypeModels specified through custom - // NewItemFactoryTypeModels, if any. - public static IEnumerable GetNewItemFactoryTypeModels(ModelProperty modelProperty, Size desiredIconSize) - { - List attributes = GetNewItemTypesAttributes(modelProperty); - if (attributes == null) - { - yield break; - } - - foreach (NewItemTypesAttribute attribute in attributes) - { - NewItemFactory factory = (NewItemFactory)Activator.CreateInstance(attribute.FactoryType); - - foreach (Type type in attribute.Types) - { - - NewItemFactoryTypeModel model = null; - - if (attribute.FactoryType == typeof(NewItemFactory)) - { - if (EditorUtilities.IsConcreteWithDefaultCtor(type)) - { - model = new NewItemFactoryTypeModel(type, factory, MessageLogger.Instance); - } - } - else - { - model = new NewItemFactoryTypeModel(type, factory, MessageLogger.Instance); - } - - if (model != null) - { - model.DesiredSize = desiredIconSize; - yield return model; - } - } - } - } - - // - // Gets all relevant sub-properties from the given ModelItem - // - // Item to examine - // Sub-properties exposed by the given ModelItem - public static List GetSubProperties(ModelItem item) - { - if (item == null) - { - return null; - } - - // First, see if there is a custom TypeConverter. If so, get the subProperties - // from there. Otherwise, get all subProperties including those that aren't browsable, - // since the Browsability call should be made by the UI, not by the model. - return GetTypeConverterSubProperties(item) ?? GetAllSubProperties(item); - } - - // - // Gets all relevant sub-properties from the value of the specified - // ModelProperty - // - // ModelProperty to examine - // Sub-properties exposed by the value of the specified ModelProperty - public static List GetSubProperties(ModelProperty property) - { - if (property.Value == null || ModelUtilities.GetSafeRawValue(property) == null) - { - return null; - } - - // First, see if there is a custom TypeConverter. If so, get the subProperties - // from there. Otherwise, get all subProperties including those that aren't browsable, - // since the Browsability call should be made by the UI, not by the model. - return GetTypeConverterSubProperties(property) ?? GetAllSubProperties(property); - } - - // - // try / catch wrapper artound Activator.CreateInstance() - // - // Type to instantiate - // Instantiated object or null on error - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - public static object SafeCreateInstance(Type type) - { - try - { - return Activator.CreateInstance(type); - } - catch - { - // ignore errors... - } - - return null; - } - - // - // Returns the property source based on the following heuristic (in line with - // Blend's behavior): - // - // Xaml Source - // ------------------------------------------------------------------- - // "123" Local - // "{Binding}" DataBound - // not specified (default value) Default - // not specified (inherited value) Inherited - // not specified (from style) Inherited - // "{DynamicResource ...}" LocalDynamicResource - // "{StaticResource ...}" LocalStaticResource - // "{x:Static ...}" SystemResource - // "{TemplateBinding ...}" TemplateBinding - // "{CustomMarkup ...}" CustomMarkupExtension - // - // - // Property to examine - // Source of the specified property, if any - public static PropertyValueSource GetPropertySource(ModelProperty property) - { - if (property == null) - { - return null; - } - - ModelItem valueItem = property.Value; - PropertyValueSource source = null; - - // Binding or any other known markup extension? - if (valueItem != null) - { - Type valueType = valueItem.ItemType; - - if (IsStaticExtension(valueType)) - { - source = DependencyPropertyValueSource.SystemResource; - } - else if (typeof(StaticResourceExtension).IsAssignableFrom(valueType)) - { - source = DependencyPropertyValueSource.LocalStaticResource; - } - else if (typeof(DynamicResourceExtension).IsAssignableFrom(valueType)) - { - source = DependencyPropertyValueSource.LocalDynamicResource; - } - else if (typeof(TemplateBindingExtension).IsAssignableFrom(valueType)) - { - source = DependencyPropertyValueSource.TemplateBinding; - } - else if (typeof(Binding).IsAssignableFrom(valueType)) - { - source = DependencyPropertyValueSource.DataBound; - } - else if (typeof(MarkupExtension).IsAssignableFrom(valueType)) - { - source = DependencyPropertyValueSource.CustomMarkupExtension; - } - } - - // If not, is this a local, inherited, or default value? - if (source == null) - { - - if (property.IsSet) - { - source = DependencyPropertyValueSource.Local; - } - else - { - - object value = property.ComputedValue; - - if (object.Equals(value, property.DefaultValue)) - { - source = DependencyPropertyValueSource.DefaultValue; - } - else if (valueItem != null && valueItem.Source != property) - { - source = DependencyPropertyValueSource.Inherited; - } - } - } - - return source; - } - - // Helper method that ORs the ModelProperty.IsReadOnly values together and - // returns the result - private static bool OrReadOnlyValues(List properties) - { - if (properties == null) - { - return true; - } - - for (int i = 0; i < properties.Count; i++) - { - if (properties[i].IsReadOnly) - { - return true; - } - } - - return false; - } - - // Helper method to find if the propertyvalueeditor is reusable for the - // given properties collection. - public static bool IsEditorReusable(IEnumerable properties) - { - if (properties == null) - { - return true; - } - - foreach (ModelProperty property in properties) - { - // even if one property says the editor is not reusable, then - // the editor is not reusable for this whole list. - if (!ExtensibilityMetadataHelper.IsEditorReusable(property.Attributes)) - { - return false; - } - } - return true; - } - - // Hack to deal with {x:Static ...} extensions. The Cider Markup code currently - // replaces all StaticExtensions with internal versions of the same class. - // Once bug 100647 is fixed this code can go away. - private static bool IsStaticExtension(Type type) - { - return type != null && ( - typeof(StaticExtension).IsAssignableFrom(type) || - string.Equals("System.Activities.Presentation.Internal.Xaml.Builtins.StaticExtension", type.FullName)); - } - - // Gets all subProperties from the TypeConverter, if one is explicitely specified - private static List GetTypeConverterSubProperties(ModelItem item) - { - return GetTypeConverterSubPropertiesHelper(item, null); - } - - // Gets all subProperties from the TypeConverter, if one is explicitely specified - private static List GetTypeConverterSubProperties(ModelProperty property) - { - TypeConverter propertySpecificConverter = property.Converter; - return GetTypeConverterSubPropertiesHelper(property.Value, propertySpecificConverter); - } - - private static List GetTypeConverterSubPropertiesHelper(ModelItem item, TypeConverter customConverter) - { - - if (item == null) - { - return null; - } - - List subProperties = null; - - TypeConverter converter = customConverter; - - if (converter == null) - { - // See if there is a converter associated with the item type itself - converter = ExtensibilityAccessor.GetTypeConverter(item); - } - - if (converter != null) - { - PropertyDescriptorCollection subPropertyDescriptors = - converter.GetProperties(item.GetCurrentValue()); - - if (subPropertyDescriptors != null && subPropertyDescriptors.Count > 0) - { - - foreach (PropertyDescriptor subPropertyDescriptor in subPropertyDescriptors) - { - - ModelProperty subProperty = item.Properties[subPropertyDescriptor.Name]; - - // We want to expose all properties through the model regardless of whether they - // are browsable or not. That distinction should be made by the UI utilizing it - if (subProperty != null) - { - - if (subProperties == null) - { - subProperties = new List(); - } - - subProperties.Add(subProperty); - } - } - } - } - return subProperties; - } - - // Gets all subProperties that exist - private static List GetAllSubProperties(ModelItem item) - { - - if (item == null) - { - return null; - } - - ModelPropertyCollection subModelProperties = item.Properties; - if (subModelProperties == null) - { - return null; - } - - List subProperties = null; - - // We want to expose all properties through the model regardless of whether they - // are browsable or not. That distinction should be made by the UI utilizing it - foreach (ModelProperty subModelProperty in subModelProperties) - { - - if (subProperties == null) - { - subProperties = new List(); - } - - subProperties.Add(subModelProperty); - } - - return subProperties; - } - - // Gets all subProperties that exist - private static List GetAllSubProperties(ModelProperty property) - { - return GetAllSubProperties(property.Value); - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Propagating the error might cause VS to crash")] - [SuppressMessage("Reliability", "Reliability108", Justification = "Propagating the error might cause VS to crash")] - private static TypeConverter InstantiateTypeConverter(TypeConverterAttribute typeConverterAttribute) - { - if (typeConverterAttribute == null) - { - return null; - } - - try - { - Type typeConverterType = Type.GetType(typeConverterAttribute.ConverterTypeName); - if (typeConverterType != null) - { - return (TypeConverter)Activator.CreateInstance(typeConverterType); - } - } - catch (Exception) - { - // Ignore failures. In the future, log these somewhere for 3rd parties to see and debug. - } - - return null; - } - - // GetAttributes() and GetAttribute() - - public static T GetAttribute(ModelProperty property) where T : Attribute - { - return GetAttribute(property == null ? null : property.Attributes); - } - - public static T GetAttribute(ModelItem item) where T : Attribute - { - return GetAttribute(item == null ? null : item.Attributes); - } - - public static T GetAttribute(Type type) where T : Attribute - { - return GetAttribute(type == null ? null : TypeDescriptor.GetAttributes(type)); - } - - public static IEnumerable GetAttributes(ModelProperty property) where T : Attribute - { - return GetAttributes(property == null ? null : property.Attributes); - } - - public static IEnumerable GetAttributes(Type type) where T : Attribute - { - return GetAttributes(type == null ? null : TypeDescriptor.GetAttributes(type)); - } - - // Note: Calling AttributeCollection[typeof(MyAttribute)] creates a default attribute if - // the specified attribute is not found. That's generally not what we want. - public static T GetAttribute(AttributeCollection attributes) where T : Attribute - { - T foundAttribute = null; - if (attributes != null) - { - foreach (Attribute attribute in attributes) - { - if (typeof(T).IsAssignableFrom(attribute.GetType())) - { - foundAttribute = attribute as T; - } - } - } - - return foundAttribute; - } - - // Note: Calling AttributeCollection[typeof(MyAttribute)] creates a default attribute if - // the specified attribute is not found. That's generally not what we want. - private static IEnumerable GetAttributes(AttributeCollection attributes) where T : Attribute - { - if (attributes != null) - { - foreach (Attribute attribute in attributes) - { - if (typeof(T).IsAssignableFrom(attribute.GetType())) - { - yield return (T)attribute; - } - } - } - } - - // - // Delegate intended to wrap logic that evaluates the IsMixedValue flag of - // some property or set of properties. - // - // True if values are mixed, false otherwise - public delegate bool IsMixedValueEvaluator(); - - // - private class MessageLogger : IMessageLogger - { - - private static MessageLogger _instance = new MessageLogger(); - - public static MessageLogger Instance - { get { return _instance; } } - - public void Clear() - { - } - - public void Write(string text) - { - Debug.Write(text); - } - - public void WriteLine(string text) - { - Debug.WriteLine(text); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Diagnostics/AutomationId.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Diagnostics/AutomationId.cs deleted file mode 100644 index e19604f1e60..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Diagnostics/AutomationId.cs +++ /dev/null @@ -1,45 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- - -//Cider comment -// This is used by PropertInspector\CategoryContainer.xaml -// For example automation:AutomationElement.Id="CategoryCheckBox" -// I'm not sure that this is actually necessary -// But by including this we minimize the changes to CategoryContainer.xaml - -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Diagnostics -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Diagnostics.Automation -{ - using System; - using System.Windows; - using System.Activities.Presentation; - - // - // This DP is intended to be used in XAML property binding scenarios since FrameworkElement.Name is no longer available. - // - internal static class AutomationElement - { - public static readonly DependencyProperty IdProperty = DependencyProperty.RegisterAttached("Id", typeof(string), typeof(AutomationElement)); - - public static string GetId(DependencyObject o) - { - if (o == null) - { - throw FxTrace.Exception.ArgumentNull("o"); - } - - return (string)o.GetValue(AutomationElement.IdProperty); - } - - public static void SetId(DependencyObject o, string val) - { - if (o == null) - { - throw FxTrace.Exception.ArgumentNull("o"); - } - - o.SetValue(AutomationElement.IdProperty, val); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Controls/WorkaroundPopup.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Controls/WorkaroundPopup.cs deleted file mode 100644 index 0b4cf1b4b8d..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Controls/WorkaroundPopup.cs +++ /dev/null @@ -1,142 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Controls -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Controls -{ - using System; - using System.Windows; - using System.Windows.Input; - using System.Windows.Controls.Primitives; - using System.Windows.Media; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.UserInterface; - - // - // This class contains specific behavior for the Popup associated with PropertyContainer. - // Basically, it is a workaround for Windows OS bug #1745919. The "StaysOpen = false" setting - // on a Popup does not function as we expect when the Popup is created within another - // "StaysOpen = false" popup (or if anything has capture). What happens is the Popup first - // checks if anything has capture, and only takes capture if nothing else has taken it. But the - // StaysOpen behavior is implemented using the capture, so we lose that. Also, related to that - // the Closed event will not be called, so to workaround both of those issues we essentially - // re-implement the popup capture grabbing code, except we take capture no matter what. - // - internal class WorkaroundPopup : Popup - { - private bool releasingCapture = false; - - protected override void OnOpened(EventArgs e) - { - this.releasingCapture = false; - - if (this.Child != null) - { - this.Child.Focusable = true; - this.Child.Focus(); - Mouse.Capture(this.Child, CaptureMode.SubTree); - } - this.SetValue(FocusScopeManager.FocusScopePriorityProperty, 1); - base.OnOpened(e); - } - - protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e) - { - base.OnGotKeyboardFocus(e); - } - - protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e) - { - base.OnLostKeyboardFocus(e); - } - - protected override void OnGotFocus(RoutedEventArgs e) - { - base.OnGotFocus(e); - } - - protected override void OnLostFocus(RoutedEventArgs e) - { - base.OnLostFocus(e); - } - - protected override void OnLostMouseCapture(System.Windows.Input.MouseEventArgs e) - { - object sender = this; - // This code is a stripped down implementation of Popup.OnMouseLostCapture - if (!this.releasingCapture && Mouse.Captured != this.Child) - { - if (e.OriginalSource == this.Child) - { - if (Mouse.Captured == null) - { - this.IsOpen = false; - } - } - else if (this.IsDescendentOfPopup(sender as DependencyObject)) - { - if (this.IsOpen && Mouse.Captured == null) - { - Mouse.Capture(this.Child, CaptureMode.SubTree); - } - } - else - { - this.IsOpen = false; - } - } - base.OnLostMouseCapture(e); - } - - protected override void OnPreviewMouseDown(MouseButtonEventArgs e) - { - // Check if the mouse down occured within the popup, if it did, leave the popup open. If it didn't, then close - // the popup and release capture. - if (e.OriginalSource == this.Child && this.Child.InputHitTest(e.GetPosition(this.Child)) == null) - { - this.IsOpen = false; - this.ReleaseChildMouseCapture(); - } - base.OnMouseDown(e); - } - - private bool IsDescendentOfPopup(DependencyObject currentObject) - { - while (currentObject != null) - { - if (currentObject == this || currentObject == this.Child) - { - return true; - } - currentObject = VisualTreeHelper.GetParent(currentObject); - } - - return false; - } - - private void ReleaseChildMouseCapture() - { - if (Mouse.Captured == this.Child) - { - this.releasingCapture = true; - Mouse.Capture(null); - this.releasingCapture = false; - } - } - - protected override void OnKeyDown(KeyEventArgs e) - { - if (e.Key == Key.Escape) - { - this.IsOpen = false; - this.ReleaseChildMouseCapture(); - } - base.OnKeyDown(e); - } - - protected override void OnClosed(EventArgs e) - { - this.ReleaseChildMouseCapture(); - base.OnClosed(e); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/AppendSuffixConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/AppendSuffixConverter.cs deleted file mode 100644 index fee4863c2f3..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/AppendSuffixConverter.cs +++ /dev/null @@ -1,55 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.ComponentModel; - using System.Diagnostics; - using System.Globalization; - using System.Reflection; - using System.Windows; - using System.Windows.Data; - using System.Diagnostics.CodeAnalysis; - using System.Runtime; - - // - // (object-to-string) Takes an object and returns a new string that is the object's ToString() - // with the value of the suffix property appended to it. - // - - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class AppendSuffixConverter : IValueConverter - { - // Private Fields - private string suffix; - - // Public Properties - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public string Suffix - { - get - { - return this.suffix; - } - set - { - this.suffix = value; - } - } - - // IValueConverter Implementation - public object ConvertBack(object o, Type targetType, object value, CultureInfo culture) - { - Fx.Assert(false, "AppendSuffixConverter do not support inverse transform."); - return null; - } - - public object Convert(object o, Type targetType, object parameter, CultureInfo culture) - { - return o.ToString() + this.Suffix; - } - } - -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/BoolToDoubleConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/BoolToDoubleConverter.cs deleted file mode 100644 index e5d013364d6..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/BoolToDoubleConverter.cs +++ /dev/null @@ -1,81 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.ComponentModel; - using System.Globalization; - using System.Reflection; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - using System.Diagnostics.CodeAnalysis; - using System.Runtime; - - // - // Maps a bool to a FontWeight. True becomes Bold, and False is Normal. - // - - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class BoolToDoubleConverter : IValueConverter - { - // Private Fields - - private double trueValue = 0; - private double falseValue = 0; - - // Public Properties - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public double TrueValue - { - get - { - return this.trueValue; - } - set - { - this.trueValue = value; - } - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public double FalseValue - { - get - { - return this.falseValue; - } - set - { - this.falseValue = value; - } - } - - - // IValueConverter Implementation - - public object ConvertBack(object o, Type targetType, object parameter, CultureInfo culture) - { - Fx.Assert(false, "Never expecting the inverse transform to be called"); - return null; - } - - public object Convert(object o, Type targetType, object parameter, CultureInfo culture) - { - Fx.Assert(o is bool, "Ensure that transformed element is a boolean"); - - if ((bool)o) - { - return this.trueValue; - } - else - { - return this.falseValue; - } - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/BoolToVisibilityCollpasedConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/BoolToVisibilityCollpasedConverter.cs deleted file mode 100644 index 220d5cf229f..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/BoolToVisibilityCollpasedConverter.cs +++ /dev/null @@ -1,61 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.ComponentModel; - using System.Globalization; - using System.Reflection; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - using System.Diagnostics.CodeAnalysis; - - // - // (bool-to-Visibility) Maps true to Visible and false to Collapsed. - // - - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class BoolToVisibilityCollapsedConverter : IValueConverter - { - bool invertBoolean = false; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public bool InvertBoolean - { - get { return this.invertBoolean; } - set { this.invertBoolean = value; } - } - - // IValueConverter Implementation - public object ConvertBack(object o, Type targetType, object parameter, CultureInfo culture) - { - Visibility visibility = (Visibility)o; - return ((visibility == Visibility.Visible) ^ this.invertBoolean); - } - - public object Convert(object o, Type targetType, object parameter, CultureInfo culture) - { - Visibility result = Visibility.Collapsed; - - if (o is Nullable) - { - if ((((Nullable)o).Value) ^ this.invertBoolean) - { - result = Visibility.Visible; - } - } - else if (o is bool) - { - if (((bool)o) ^ this.invertBoolean) - { - result = Visibility.Visible; - } - } - return result; - } - } - -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/BoolToVisibilityHiddenConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/BoolToVisibilityHiddenConverter.cs deleted file mode 100644 index 7848c21ef8c..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/BoolToVisibilityHiddenConverter.cs +++ /dev/null @@ -1,56 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.ComponentModel; - using System.Globalization; - using System.Reflection; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - using System.Diagnostics.CodeAnalysis; - - // - // (bool-to-Visibility) Maps true to Visible and false to Hidden. - // - - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class BoolToVisibilityHiddenConverter : IValueConverter - { - bool invertBoolean = false; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - - public bool InvertBoolean - { - get { return this.invertBoolean; } - set { this.invertBoolean = value; } - } - - // IValueConverter Implementation - public object ConvertBack(object o, Type targetType, object parameter, CultureInfo culture) - { - Visibility visibility = (Visibility)o; - bool result = visibility == Visibility.Visible; - if (this.invertBoolean) - { - result = !result; - } - return result; - } - - public object Convert(object o, Type targetType, object parameter, CultureInfo culture) - { - bool show = (bool)o; - if (this.invertBoolean) - { - show = !show; - } - return show ? Visibility.Visible : Visibility.Hidden; - } - } - -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/ComposingConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/ComposingConverter.cs deleted file mode 100644 index 955777e359b..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/ComposingConverter.cs +++ /dev/null @@ -1,45 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Globalization; - using System.Windows; - using System.Windows.Data; - using System.Diagnostics.CodeAnalysis; - - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal sealed class ComposingConverter : IValueConverter - { - private List converters = new List(); - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - - public List Converters - { - get { return this.converters; } - } - - // IValueConverter Members - public object Convert(object o, Type targetType, object parameter, CultureInfo culture) - { - for (int i = 0; i < this.converters.Count; i++) - { - o = converters[i].Convert(o, targetType, parameter, culture); - } - return o; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - for (int i = this.converters.Count - 1; i >= 0; i--) - { - value = converters[i].ConvertBack(value, targetType, parameter, culture); - } - return value; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/DelegateCommand.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/DelegateCommand.cs deleted file mode 100644 index fe533967c6d..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/DelegateCommand.cs +++ /dev/null @@ -1,49 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.Windows.Input; - using System.Diagnostics.CodeAnalysis; - using System.Runtime; - - internal sealed class DelegateCommand : ICommand - { - private SimpleEventHandler handler; - private bool isEnabled = true; - - public DelegateCommand(SimpleEventHandler handler) - { - this.handler = handler; - } - - - public event EventHandler CanExecuteChanged; - - public bool IsEnabled - { - get { return this.isEnabled; } - } - void ICommand.Execute(object arg) - { - this.handler(); - } - - bool ICommand.CanExecute(object arg) - { - return this.IsEnabled; - } - - [SuppressMessage(FxCop.Category.Performance, FxCop.Rule.AvoidUncalledPrivateCode, Justification = "This is required by the ICommand interface.")] - private void OnCanExecuteChanged() - { - if (this.CanExecuteChanged != null) - { - this.CanExecuteChanged(this, EventArgs.Empty); - } - } - public delegate void SimpleEventHandler(); - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/EqualsConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/EqualsConverter.cs deleted file mode 100644 index 281544ee2d6..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/EqualsConverter.cs +++ /dev/null @@ -1,35 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.Globalization; - using System.Windows; - using System.Windows.Data; - using System.Activities.Presentation; - - internal class EqualsConverter : DependencyObject, IValueConverter - { - private object defaultValue = false, matchValue = true; - - // IValueConverter Members - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (Object.Equals(value, parameter)) - { - return this.matchValue; - } - else - { - return this.defaultValue; - } - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw FxTrace.Exception.AsError(new InvalidOperationException()); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/IntegerToVisibilityConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/IntegerToVisibilityConverter.cs deleted file mode 100644 index 2ad610420b5..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/IntegerToVisibilityConverter.cs +++ /dev/null @@ -1,62 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.Collections; - using System.ComponentModel; - using System.Globalization; - using System.Reflection; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - using System.Diagnostics.CodeAnalysis; - using System.Runtime; - - // - // Maps an Integer to Visilbity. 0 becomes Hidden, non-zero becomes Visible. - // - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class IntegerToVisibilityConverter : IValueConverter - { - private Visibility zeroValue = Visibility.Collapsed; - - private Visibility nonzeroValue = Visibility.Visible; - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public Visibility ZeroValue - { - get { return this.zeroValue; } - set { this.zeroValue = value; } - } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public Visibility NonzeroValue - { - get { return this.nonzeroValue; } - set { this.nonzeroValue = value; } - } - - // IValueConverter Implementation - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - Fx.Assert(false, "Never expecting the inverse transform to be called"); - return null; - } - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - Fx.Assert(value is int, "Ensure that transformed value is an integer"); - - if ((value is int) && (int)value == 0) - { - return this.zeroValue; - } - else - { - return this.nonzeroValue; - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/IsNullConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/IsNullConverter.cs deleted file mode 100644 index d51ed1db6ca..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/IsNullConverter.cs +++ /dev/null @@ -1,32 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.ComponentModel; - using System.Diagnostics; - using System.Globalization; - using System.Windows.Data; - using System.Diagnostics.CodeAnalysis; - - // - // (nullable-to-bool) Returns true if the value is null, false otherwise. - // - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class IsNullConverter : IValueConverter - { - // IValueConverter Members - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return value == null; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - Debug.Fail("IsNullConverter can only be used for BindType=OneWay"); - return null; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/NotConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/NotConverter.cs deleted file mode 100644 index d43bc4913ff..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/NotConverter.cs +++ /dev/null @@ -1,34 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.ComponentModel; - using System.Windows; - using System.Windows.Data; - using System.Globalization; - using System.Reflection; - using System.Diagnostics.CodeAnalysis; - - // - // Transform bool value using logical not. - // - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal sealed class NotConverter : IValueConverter - { - // IValueConverter Members - - public object Convert(object o, Type targetType, object parameter, CultureInfo culture) - { - return !(bool)o; - } - - public object ConvertBack(object o, Type targetType, object parameter, CultureInfo culture) - { - return !ValueConverterUtilities.AssureBool(o, false); - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/NullToBoolConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/NullToBoolConverter.cs deleted file mode 100644 index 0f169888399..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/NullToBoolConverter.cs +++ /dev/null @@ -1,39 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.Collections; - using System.ComponentModel; - using System.Diagnostics; - using System.Globalization; - using System.Reflection; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - using System.Diagnostics.CodeAnalysis; - using System.Runtime; - - // - // Converts non-null to true, and null to false. - // - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class NullToBoolConverter : IValueConverter - { - // IValueConverter Implementation - - public object ConvertBack(object o, Type targetType, object parameter, CultureInfo culture) - { - Fx.Assert(false, "NullToBoolConverter can only be used for forward conversion."); - return null; - } - - public object Convert(object o, Type targetType, object parameter, CultureInfo culture) - { - return o != null; - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/ObservableCollection.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/ObservableCollection.cs deleted file mode 100644 index d7a72f66ebd..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/ObservableCollection.cs +++ /dev/null @@ -1,70 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Collections.Specialized; - using System.ComponentModel; - using System.Windows; - - // - // Workaround for ObservableCollection not supporting IComparers. The implementation was copied from ObservableCollection. - // - // - internal sealed class ObservableCollectionWorkaround : ObservableCollection - { - public ObservableCollectionWorkaround() - { - } - - public ObservableCollectionWorkaround(List list) - : base(list) - { - } - - public ObservableCollectionWorkaround(ICollection collection) - { - foreach (T item in collection) - { - this.Add(item); - } - } - - public int BinarySearch(T value, IComparer comparer) - { - return ((List)base.Items).BinarySearch(value, comparer); - } - - public void Sort() - { - ((List)base.Items).Sort(); - this.OnPropertyChanged(new PropertyChangedEventArgs("Item[]")); - this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, null, -1)); - } - - public void Sort(IComparer comparer) - { - ((List)base.Items).Sort(comparer); - this.OnPropertyChanged(new PropertyChangedEventArgs("Item[]")); - this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, null, -1)); - } - - public void Sort(Comparison comparison) - { - ((List)base.Items).Sort(comparison); - this.OnPropertyChanged(new PropertyChangedEventArgs("Item[]")); - this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, null, -1)); - } - - public void Reverse() - { - ((List)base.Items).Reverse(); - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/SwitchConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/SwitchConverter.cs deleted file mode 100644 index 06366ff7236..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/SwitchConverter.cs +++ /dev/null @@ -1,107 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.Globalization; - using System.Reflection; - using System.Windows; - using System.Windows.Data; - using System.Windows.Markup; - using System.Windows.Media; - using System.Activities.Presentation; - - // - // Transformer which maps from input values to output values, based on a list of SwitchCase children. - // This isn't strictly a C-style 'switch' statement, since cases aren't guaranteed to be unique. - // - // - [ContentProperty("Cases")] - internal class SwitchConverter : DependencyObject, IValueConverter - { - static readonly DependencyProperty DefaultValueProperty = DependencyProperty.Register("DefaultValue", typeof(object), typeof(SwitchConverter)); - private List cases; - - public SwitchConverter() - { - this.cases = new List(); - } - - public List Cases - { - get { return this.cases; } - } - - public object DefaultValue - { - get { return this.GetValue(SwitchConverter.DefaultValueProperty); } - set { this.SetValue(SwitchConverter.DefaultValueProperty, value); } - } - - // IValueConverter implementation - public object Convert(object o, Type targetType, object parameter, CultureInfo culture) - { - foreach (SwitchCase switchCase in this.Cases) - { - if (object.Equals(switchCase.In, o)) - { - return switchCase.Out; - } - } - - return this.DefaultValue; - } - - public object ConvertBack(object o, Type targetType, object parameter, CultureInfo culture) - { - throw FxTrace.Exception.AsError(new InvalidOperationException(ExceptionStringTable.SwitchConverterIsOneWay)); - } - - } - - // - // Represents a mapping from an input value to an output value. - // - internal class SwitchCase : DependencyObject - { - static readonly DependencyProperty InProperty = DependencyProperty.Register("In", typeof(object), typeof(SwitchCase)); - static readonly DependencyProperty OutProperty = DependencyProperty.Register("Out", typeof(object), typeof(SwitchCase)); - - public SwitchCase() - { - } - - // Properties - public object In - { - get { return (object)this.GetValue(InProperty); } - set { this.SetValue(InProperty, value); } - } - - public object Out - { - get { return this.GetValue(OutProperty); } - set { this.SetValue(OutProperty, value); } - } - } - - // - // Convenience class for getting at a particular type. Useful for databinding. - // Used in XAML as: - // - internal sealed class TypeReference : DependencyObject - { - static readonly DependencyProperty TypeProperty = DependencyProperty.Register("Type", typeof(Type), typeof(TypeReference)); - - public Type Type - { - get { return (Type)this.GetValue(TypeProperty); } - set { this.SetValue(TypeProperty, value); } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/ValueConverters.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/ValueConverters.cs deleted file mode 100644 index af4aa547ea3..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/ValueConverters.cs +++ /dev/null @@ -1,100 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- - -//Cider comment: -// - This file had many more converters but we are not using them at present -// - And so I removed them. These are the classes I removed -// OrientationToCheckStateConverter -// DoubleToStringConverter -// IntToStringConverter -// IntToBoolConverter -// BoolToCheckStateConverter -// BoolToStringConverter -// UIElementToStringConverter -// NullToEmptyStringConverter -// InverseVisibilityConverter -// GridLengthConverter -// CollapseIfOneConverter -// StringFormatConverter - -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.Diagnostics; - using System.Globalization; - using System.Collections.Generic; - using System.ComponentModel; - using System.Reflection; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - using System.Windows.Media; - using System.Diagnostics.CodeAnalysis; - using System.Runtime; - - internal static class ValueConverterUtilities - { - // handles the case of nullable bools - public static bool AssureBool(object value, bool defaultIfNull) - { - if (value is bool?) - { - bool? nbValue = (bool?)value; - - if (nbValue.HasValue) - { - return nbValue.Value; - } - else - { - return defaultIfNull; - } - } - - return (bool)value; - } - } - - - // - // Transforms bool (or MixedProperty.Mixed) to a Visibility. - // true -> CheckState.Checked - // false -> CheckState.Unchecked - // MixedProperty.Mixed -> CheckState.Intermediate - // - - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal sealed class BoolToVisibilityConverter : IValueConverter - { - // IValueConverter implementation - // - // Transform a CheckState into a bool. - // - public object ConvertBack(object o, Type targetType, object parameter, CultureInfo culture) - { - Fx.Assert(o.GetType() == typeof(Visibility), "Object to inverse-transform isn't a CheckState."); - Visibility value = (Visibility)o; - return value == Visibility.Visible ? true : false; - } - - // - // Transform a boolean value (or mixed state) into a CheckState. - // - public object Convert(object o, Type targetType, object parameter, CultureInfo culture) - { - if (o == MixedProperty.Mixed) - { - return Visibility.Visible; - } - else - { - Fx.Assert(o.GetType() == typeof(bool), "Object to transform isn't a bool or mixed state."); - bool value = (bool)o; - return (object)(value ? Visibility.Visible : Visibility.Collapsed); - } - } - } - -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/VisibilityOrConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/VisibilityOrConverter.cs deleted file mode 100644 index 9bd6d0774f0..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Data/VisibilityOrConverter.cs +++ /dev/null @@ -1,40 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- - -//Cider comment: -// - This file also had a VisibilityOrConverter but we are not using it so I removed it - -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data -{ - using System; - using System.Windows.Data; - using System.Windows; - using System.Globalization; - using System.Diagnostics.CodeAnalysis; - using System.Activities.Presentation; - - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class VisibilityAndConverter : IMultiValueConverter - { - // IMultiValueConverter Members - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) - { - foreach (object value in values) - { - if (!(value is Visibility) || ((Visibility)value) != Visibility.Visible) - { - return Visibility.Collapsed; - } - } - - return Visibility.Visible; - } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) - { - throw FxTrace.Exception.AsError(new NotImplementedException(ExceptionStringTable.MethodOrOperationIsNotImplemented)); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ExceptionStringTable.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ExceptionStringTable.cs deleted file mode 100644 index 1bf6a0bfb41..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ExceptionStringTable.cs +++ /dev/null @@ -1,44 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- - -//Cider comment: -// - Integration of Expression error messages. The actual resource strings are in Resources.resx -// - Rather than alter the classes we ported from Blend I created this file to redirect to Resources.resx - - -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\ExceptionStringTable.resx -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework -{ - internal class ExceptionStringTable - { - //FXCop compliance - private ExceptionStringTable() - { - } - - internal static string CanOnlySetFocusScopePriorityOnAnElementThatIsAFocusScope - { get { return System.Activities.Presentation.Internal.Properties.Resources.FromExpression_CanOnlySetFocusScopePriorityOnAnElementThatIsAFocusScope; } } - internal static string CategoryIconLoadFailed - { get { return System.Activities.Presentation.Internal.Properties.Resources.FromExpression_CategoryIconLoadFailed; } } - internal static string CategoryEditorTypeLoadFailed - { get { return System.Activities.Presentation.Internal.Properties.Resources.FromExpression_CategoryEditorTypeLoadFailed; } } - internal static string MethodOrOperationIsNotImplemented - { get { return System.Activities.Presentation.Internal.Properties.Resources.FromExpression_MethodOrOperationIsNotImplemented; } } - internal static string NewItemFactoryIconLoadFailed - { get { return System.Activities.Presentation.Internal.Properties.Resources.FromExpression_NewItemFactoryIconLoadFailed; } } - internal static string NoConvertBackForValueToIconConverter - { get { return System.Activities.Presentation.Internal.Properties.Resources.FromExpression_NoConvertBackForValueToIconConverter; } } - internal static string SwitchConverterIsOneWay - { get { return System.Activities.Presentation.Internal.Properties.Resources.FromExpression_SwitchConverterIsOneWay; } } - internal static string UnexpectedImageSourceType - { get { return System.Activities.Presentation.Internal.Properties.Resources.FromExpression_UnexpectedImageSourceType; } } - internal static string UnexpectedDrawingType - { get { return System.Activities.Presentation.Internal.Properties.Resources.FromExpression_UnexpectedDrawingType; } } - internal static string UnexpectedBrushType - { get { return System.Activities.Presentation.Internal.Properties.Resources.FromExpression_UnexpectedBrushType; } } - internal static string ValueEditorLoadFailed - { get { return System.Activities.Presentation.Internal.Properties.Resources.FromExpression_ValueEditorLoadFailed; } } - } -} - diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/IMessageLogger.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/IMessageLogger.cs deleted file mode 100644 index 1a5b5385fc9..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/IMessageLogger.cs +++ /dev/null @@ -1,17 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework -{ - // - // Central location to handle error, warning and informational messages - // - internal interface IMessageLogger - { - void Clear(); - void Write(string text); - void WriteLine(string text); - } -} - diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/MixedProperty.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/MixedProperty.cs deleted file mode 100644 index 0247ecccddf..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/MixedProperty.cs +++ /dev/null @@ -1,19 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework -{ - // - // A singleton used to indicate that several objects have different values for a property. - // - internal sealed class MixedProperty - { - // Used to indicate that a retrieved property value is mixed (akin to UnsetValue.Instance). - public static readonly object Mixed = new MixedProperty(); - - private MixedProperty() - { - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryBase.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryBase.cs deleted file mode 100644 index acaff49cf6a..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryBase.cs +++ /dev/null @@ -1,317 +0,0 @@ - -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Properties -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector -{ - using System.Runtime; - using System.ComponentModel; - using System.Diagnostics; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System; - using System.Activities.Presentation.PropertyEditing; - using System.Collections; - using System.Windows.Media; - using System.Windows; - using System.Globalization; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data; - using System.Diagnostics.CodeAnalysis; - - [SuppressMessage(FxCop.Category.Naming, "CA1724:TypeNamesShouldNotMatchNamespaces", - Justification = "Code imported from Cider; keeping changes to a minimum as it impacts xaml files as well")] - internal abstract class CategoryBase : CategoryEntry, IEnumerable - { - - private static AlphabeticalCategoryEditorComparer alphabeticalCategoryEditorComparer = new AlphabeticalCategoryEditorComparer(); - - private bool basicPropertyMatchesFilter = true; - private bool advancedPropertyMatchesFilter = true; - private ObservableCollectionWorkaround categoryEditors = new ObservableCollectionWorkaround(); - - // Track the category editor that is currently providing the icon: - private CategoryEditor iconProvider = null; - private ImageSource categoryIcon = null; - - [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] - protected CategoryBase(string name) - : base(name) - { - this.categoryEditors.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(categoryEditors_CollectionChanged); - this.InitializeIcons(); - } - - public override IEnumerable Properties - { - get - { - return this; - } - } - - public abstract ObservableCollection BasicProperties - { get; } - public abstract ObservableCollection AdvancedProperties - { get; } - - public bool BasicPropertyMatchesFilter - { - get { return this.basicPropertyMatchesFilter; } - set - { - if (this.basicPropertyMatchesFilter != value) - { - this.basicPropertyMatchesFilter = value; - this.OnPropertyChanged("BasicPropertyMatchesFilter"); - } - } - } - - public bool AdvancedPropertyMatchesFilter - { - get { return this.advancedPropertyMatchesFilter; } - set - { - if (this.advancedPropertyMatchesFilter != value) - { - this.advancedPropertyMatchesFilter = value; - this.OnPropertyChanged("AdvancedPropertyMatchesFilter"); - } - } - } - - public virtual IComparable SortOrdering - { - get { return this.CategoryName; } - } - - public ObservableCollection CategoryEditors - { - get { return categoryEditors; } - } - - public ImageSource CategoryIcon - { - get { return this.categoryIcon; } - protected set { this.categoryIcon = value; this.OnPropertyChanged("CategoryIcon"); } - } - - // IPropertyFilterTarget Members - - public override PropertyEntry this[string propertyName] - { - get - { - foreach (PropertyEntry property in this.Properties) - { - if (property.PropertyName == propertyName) - { - return property; - } - } - return null; - } - } - - private void categoryEditors_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) - { - this.InitializeIcons(); - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Propagating the error might cause VS to crash")] - [SuppressMessage("Reliability", "Reliability108", Justification = "Propagating the error might cause VS to crash")] - private void InitializeIcons() - { - if (this.iconProvider == null || !this.categoryEditors.Contains(this.iconProvider)) - { - foreach (CategoryEditor editor in this.categoryEditors) - { - ImageSource icon = null; - - // CategoryEditor.GetImage is user code and could throw: - try - { - // 24,24 is the desired default size for category icons; it may or may not be respected - // by the implementation of GetImage - icon = editor.GetImage(new Size(24, 24)) as ImageSource; - } - catch (Exception exception) - { - this.ReportCategoryException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.CategoryIconLoadFailed, this.CategoryName, exception.Message)); - continue; - } - - if (icon != null) - { - if (icon is ISupportInitialize) - { - // Attempt to access some property on the image to ensure it has been initialized properly. Display the error now, instead of later in the artboard. - try - { - double dummyHeight = icon.Height; - } - catch (InvalidOperationException exception) - { - this.ReportCategoryException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.CategoryIconLoadFailed, this.CategoryName, exception.Message)); - continue; - } - } - this.CategoryIcon = icon; - this.iconProvider = editor; - return; - } - } - this.CategoryIcon = null; - this.iconProvider = null; - } - } - - public virtual void ReportCategoryException(string message) - { - } - - IEnumerator IEnumerable.GetEnumerator() - { - return new PropertyEnumerator(this); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return new PropertyEnumerator(this); - } - - public void AddCategoryEditor(CategoryEditor categoryEditor) - { - int insertionIndex = this.categoryEditors.BinarySearch(categoryEditor, CategoryBase.alphabeticalCategoryEditorComparer); - if (insertionIndex < 0) - { - insertionIndex = ~insertionIndex; - } - this.categoryEditors.Insert(insertionIndex, categoryEditor); - } - - public void RemoveCategoryEditor(Type categoryEditor) - { - for (int i = 0; i < this.CategoryEditors.Count; i++) - { - if (this.CategoryEditors[i].GetType() == categoryEditor) - { - this.CategoryEditors.RemoveAt(i); - return; - } - } - } - - public override void ApplyFilter(PropertyFilter filter) - { - this.MatchesFilter = filter.Match(this); - - // Now Match all the properties in this category - bool newBasicPropertyMatchesFilter = false; - bool newAdvancedPropertyMatchesFilter = false; - - foreach (PropertyEntry property in this.BasicProperties) - { - if (this.DoesPropertyMatchFilter(filter, property)) - { - newBasicPropertyMatchesFilter = true; - } - } - - foreach (PropertyEntry property in this.AdvancedProperties) - { - if (this.DoesPropertyMatchFilter(filter, property)) - { - newAdvancedPropertyMatchesFilter = true; - } - } - - this.BasicPropertyMatchesFilter = newBasicPropertyMatchesFilter; - this.AdvancedPropertyMatchesFilter = newAdvancedPropertyMatchesFilter; - - this.OnFilterApplied(filter); - } - - public override bool MatchesPredicate(PropertyFilterPredicate predicate) - { - return predicate.Match(this.CategoryName); - } - - - protected virtual bool DoesPropertyMatchFilter(PropertyFilter filter, PropertyEntry property) - { - property.ApplyFilter(filter); - return property.MatchesFilter; - } - - private struct PropertyEnumerator : IEnumerator - { - private CategoryBase category; - private IEnumerator current; - private bool enumeratingBasic; - - public PropertyEnumerator(CategoryBase category) - { - this.category = category; - this.current = null; - this.enumeratingBasic = false; - this.Reset(); - } - - public PropertyEntry Current - { - get - { - return this.current.Current; - } - } - - object IEnumerator.Current - { - get { return this.Current; } - } - - public bool MoveNext() - { - if (this.current.MoveNext()) - { - return true; - } - else - { - if (this.enumeratingBasic) - { - this.enumeratingBasic = false; - this.current = this.category.AdvancedProperties.GetEnumerator(); - return this.MoveNext(); - } - else - { - return false; - } - } - } - - public void Reset() - { - this.current = category.BasicProperties.GetEnumerator(); - this.enumeratingBasic = true; - } - - void IDisposable.Dispose() - { - } - } - private class AlphabeticalCategoryEditorComparer : Comparer - { - public override int Compare(CategoryEditor x, CategoryEditor y) - { - //return x.GetType().ToString().CompareTo(y.GetType().ToString()); - //CompareTo uses currentCulture for string comparison - return string.Compare(x.GetType().ToString(), y.GetType().ToString(), StringComparison.CurrentCulture); - } - } - } -} - diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryContainer.xaml.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryContainer.xaml.cs deleted file mode 100644 index efdb0b6da29..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryContainer.xaml.cs +++ /dev/null @@ -1,629 +0,0 @@ - -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Properties -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Controls.Primitives; - using System.Windows.Data; - using System.Windows.Media; - using System.Diagnostics; - using System.Activities.Presentation.PropertyEditing; - using System.Collections.ObjectModel; - using System.ComponentModel; - using System.Runtime; - using System.Diagnostics.CodeAnalysis; - using System.Activities.Presentation; - - //Cider change [CLSCompliant(false)] - internal partial class CategoryContainer : ContentControl - { - - // This will be set by the property inspector if the category is hosted in a popup. - public static readonly DependencyProperty PopupHostProperty = DependencyProperty.RegisterAttached( - "PopupHost", typeof(Popup), typeof(CategoryContainer), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits, OnPopupHostChanged)); - - public static readonly DependencyProperty CategoryProperty = DependencyProperty.Register( - "Category", - typeof(CategoryBase), - typeof(CategoryContainer), - new PropertyMetadata( - (CategoryEntry)null, - new PropertyChangedCallback(OnCategoryPropertyChanged))); - - public static readonly DependencyProperty ExpandedProperty = DependencyProperty.Register("Expanded", typeof(bool), typeof(CategoryContainer), new FrameworkPropertyMetadata(false, new PropertyChangedCallback(OnExpandedChanged))); - - public static readonly DependencyProperty AdvancedSectionPinnedProperty = DependencyProperty.Register("AdvancedSectionPinned", typeof(bool), typeof(CategoryContainer), new FrameworkPropertyMetadata(false)); - - public static readonly DependencyProperty BasicPropertyMatchesFilterProperty = DependencyProperty.Register("BasicPropertyMatchesFilter", typeof(bool), typeof(CategoryContainer), new FrameworkPropertyMetadata(true)); - - public static readonly DependencyProperty AdvancedPropertyMatchesFilterProperty = DependencyProperty.Register("AdvancedPropertyMatchesFilter", typeof(bool), typeof(CategoryContainer), new FrameworkPropertyMetadata(true, new PropertyChangedCallback(CategoryContainer.OnAdvancedPropertyMatchesFilterChanged))); - - public static readonly DependencyProperty ShowAdvancedHeaderProperty = DependencyProperty.Register("ShowAdvancedHeader", typeof(bool), typeof(CategoryContainer), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.None, null, new CoerceValueCallback(CategoryContainer.CoerceShowAdvancedHeader))); - - public static readonly DependencyProperty OwningCategoryContainerProperty = DependencyProperty.RegisterAttached("OwningCategoryContainer", typeof(CategoryContainer), typeof(CategoryContainer), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits)); - - - - // Data for managing expanded state based on a filter. - private FilterState filterIsEmpty = FilterState.Unknown; - - // garylins 11/15/2006 - This variable has been added to fix bug 29740. The real fix is to find - // a way to update CategoryContainers expansion state when the Category changes. The bug comes about - // because when UpdateFilter is called from the PI, it fires the FilterUpdated event. At this time - // the CategoryContainer is not yet built out, so it hasn't hooked up to listen to the event and hence - // never gets it's filter state related variables updated. - private bool haveCachedExpanded = false; - private bool wasAdvancedPinnedBeforeFilter = false; - private bool wasExpandedBeforeFilter = true; - - // used for managing category editors and overflow properties. - private ObservableCollection basicCategoryEditors = new ObservableCollection(); - private ObservableCollection advancedCategoryEditors = new ObservableCollection(); - private ObservableCollection unconsumedBasicProperties = new ObservableCollection(); - private ObservableCollection unconsumedAdvancedProperties = new ObservableCollection(); - - - - public CategoryContainer() : this(true) - { - } - - public CategoryContainer(bool initializeComponent) - { - if (initializeComponent) - { - this.InitializeComponent(); - } - - SetOwningCategoryContainer(this, this); - - Binding basicMatchesFilterBinding = new Binding("Category.BasicPropertyMatchesFilter"); - basicMatchesFilterBinding.Source = this; - basicMatchesFilterBinding.Mode = BindingMode.OneWay; - this.SetBinding(CategoryContainer.BasicPropertyMatchesFilterProperty, basicMatchesFilterBinding); - - Binding advancedMatchesFilterBinding = new Binding("Category.AdvancedPropertyMatchesFilter"); - advancedMatchesFilterBinding.Source = this; - advancedMatchesFilterBinding.Mode = BindingMode.OneWay; - this.SetBinding(CategoryContainer.AdvancedPropertyMatchesFilterProperty, advancedMatchesFilterBinding); - } - - public ObservableCollection BasicCategoryEditors - { - get { return this.basicCategoryEditors; } - } - - public ObservableCollection AdvancedCategoryEditors - { - get { return this.advancedCategoryEditors; } - } - - public ObservableCollection UnconsumedBasicProperties - { - get { return this.unconsumedBasicProperties; } - } - - public ObservableCollection UnconsumedAdvancedProperties - { - get { return this.unconsumedAdvancedProperties; } - } - - public CategoryBase Category - { - get { return (CategoryBase)this.GetValue(CategoryContainer.CategoryProperty); } - set { this.SetValue(CategoryContainer.CategoryProperty, value); } - } - - public bool Expanded - { - get { return (bool)this.GetValue(CategoryContainer.ExpandedProperty); } - set { this.SetValue(CategoryContainer.ExpandedProperty, value); } - } - - public bool AdvancedSectionPinned - { - get { return (bool)this.GetValue(CategoryContainer.AdvancedSectionPinnedProperty); } - set { this.SetValue(CategoryContainer.AdvancedSectionPinnedProperty, value); } - } - - public bool BasicPropertyMatchesFilter - { - get { return (bool)this.GetValue(CategoryContainer.BasicPropertyMatchesFilterProperty); } - set { this.SetValue(CategoryContainer.BasicPropertyMatchesFilterProperty, value); } - } - - public bool AdvancedPropertyMatchesFilter - { - get { return (bool)this.GetValue(CategoryContainer.AdvancedPropertyMatchesFilterProperty); } - set { this.SetValue(CategoryContainer.AdvancedPropertyMatchesFilterProperty, value); } - } - - public bool ShowAdvancedHeader - { - get { return (bool)this.GetValue(CategoryContainer.ShowAdvancedHeaderProperty); } - set { this.SetValue(CategoryContainer.ShowAdvancedHeaderProperty, value); } - } - - - // - // Writes the attached property OwningCategoryContainer to the given element. - // - // The element to which to write the attached property. - // The property value to set - public static void SetOwningCategoryContainer(DependencyObject dependencyObject, CategoryContainer value) - { - if (dependencyObject == null) - { - throw FxTrace.Exception.ArgumentNull("dependencyObject"); - } - dependencyObject.SetValue(CategoryContainer.OwningCategoryContainerProperty, value); - } - - // - // Reads the attached property OwningCategoryContainer from the given element. - // - // The element from which to read the attached property. - // The property's value. - public static CategoryContainer GetOwningCategoryContainer(DependencyObject dependencyObject) - { - if (dependencyObject == null) - { - throw FxTrace.Exception.ArgumentNull("dependencyObject"); - } - return (CategoryContainer)dependencyObject.GetValue(CategoryContainer.OwningCategoryContainerProperty); - } - - public static Popup GetPopupHost(DependencyObject target) - { - return (Popup)target.GetValue(CategoryContainer.PopupHostProperty); - } - - public static void SetPopupHost(DependencyObject target, Popup value) - { - target.SetValue(CategoryContainer.PopupHostProperty, value); - } - - private static void OnPopupHostChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - CategoryContainer categoryEditor = d as CategoryContainer; - if (categoryEditor != null) - { - // If we are hosted in a popup, do not show the advanced category expander, and pin the advanced section. - if (e.NewValue != null) - { - categoryEditor.AdvancedSectionPinned = true; - } - else - { - categoryEditor.AdvancedSectionPinned = false; - } - } - } - - private static void OnCategoryPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - CategoryContainer theThis = (CategoryContainer)d; - - if (e.NewValue != null) - { - CategoryBase category = (CategoryBase)e.NewValue; - theThis.SetValue( - System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Diagnostics.Automation.AutomationElement.IdProperty, - category.CategoryName + "Category"); - - - CategoryBase oldCategory = (CategoryBase)e.OldValue; - if (oldCategory != null) - { - oldCategory.FilterApplied -= new EventHandler(theThis.OnFilterApplied); - - category.CategoryEditors.CollectionChanged -= theThis.CategoryEditors_CollectionChanged; - theThis.basicCategoryEditors.Clear(); - theThis.advancedCategoryEditors.Clear(); - - category.BasicProperties.CollectionChanged -= theThis.BasicProperties_CollectionChanged; - category.AdvancedProperties.CollectionChanged -= theThis.AdvancedProperties_CollectionChanged; - theThis.unconsumedBasicProperties.Clear(); - theThis.unconsumedAdvancedProperties.Clear(); - } - if (category != null) - { - category.FilterApplied += new EventHandler(theThis.OnFilterApplied); - - theThis.AddCategoryEditors(category.CategoryEditors); - category.CategoryEditors.CollectionChanged += theThis.CategoryEditors_CollectionChanged; - - foreach (PropertyEntry property in category.BasicProperties) - { - theThis.AddProperty(property, theThis.unconsumedBasicProperties, theThis.Category.BasicProperties, theThis.basicCategoryEditors); - } - foreach (PropertyEntry property in category.AdvancedProperties) - { - theThis.AddProperty(property, theThis.unconsumedAdvancedProperties, theThis.Category.AdvancedProperties, theThis.advancedCategoryEditors); - } - category.BasicProperties.CollectionChanged += theThis.BasicProperties_CollectionChanged; - category.AdvancedProperties.CollectionChanged += theThis.AdvancedProperties_CollectionChanged; - } - theThis.CoerceValue(CategoryContainer.ShowAdvancedHeaderProperty); - } - } - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - BEGIN - // ################################################### - - // This method used to be non-virtual, private - protected virtual void AddProperty(PropertyEntry property, ObservableCollection unconsumedProperties, ObservableCollection referenceOrder, ObservableCollection categoryEditors) - { - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - END - // ################################################### - - bool consumed = false; - - foreach (CategoryEditor categoryEditor in categoryEditors) - { - if (categoryEditor.ConsumesProperty(property)) - { - consumed = true; - } - } - if (!consumed) - { - // We need to insert this property in the correct location. Reference order is sorted and contains all properties in the unconsumed properties collection. - Fx.Assert(referenceOrder.Contains(property), "Reference order should contain the property to be added."); -#if DEBUG - foreach (PropertyEntry unconsumedProperty in unconsumedProperties) - { - Fx.Assert(referenceOrder.Contains(unconsumedProperty), "Reference order should contain all unconsumed properties."); - } -#endif - - // We'll walk both collections, and advance the insertion index whenever we see an unconsumed property come ahead of the target in the reference order. - int referenceIndex = 0; - int insertionIndex = 0; - while (referenceOrder[referenceIndex] != property && insertionIndex < unconsumedProperties.Count) - { - if (unconsumedProperties[insertionIndex] == referenceOrder[referenceIndex]) - { - insertionIndex++; - } - referenceIndex++; - } - unconsumedProperties.Insert(insertionIndex, property); - } - } - - private void OnFilterApplied(object source, PropertyFilterAppliedEventArgs args) - { - // If the filter just switched between empty and non-empty - if (args.Filter.IsEmpty && this.filterIsEmpty != FilterState.Empty || !args.Filter.IsEmpty && this.filterIsEmpty != FilterState.NotEmpty) - { - // If the filter is now empty - if (args.Filter.IsEmpty) - { - if (this.haveCachedExpanded) - { - // Set Pinned and Expanded to what they were before the filter - this.Expanded = this.wasExpandedBeforeFilter; - this.AdvancedSectionPinned = this.wasAdvancedPinnedBeforeFilter; - } - } - else - { - // Cache the Pinned and Expanded state - this.haveCachedExpanded = true; - this.wasExpandedBeforeFilter = this.Expanded; - this.wasAdvancedPinnedBeforeFilter = this.AdvancedSectionPinned; - } - } - - if (!args.Filter.IsEmpty) - { - this.Expanded = this.BasicPropertyMatchesFilter || this.AdvancedPropertyMatchesFilter; - this.AdvancedSectionPinned = this.AdvancedPropertyMatchesFilter; - } - - this.filterIsEmpty = args.Filter.IsEmpty ? FilterState.Empty : FilterState.NotEmpty; - } - - - private static void OnExpandedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - if (CategoryContainerCommands.UpdateCategoryExpansionState.CanExecute(null, d as IInputElement)) - { - CategoryContainerCommands.UpdateCategoryExpansionState.Execute(null, d as IInputElement); - } - } - - private void OnMinimizeButtonClick(object sender, RoutedEventArgs e) - { - // dismiss the popup - Popup popupHost = CategoryContainer.GetPopupHost(this); - Fx.Assert(popupHost != null, "popupHost should not be null"); - if (popupHost != null) - { - popupHost.IsOpen = false; - } - } - - private static void OnAdvancedPropertyMatchesFilterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - CategoryContainer editor = d as CategoryContainer; - if (editor != null) - { - editor.CoerceValue(CategoryContainer.ShowAdvancedHeaderProperty); - } - } - - private static object CoerceShowAdvancedHeader(DependencyObject d, object value) - { - CategoryContainer editor = d as CategoryContainer; - if (editor != null) - { - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - BEGIN - // ################################################### - - // Bugfix: this condition used to reference editor.Category.AdvancedProperties.Count instead of - // editor.unconsumedAdvancedProperties, which is a bug. - if ((editor.unconsumedAdvancedProperties.Count <= 0 && editor.advancedCategoryEditors.Count == 0) || !editor.AdvancedPropertyMatchesFilter) - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - END - // ################################################### - - { - return false; - } - } - - return true; - } - - protected override void OnInitialized(EventArgs e) - { - base.OnInitialized(e); - this.Loaded += new RoutedEventHandler(CategoryContainer_Loaded); - } - - private void CategoryContainer_Loaded(object sender, RoutedEventArgs e) - { - IPropertyInspector owningPI = PropertyInspectorHelper.GetOwningPropertyInspectorModel(this); - if (owningPI != null) - { - if (CategoryContainer.GetPopupHost(this) == null) - { - this.Expanded = owningPI.IsCategoryExpanded(this.Category.CategoryName); - } - } - } - - - // Category editor management - private void AdvancedProperties_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) - { - switch (e.Action) - { - case System.Collections.Specialized.NotifyCollectionChangedAction.Add: - foreach (PropertyEntry property in e.NewItems) - { - this.AddProperty(property, this.unconsumedAdvancedProperties, this.Category.AdvancedProperties, this.advancedCategoryEditors); - } - break; - - case System.Collections.Specialized.NotifyCollectionChangedAction.Remove: - foreach (PropertyEntry property in e.OldItems) - { - this.unconsumedAdvancedProperties.Remove(property); - } - break; - - default: - Debug.Fail("BasicProperties should not change in a way other than an add or a remove."); - break; - } - - this.CoerceValue(CategoryContainer.ShowAdvancedHeaderProperty); - } - - private void BasicProperties_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) - { - switch (e.Action) - { - case System.Collections.Specialized.NotifyCollectionChangedAction.Add: - foreach (PropertyEntry property in e.NewItems) - { - this.AddProperty(property, this.unconsumedBasicProperties, this.Category.BasicProperties, this.basicCategoryEditors); - } - break; - - case System.Collections.Specialized.NotifyCollectionChangedAction.Remove: - foreach (PropertyEntry property in e.OldItems) - { - this.unconsumedBasicProperties.Remove(property); - } - break; - - default: - Debug.Fail("BasicProperties should not change in a way other than an add or a remove."); - break; - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Propagating the error might cause VS to crash")] - [SuppressMessage("Reliability", "Reliability108", Justification = "Propagating the error might cause VS to crash")] - private bool IsAdvanced(CategoryEditor editor) - { - AttributeCollection attributes = null; - try - { - attributes = TypeDescriptor.GetAttributes(editor); - } - catch (Exception) - { - } - if (attributes != null) - { - foreach (Attribute attribute in attributes) - { - EditorBrowsableAttribute browsable = attribute as EditorBrowsableAttribute; - if (browsable != null) - { - return browsable.State == EditorBrowsableState.Advanced; - } - } - } - return false; - } - - private void AddCategoryEditors(IList editors) - { - foreach (CategoryEditor editor in editors) - { - if (this.IsAdvanced(editor)) - { - this.advancedCategoryEditors.Add(editor); - this.UpdateUnconsumedProperties(editor, this.unconsumedAdvancedProperties); - } - else - { - this.basicCategoryEditors.Add(editor); - this.UpdateUnconsumedProperties(editor, this.unconsumedBasicProperties); - } - } - } - - private void UpdateUnconsumedProperties(CategoryEditor newEditor, ObservableCollection unconsumedProperties) - { - for (int i = unconsumedProperties.Count - 1; i >= 0; i--) - { - if (newEditor.ConsumesProperty(unconsumedProperties[i])) - { - unconsumedProperties.RemoveAt(i); - } - } - } - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - BEGIN - // ################################################### - - // This change is a result of bug 88870. Blend has this issue - // as well and will need to address it soon. - - // Original code: - - //private void RemoveCategoryEditors(IList editors) { - // foreach (CategoryEditor editor in editors) { - // if (this.IsAdvanced(editor)) { - // this.advancedCategoryEditors.Remove(editor); - // } - // else { - // this.basicCategoryEditors.Remove(editor); - // } - // } - //} - - // Updated code: - - private void RemoveCategoryEditors(IList editors) - { - bool refreshBasicProperties = false; - bool refreshAdvancedProperties = false; - - foreach (CategoryEditor editor in editors) - { - if (this.IsAdvanced(editor)) - { - this.advancedCategoryEditors.Remove(editor); - refreshAdvancedProperties = true; - } - else - { - this.basicCategoryEditors.Remove(editor); - refreshBasicProperties = true; - } - } - - if (this.Category != null) - { - if (refreshBasicProperties) - { - RefreshConsumedProperties(this.unconsumedBasicProperties, this.Category.BasicProperties, this.basicCategoryEditors); - } - - if (refreshAdvancedProperties) - { - RefreshConsumedProperties(this.unconsumedAdvancedProperties, this.Category.AdvancedProperties, this.advancedCategoryEditors); - } - } - } - - private void RefreshConsumedProperties(ObservableCollection unconsumedProperties, ObservableCollection allProperties, ObservableCollection categoryEditors) - { - if (allProperties == null || unconsumedProperties == null || unconsumedProperties.Count == allProperties.Count) - { - return; - } - - foreach (PropertyEntry property in allProperties) - { - if (!unconsumedProperties.Contains(property)) - { - // The following method will only add the specified property to the unconsumed - // list if it isn't already consumed by some existing category editor. - AddProperty(property, unconsumedProperties, allProperties, categoryEditors); - } - } - } - - // ################################################# - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - END - // ################################################# - - private void CategoryEditors_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) - { - // we need to add/remove category editors - switch (e.Action) - { - case System.Collections.Specialized.NotifyCollectionChangedAction.Reset: - this.basicCategoryEditors.Clear(); - this.advancedCategoryEditors.Clear(); - break; - - case System.Collections.Specialized.NotifyCollectionChangedAction.Add: - this.AddCategoryEditors(e.NewItems); - break; - - case System.Collections.Specialized.NotifyCollectionChangedAction.Remove: - this.RemoveCategoryEditors(e.OldItems); - break; - - case System.Collections.Specialized.NotifyCollectionChangedAction.Replace: - this.RemoveCategoryEditors(e.OldItems); - this.AddCategoryEditors(e.NewItems); - break; - } - } - - // Constructors - private enum FilterState - { - Unknown, - Empty, - NotEmpty - } - // Fields - } -} - diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryContainerCommands.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryContainerCommands.cs deleted file mode 100644 index 3897fd57c77..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryContainerCommands.cs +++ /dev/null @@ -1,40 +0,0 @@ - - -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Properties -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector -{ - using System; - using System.Windows; - using System.Windows.Input; - - - // - // Standard commands and command implementations used by PropertyContainer templates - // and implemented by property editing hosts - // - internal static class CategoryContainerCommands - { - private static readonly RoutedCommand togglePinAdvancedProperties = new RoutedCommand("TogglePinAdvancedProperties", typeof(CategoryContainerCommands)); - private static readonly RoutedCommand updateCategoryExpansionState = new RoutedCommand("UpdateCategoryExpansionState", typeof(CategoryContainerCommands)); - - // - // standard command to category edit host to togglePinAdvancedProperties - // - public static RoutedCommand TogglePinAdvancedProperties - { - get { return CategoryContainerCommands.togglePinAdvancedProperties; } - } - - // - // standard command to property edit host to updateCategoryExpansionState - // - public static RoutedCommand UpdateCategoryExpansionState - { - get { return CategoryContainerCommands.updateCategoryExpansionState; } - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryLayoutContainer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryLayoutContainer.cs deleted file mode 100644 index af17a188e4e..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/CategoryLayoutContainer.cs +++ /dev/null @@ -1,33 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Properties -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector -{ - using System.Windows; - using System.Windows.Data; - using System.Windows.Controls; - using System.Activities.Presentation.PropertyEditing; - - internal class CategoryLayoutContainer : ItemsControl - { - public CategoryLayoutContainer() - { - } - - protected override void PrepareContainerForItemOverride(DependencyObject element, object item) - { - ContentPresenter contentPresenter = element as ContentPresenter; - CategoryEditor categoryEditor = item as CategoryEditor; - if (contentPresenter != null && categoryEditor != null) - { - Binding contentBinding = new Binding("DataContext.Category"); - contentBinding.RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(CategoryLayoutContainer), 1); - contentPresenter.SetBinding(ContentPresenter.ContentProperty, contentBinding); - contentPresenter.ContentTemplate = categoryEditor.EditorTemplate; - } - - base.PrepareContainerForItemOverride(element, item); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/ExtensibilityMetadataHelper.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/ExtensibilityMetadataHelper.cs deleted file mode 100644 index 5b106a83a21..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/ExtensibilityMetadataHelper.cs +++ /dev/null @@ -1,113 +0,0 @@ - -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Properties -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector -{ - using System.ComponentModel; - using System.Diagnostics; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System; - using System.Activities.Presentation.PropertyEditing; - using System.Collections; - using System.Globalization; - using System.Runtime; - using System.Diagnostics.CodeAnalysis; - - internal static class ExtensibilityMetadataHelper - { - // - // Returns an instance of the PropertyValueEditor specified in the provided attribute list. - // - // A list of attributes. If an EditorAttribute is not specified in this collection, will return null. - // Interface for exception logging. If null, exceptions will be silently ignored. - // - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Propagating the error might cause VS to crash")] - [SuppressMessage("Reliability", "Reliability108", Justification = "Propagating the error might cause VS to crash")] - public static PropertyValueEditor GetValueEditor(IEnumerable attributes, IMessageLogger exceptionLogger) - { - PropertyValueEditor propertyValueEditor = null; - if (attributes != null) - { - foreach (Attribute attribute in attributes) - { - EditorAttribute editorAttribute = attribute as EditorAttribute; - if (editorAttribute != null) - { - try - { - Type editorType = Type.GetType(editorAttribute.EditorTypeName); - if (editorType != null && typeof(PropertyValueEditor).IsAssignableFrom(editorType)) - { - propertyValueEditor = (PropertyValueEditor)Activator.CreateInstance(editorType); - break; - } - } - catch (Exception e) - { - if (exceptionLogger != null) - { - exceptionLogger.WriteLine(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.ValueEditorLoadFailed, ExtensibilityMetadataHelper.GetExceptionMessage(e))); - } - } - } - } - } - return propertyValueEditor; - } - - // - // Returns the type of the editor specified by the provided EditorAttribute. - // - // EditorAttribute that specifies a CategoryEditor type. If the type specified is not derived from CategoryEditor, or cannot be loaded, will return null. - // Interface for exception logging. If null, exceptions will be silently ignored. - // - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Propagating the error might cause VS to crash")] - [SuppressMessage("Reliability", "Reliability108", Justification = "Propagating the error might cause VS to crash")] - public static Type GetCategoryEditorType(EditorAttribute attribute, IMessageLogger exceptionLogger) - { - try - { - Type editorType = Type.GetType(attribute.EditorTypeName); - if (editorType != null && typeof(CategoryEditor).IsAssignableFrom(editorType)) - { - return editorType; - } - } - catch (Exception e) - { - if (exceptionLogger != null) - { - exceptionLogger.WriteLine(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.CategoryEditorTypeLoadFailed, ExtensibilityMetadataHelper.GetExceptionMessage(e))); - } - } - return null; - } - - public static string GetExceptionMessage(Exception e) - { - return (e.InnerException != null) ? e.InnerException.ToString() : e.Message; - } - - public static bool IsEditorReusable(IEnumerable attributes) - { - bool isEditorReusable = true; - if (attributes != null) - { - foreach (Attribute attribute in attributes) - { - EditorReuseAttribute editorReuseAttribute = attribute as EditorReuseAttribute; - if (editorReuseAttribute != null) - { - isEditorReusable = editorReuseAttribute.ReuseEditor; - break; - } - } - } - return isEditorReusable; - } - } -} - diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/IPropertyInspector.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/IPropertyInspector.cs deleted file mode 100644 index 4ab420da3aa..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/IPropertyInspector.cs +++ /dev/null @@ -1,90 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Properties -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector -{ - using System; - using System.Collections.Generic; - using System.Windows; - using System.Activities.Presentation.PropertyEditing; - using System.Diagnostics; - using System.Activities.Presentation; - - internal interface IPropertyInspector - { - bool IsCategoryExpanded(string categoryName); - - // - // Calls Update on the current transaction, if one exists within the context - // of this PropertyInspector - // - void UpdateTransaction(); - } - - internal class PropertyInspectorHelper - { - // OwningPropertyInspector Attached, Inherited DP - public static readonly DependencyProperty OwningPropertyInspectorModelProperty = DependencyProperty.RegisterAttached("OwningPropertyInspectorModel", typeof(IPropertyInspector), typeof(PropertyInspectorHelper), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits)); - public static readonly DependencyProperty OwningPropertyInspectorElementProperty = DependencyProperty.RegisterAttached("OwningPropertyInspectorElement", typeof(UIElement), typeof(PropertyInspectorHelper), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits)); - - // - // Writes the attached property OwningPropertyInspector to the given element. - // - // The element to which to write the attached property. - // The property value to set - public static void SetOwningPropertyInspectorModel(DependencyObject dependencyObject, IPropertyInspector value) - { - if (dependencyObject == null) - { - throw FxTrace.Exception.ArgumentNull("dependencyObject"); - } - dependencyObject.SetValue(PropertyInspectorHelper.OwningPropertyInspectorModelProperty, value); - } - - // - // Reads the attached property OwningPropertyInspector from the given element. - // - // The element from which to read the attached property. - // The property's value. - public static IPropertyInspector GetOwningPropertyInspectorModel(DependencyObject dependencyObject) - { - if (dependencyObject == null) - { - throw FxTrace.Exception.ArgumentNull("dependencyObject"); - } - return (IPropertyInspector)dependencyObject.GetValue(PropertyInspectorHelper.OwningPropertyInspectorModelProperty); - } - - // OwningPropertyInspector Attached, Inherited DP - - // - // Writes the attached property OwningPropertyInspector to the given element. - // - // The element to which to write the attached property. - // The property value to set - public static void SetOwningPropertyInspectorElement(DependencyObject dependencyObject, UIElement value) - { - if (dependencyObject == null) - { - throw FxTrace.Exception.ArgumentNull("dependencyObject"); - } - dependencyObject.SetValue(PropertyInspectorHelper.OwningPropertyInspectorElementProperty, value); - } - - // - // Reads the attached property OwningPropertyInspector from the given element. - // - // The element from which to read the attached property. - // The property's value. - public static UIElement GetOwningPropertyInspectorElement(DependencyObject dependencyObject) - { - if (dependencyObject == null) - { - throw FxTrace.Exception.ArgumentNull("dependencyObject"); - } - return (UIElement)dependencyObject.GetValue(PropertyInspectorHelper.OwningPropertyInspectorElementProperty); - } - } -} - diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/NewItemFactoryTypeModel.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/NewItemFactoryTypeModel.cs deleted file mode 100644 index 5f6c5d64512..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/NewItemFactoryTypeModel.cs +++ /dev/null @@ -1,103 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Properties -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector -{ - using System; - using System.Windows; - using System.Activities.Presentation.PropertyEditing; - using System.ComponentModel; - using System.Windows.Media; - using System.Globalization; - - internal class NewItemFactoryTypeModel - { - private Type type; - private NewItemFactory factory; - private Size desiredSize; - private IMessageLogger exceptionLogger; - - public NewItemFactoryTypeModel(Type type, NewItemFactory factory) - { - this.type = type; - this.factory = factory; - this.desiredSize = new Size(0, 0); - this.exceptionLogger = null; - } - - public NewItemFactoryTypeModel(Type type, NewItemFactory factory, IMessageLogger exceptionLogger) : this(type, factory) - { - this.exceptionLogger = exceptionLogger; - } - - public string DisplayName - { - get { return this.factory.GetDisplayName(this.type); } - } - - public Type Type - { - get { return this.type; } - } - - public object Image - { - get - { - object image = this.factory.GetImage(this.type, this.desiredSize); - ImageSource imageSource = image as ImageSource; - if (imageSource != null && imageSource is ISupportInitialize) - { - try - { - double dummyHeight = imageSource.Height; - } - catch (InvalidOperationException exception) - { - this.ReportException(string.Format(CultureInfo.CurrentCulture, ExceptionStringTable.NewItemFactoryIconLoadFailed, this.factory.GetType().Name, exception.Message)); - } - } - return image; - } - } - - public Size DesiredSize - { - get { return this.desiredSize; } - set { this.desiredSize = value; } - } - - public NewItemFactory ItemFactory - { - get { return this.factory; } - } - - public object CreateInstance() - { - return this.factory.CreateInstance(this.type); - } - - private void ReportException(string message) - { - if (this.exceptionLogger != null) - { - this.exceptionLogger.WriteLine(message); - } - } - - // - // Seems like the ComboBoxAutomation peer, calls the object.ToString() to read out - // the item, if the item doesnt have its content set when queried by AutomationClient. - // As a result, when this NewItemFactoryTypeModel, - // is added to the combo-box in a SubPropertyEditor, we need to return the DisplayName - // property in the ToString() implementation so that that the AutomationClient - // reads out the correct value instead of the type of the object. - // - // - public override string ToString() - { - return DisplayName; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/PropertyContainerPopupHelper.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/PropertyContainerPopupHelper.cs deleted file mode 100644 index f4591eff476..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/PropertyContainerPopupHelper.cs +++ /dev/null @@ -1,74 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Properties -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector -{ - using System; - using System.Collections.Generic; - using System.Text; - using System.Windows; - using System.Windows.Controls.Primitives; - using System.Windows.Input; - using System.Windows.Media; - using System.Activities.Presentation.PropertyEditing; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Controls; - - // - // Acrylic needs a way of knowing when we begin and end extended edit mode, - // so this class fires commands when those two events take place. - // - internal class PropertyContainerPopup : WorkaroundPopup - { - // these events allow Acrylic to implement its workaround for Avalon/MFC interop - // focus issues (WinOS bug # 1713206) - public static readonly RoutedCommand OnBeginExtendedEdit = new RoutedCommand("OnBeginExtendedEdit", typeof(PropertyContainerPopup)); - public static readonly RoutedCommand OnEndExtendedEdit = new RoutedCommand("OnEndExtendedEdit", typeof(PropertyContainerPopup)); - - public static CustomPopupPlacementCallback RightAlignedPopupPlacement - { - get { return new CustomPopupPlacementCallback(PropertyContainerPopup.RightAlignedPopupPlacementCallback); } - } - - protected override void OnOpened(EventArgs e) - { - // Fire OnBeginExtendedEdit command (for Acrylic) - PropertyContainer owningPropertyContainer = (PropertyContainer)this.GetValue(PropertyContainer.OwningPropertyContainerProperty); - PropertyContainerPopup.OnBeginExtendedEdit.Execute(this, owningPropertyContainer); - - base.OnOpened(e); - } - - protected override void OnClosed(EventArgs e) - { - base.OnClosed(e); - - PropertyContainer owningPropertyContainer = (PropertyContainer)this.GetValue(PropertyContainer.OwningPropertyContainerProperty); - - // Revert back to Inline when the popup is dismissed and we haven't already switched - // to the pinned mode - if (owningPropertyContainer != null && owningPropertyContainer.ActiveEditMode == PropertyContainerEditMode.ExtendedPopup) - { - DependencyObject potentialDescendant = Mouse.Captured as DependencyObject; - if (potentialDescendant != null && owningPropertyContainer.IsAncestorOf(potentialDescendant)) - { - // v1 38479: This is a mitigation for Windows OS Bug 1965872. - // Here we force any control which has capture to lose it, though - // this situation can occur in other cases (e.g. via extensibility) but this covers the most - // common cases and is a safe fix. - Mouse.Capture(null); - } - - owningPropertyContainer.ActiveEditMode = PropertyContainerEditMode.Inline; - } - - // Fire OnEndExtendedEdit command (for Acrylic) - OnEndExtendedEdit.Execute(this, owningPropertyContainer); - } - - public static CustomPopupPlacement[] RightAlignedPopupPlacementCallback(Size popupSize, Size targetSize, Point offset) - { - return new CustomPopupPlacement[] { new CustomPopupPlacement(new Point(targetSize.Width - popupSize.Width, targetSize.Height), PopupPrimaryAxis.Horizontal) }; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/StandardCategoryLayout.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/StandardCategoryLayout.cs deleted file mode 100644 index 00037dc9410..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/PropertyInspector/StandardCategoryLayout.cs +++ /dev/null @@ -1,40 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Properties -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector -{ - using System; - using System.Diagnostics; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - using System.Activities.Presentation.PropertyEditing; - - internal class StandardCategoryLayout : ItemsControl - { - public StandardCategoryLayout() - { - } - - // This override is present to allow us to skip the automatically inserted ContentPresenter that ItemsControl - // generates by default. PrepareContainerForItemOverride sets up the DataContext and PropertyBinding as though - // it were contained within a ContentPresenter and had a Template that was . - protected override DependencyObject GetContainerForItemOverride() - { - return new PropertyContainer(); - } - - protected override void PrepareContainerForItemOverride(DependencyObject element, object item) - { - PropertyContainer propertyContainer = element as PropertyContainer; - if (propertyContainer != null) - { - propertyContainer.DataContext = item; - propertyContainer.SetBinding(PropertyContainer.PropertyEntryProperty, new Binding()); - } - - base.PrepareContainerForItemOverride(element, item); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Tolerances.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Tolerances.cs deleted file mode 100644 index d74169401ee..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/Tolerances.cs +++ /dev/null @@ -1,30 +0,0 @@ -// ------------------------------------------------------------------- -// Description: -// Provides helper functions handling move and hit detection -// tolerances. -// -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- - -//Cider comment: -// - Class has many members that we don't use. -// - I have removed them to avoid FXCop warning and lowering code coverage - -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework -{ - using System; - using System.Windows; - using System.Windows.Media.Media3D; - internal static class Tolerances - { - //Cider private static readonly double ZeroThreshold = 2.2204460492503131e-015; - private const double ZeroThreshold = 2.2204460492503131e-015; - - public static bool NearZero(double d) - { - return Math.Abs(d) < Tolerances.ZeroThreshold; - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/UIThreadDispatcher.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/UIThreadDispatcher.cs deleted file mode 100644 index 5b802d83e55..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/UIThreadDispatcher.cs +++ /dev/null @@ -1,100 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework -{ - using System; - using System.Diagnostics; - using System.Windows.Threading; - using System.Runtime; - - // - // A class to execute a method on the UI thread. This must be constructed on the UI thread, - // usually by calling UIThreadDispatcher.InitializeDispatcher(). Derive from this and - // install your own on UIThreadDispatcher if you want to. - // - internal class UIThreadDispatcher - { - - static UIThreadDispatcher dispatcher; - // fields - private Dispatcher uiThreadDispatcher; - - // Singleton Management - - public UIThreadDispatcher() - { - this.uiThreadDispatcher = Dispatcher.CurrentDispatcher; - } - - public static UIThreadDispatcher Instance - { - get - { - Fx.Assert(dispatcher != null, "Instance getter called before Instance is initialized"); - - return dispatcher; - } - set - { - dispatcher = value; - } - } - - - public static void InitializeInstance() - { - Instance = new UIThreadDispatcher(); - } - - public virtual void BeginInvoke(DispatcherPriority priority, Delegate method) - { - if (!this.uiThreadDispatcher.HasShutdownStarted) - { - this.uiThreadDispatcher.BeginInvoke(priority, method); - } - } - - public virtual void BeginInvoke(DispatcherPriority priority, Delegate method, object arg) - { - if (!this.uiThreadDispatcher.HasShutdownStarted) - { - this.uiThreadDispatcher.BeginInvoke(priority, method, arg); - } - } - - public virtual void BeginInvoke(DispatcherPriority priority, Delegate method, object arg, params object[] args) - { - if (!this.uiThreadDispatcher.HasShutdownStarted) - { - this.uiThreadDispatcher.BeginInvoke(priority, method, arg, args); - } - } - - public virtual void Invoke(DispatcherPriority priority, Delegate method) - { - if (!this.uiThreadDispatcher.HasShutdownStarted) - { - this.uiThreadDispatcher.Invoke(priority, method); - } - } - - public virtual void Invoke(DispatcherPriority priority, Delegate method, object arg) - { - if (!this.uiThreadDispatcher.HasShutdownStarted) - { - this.uiThreadDispatcher.Invoke(priority, method, arg); - } - } - - public virtual void Invoke(DispatcherPriority priority, Delegate method, object arg, params object[] args) - { - if (!this.uiThreadDispatcher.HasShutdownStarted) - { - this.uiThreadDispatcher.Invoke(priority, method, arg, args); - } - } - } -} - diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/UserInterface/FocusScopeManager.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/UserInterface/FocusScopeManager.cs deleted file mode 100644 index fad5c221d0a..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/UserInterface/FocusScopeManager.cs +++ /dev/null @@ -1,448 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\UserInterface -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.UserInterface -{ - using System; - using System.Collections.Generic; - using System.Diagnostics; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Input; - using System.Windows.Controls.Primitives; - using System.Windows.Threading; - using System.Windows.Media; - using System.Runtime; - using System.Diagnostics.CodeAnalysis; - using System.Activities.Presentation; - - internal delegate void ReturnFocusCallback(); - - internal class FocusScopeManager - { - public static readonly DependencyProperty FocusScopePriorityProperty; - public static readonly DependencyProperty AllowedFocusProperty = DependencyProperty.RegisterAttached("AllowedFocus", typeof(bool), typeof(FocusScopeManager), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.Inherits, new PropertyChangedCallback(FocusScopeManager.AllowedFocusChanged))); - - private static int DefaultFocusScopePriority; - - private static FocusScopeManager instance; - - private bool listContainsDeadReferences = false; - private List scopes = new List(); - // Has a value when a managed focus scope has keyboard focus within it. Null otherwise - private WeakReference activeManagedFocusScope = null; - - private bool denyNextFocusChange = false; - // Only set to true if we are handling a mouse event while we are denyNextFocusChange is true - private bool handlingPointerButtonEvent = false; - - ReturnFocusCallback returnFocusCallback; - - [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")] - static FocusScopeManager() - { - // Must do this explicitly because the default value of the FocusScopePriorityProperty depends on DefaultFocusScopePriority being properly initialized. - FocusScopeManager.DefaultFocusScopePriority = Int32.MaxValue; - FocusScopeManager.FocusScopePriorityProperty = DependencyProperty.RegisterAttached("FocusScopePriority", typeof(int), typeof(FocusScopeManager), new FrameworkPropertyMetadata(FocusScopeManager.DefaultFocusScopePriority, new PropertyChangedCallback(FocusScopeManager.FocusScopePriorityChanged))); - FocusManager.FocusedElementProperty.OverrideMetadata(typeof(FrameworkElement), new PropertyMetadata(null, null, new CoerceValueCallback(FocusScopeManager.FocusManager_CoerceFocusedElement))); - } - - private FocusScopeManager() - { - } - - public static FocusScopeManager Instance - { - get - { - if (FocusScopeManager.instance == null) - { - FocusScopeManager.instance = new FocusScopeManager(); - EventManager.RegisterClassHandler(typeof(Window), Keyboard.GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(FocusScopeManager.HandleGotKeyboardFocusEvent), true); - EventManager.RegisterClassHandler(typeof(Popup), Keyboard.GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(FocusScopeManager.HandleGotKeyboardFocusEvent), true); - - EventManager.RegisterClassHandler(typeof(Window), Keyboard.PreviewGotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(FocusScopeManager.HandlePreviewGotKeyboardFocus), true); - EventManager.RegisterClassHandler(typeof(Popup), Keyboard.PreviewGotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(FocusScopeManager.HandlePreviewGotKeyboardFocus), true); - } - return FocusScopeManager.instance; - } - } - - public static bool HasInstance - { - get - { - return FocusScopeManager.instance != null; - } - } - - // - // Sets the callback that will be called when the FocusScopeManager - // wants to return focus from a control that should not have it. - // Clients can use this to override the default behavior here which - // is to set keyboard focus to null. - // - public ReturnFocusCallback ReturnFocusCallback - { - get { return this.returnFocusCallback; } - set - { - Fx.Assert(this.returnFocusCallback == null, "Cannot set the ReturnFocusCallback more than once per Process"); - if (this.returnFocusCallback == null) - { - this.returnFocusCallback = value; - } - } - } - - private UIElement ActiveManagedFocusScope - { - get - { - if (this.activeManagedFocusScope != null && this.activeManagedFocusScope.IsAlive) - { - return this.activeManagedFocusScope.Target as UIElement; - } - return null; - } - set - { - if (this.activeManagedFocusScope == null) - { - this.activeManagedFocusScope = new WeakReference(value); - } - else - { - this.activeManagedFocusScope.Target = value; - } - } - } - - private bool ShouldDenyFocusChange - { - get - { - return this.denyNextFocusChange && !this.handlingPointerButtonEvent; - } - } - - private static void HandleGotKeyboardFocusEvent(object sender, KeyboardFocusChangedEventArgs e) - { - SetFocusToFocusScope(e.NewFocus); - } - - private static void HandlePreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) - { - if (FocusScopeManager.Instance.ShouldDenyFocusChange) - { - e.Handled = true; - return; - } - - DependencyObject newFocusObject = e.NewFocus as DependencyObject; - // if there is a newly focused object and it is not allowed focus - if (newFocusObject != null && !FocusScopeManager.GetAllowedFocus(newFocusObject)) - { - // Push focus back to the client's desired focus sink and cancel the change - // of focus to new focus. - FocusScopeManager.Instance.ReturnFocus(); - e.Handled = true; - } - } - - public static void SetFocusToFocusScope(IInputElement newFocus) - { - UIElement newElementFocus = newFocus as UIElement; - if (newElementFocus != null) - { - UIElement focusScope = FocusManager.GetFocusScope(newElementFocus) as UIElement; - int priority = FocusScopeManager.GetFocusScopePriority(focusScope); - if (priority != FocusScopeManager.DefaultFocusScopePriority) - { - FocusScopeManager.Instance.OnScopeKeyboardFocusChanged(focusScope, priority); - } - } - } - - public static void DenyNextFocusChange() - { - FocusScopeManager.Instance.denyNextFocusChange = true; - InputManager.Current.PreNotifyInput += new NotifyInputEventHandler(FocusScopeManager.Instance.InputManager_PreNotifyInput); - InputManager.Current.PostNotifyInput += new NotifyInputEventHandler(FocusScopeManager.Instance.InputManager_PostNotifyInput); - - UIThreadDispatcher.Instance.BeginInvoke(DispatcherPriority.Normal, new DispatcherOperationCallback(delegate - { - // guard against the focus Scope manager going null. - if (FocusScopeManager.HasInstance) - { - FocusScopeManager.Instance.EndDenyNextFocusChange(); - } - return null; - } - ), null); - } - - private void EndDenyNextFocusChange() - { - this.denyNextFocusChange = false; - this.handlingPointerButtonEvent = false; - InputManager.Current.PreNotifyInput -= new NotifyInputEventHandler(this.InputManager_PreNotifyInput); - InputManager.Current.PostNotifyInput -= new NotifyInputEventHandler(this.InputManager_PostNotifyInput); - } - - private bool IsPointerButtonEventItem(StagingAreaInputItem stagingItem) - { - return stagingItem != null && (stagingItem.Input as MouseButtonEventArgs != null || stagingItem.Input as StylusButtonEventArgs != null); - } - - private void InputManager_PreNotifyInput(object sender, NotifyInputEventArgs e) - { - if (this.IsPointerButtonEventItem(e.StagingItem)) - { - this.handlingPointerButtonEvent = true; - } - } - - private void InputManager_PostNotifyInput(object sender, NotifyInputEventArgs e) - { - if (this.IsPointerButtonEventItem(e.StagingItem)) - { - this.handlingPointerButtonEvent = false; - } - } - - public static void SetFocusScopePriority(DependencyObject element, int value) - { - if (element == null) - { - throw FxTrace.Exception.ArgumentNull("element"); - } - if (!FocusManager.GetIsFocusScope(element)) - { - throw FxTrace.Exception.AsError(new ArgumentException(ExceptionStringTable.CanOnlySetFocusScopePriorityOnAnElementThatIsAFocusScope)); - } - element.SetValue(FocusScopeManager.FocusScopePriorityProperty, value); - } - - public static int GetFocusScopePriority(DependencyObject element) - { - if (element == null) - { - throw FxTrace.Exception.ArgumentNull("element"); - } - return (int)element.GetValue(FocusScopeManager.FocusScopePriorityProperty); - } - - public static void SetAllowedFocus(DependencyObject element, bool value) - { - if (element == null) - { - throw FxTrace.Exception.ArgumentNull("element"); - } - element.SetValue(FocusScopeManager.AllowedFocusProperty, value); - } - - public static bool GetAllowedFocus(DependencyObject element) - { - if (element == null) - { - throw FxTrace.Exception.ArgumentNull("element"); - } - return (bool)element.GetValue(FocusScopeManager.AllowedFocusProperty); - } - - private static void FocusScopePriorityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - FocusScopeManager.Instance.UpdateFocusScopePriorityForElement(d as UIElement, (int)e.OldValue, (int)e.NewValue); - } - - private static object FocusManager_CoerceFocusedElement(DependencyObject d, object value) - { - UIElement scope = d as UIElement; - if (scope != null) - { - return FocusScopeManager.Instance.CoerceFocusedElement(value); - } - return value; - } - - private static void AllowedFocusChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - FrameworkElement element = d as FrameworkElement; - if (element != null) - { - bool newValue = (bool)e.NewValue; - FocusScopeManager.Instance.OnAllowedFocusChanged(element, newValue); - } - } - - private void UpdateFocusScopePriorityForElement(UIElement element, int oldValue, int newValue) - { - // If we had an index before - if (oldValue != FocusScopeManager.DefaultFocusScopePriority) - { - this.RemoveScope(element); - } - - // If we now have an index - if (newValue != FocusScopeManager.DefaultFocusScopePriority) - { - int startIndex = this.FindStartIndexForPriority(newValue); - // No ordering within priorities - this.InsertScope(startIndex, element); - } - } - - private object CoerceFocusedElement(object newFocus) - { - UIElement newFocusElement = newFocus as UIElement; - if (newFocusElement != null) - { - // If we have been told to deny the next focus change then do so - if (this.ShouldDenyFocusChange) - { - this.EndDenyNextFocusChange(); - return DependencyProperty.UnsetValue; - } - - // Don't allow logical focus to go to elements that are not focusable. - if (newFocus != null && !FocusScopeManager.GetAllowedFocus(newFocusElement)) - { - return DependencyProperty.UnsetValue; - } - } - return newFocus; - } - - private void OnAllowedFocusChanged(FrameworkElement element, bool newValue) - { - if (newValue == false && element.IsKeyboardFocused) - { - this.ReturnFocus(); - } - } - - private void OnScopeKeyboardFocusChanged(UIElement focusScope, int priority) - { - if (focusScope != this.ActiveManagedFocusScope) - { - // Make sure that the passed focus scope is managed - - int startIndex = this.FindStartIndexForPriority(priority); - - if (!this.IsFocusScopeManaged(focusScope, priority, startIndex)) - { - return; - } - for (int curScopeIndex = startIndex; curScopeIndex < this.scopes.Count; curScopeIndex++) - { - WeakReference curRef = this.scopes[curScopeIndex]; - if (curRef.IsAlive) - { - UIElement curScope = (UIElement)curRef.Target; - if (curScope != focusScope) - { - FocusManager.SetFocusedElement(curScope, null); - } - } - else - { - this.listContainsDeadReferences = true; - } - } - - this.CleanUpDeadReferences(); - - this.ActiveManagedFocusScope = focusScope; - } - } - - private bool IsFocusScopeManaged(UIElement focusScope, int priority, int priorityStartIndex) - { - for (int curScopeIndex = priorityStartIndex; curScopeIndex < this.scopes.Count; curScopeIndex++) - { - WeakReference curRef = this.scopes[curScopeIndex]; - if (curRef.IsAlive) - { - UIElement curTarget = (UIElement)curRef.Target; - if (FocusScopeManager.GetFocusScopePriority(curTarget) > priority) - { - return false; - } - if (curTarget == focusScope) - { - return true; - } - } - } - return false; - } - - private void CleanUpDeadReferences() - { - if (this.listContainsDeadReferences) - { - for (int curRefIndex = this.scopes.Count - 1; curRefIndex >= 0; curRefIndex--) - { - if (!this.scopes[curRefIndex].IsAlive) - { - this.scopes.RemoveAt(curRefIndex); - } - } - this.listContainsDeadReferences = false; - } - } - - private int FindStartIndexForPriority(int priority) - { - int startIndex = 0; - for (; startIndex < this.scopes.Count; startIndex++) - { - WeakReference curRef = this.scopes[startIndex]; - if (curRef.IsAlive) - { - if (FocusScopeManager.GetFocusScopePriority((UIElement)curRef.Target) >= priority) - { - break; - } - } - else - { - this.listContainsDeadReferences = true; - } - } - - return startIndex; - } - - private void InsertScope(int index, UIElement scope) - { - this.scopes.Insert(index, new WeakReference(scope)); - } - - private void RemoveScope(UIElement scope) - { - for (int curScopeIndex = this.scopes.Count - 1; curScopeIndex >= 0; curScopeIndex--) - { - WeakReference curRef = this.scopes[curScopeIndex]; - if (!curRef.IsAlive || curRef.Target == scope) - { - this.scopes.RemoveAt(curScopeIndex); - } - } - } - - private void ReturnFocus() - { - if (this.ReturnFocusCallback != null) - { - this.ReturnFocusCallback(); - } - else - { - Keyboard.Focus(null); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/ChoiceEditor.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/ChoiceEditor.cs deleted file mode 100644 index 92992285fa8..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/ChoiceEditor.cs +++ /dev/null @@ -1,1236 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\ValueEditors -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.ValueEditors -{ - using System; - using System.Text; - using System.Collections; - using System.ComponentModel; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - using System.Windows.Input; - using System.Windows.Media; - using System.Windows.Controls.Primitives; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data; - using System.Runtime; - - // - // Determines the view type of the choice editor. - // Combo - a combo box - // Buttons - a set of radio buttons with icons - // ToggleButtons - a set of radio buttons with icons that use the ToggleIcon style, which allows separate active and inactive icons. - // Toggle - a single toggle, good for values that have only two choices, like Boolean - // - internal enum ChoiceEditorViewType - { - Combo, - Buttons, - ToggleButtons, - Toggle - } - // - // A ChoiceEditor selects a single item from a list of choices. Think combobox or set of radio buttons. - // - internal class ChoiceEditor : Control, INotifyPropertyChanged, IIconProvider - { - public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(ChoiceEditor), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, new PropertyChangedCallback(ChoiceEditor.ValueChanged), null, false, UpdateSourceTrigger.Explicit)); - public static readonly DependencyProperty ValueIndexProperty = DependencyProperty.Register("ValueIndex", typeof(int), typeof(ChoiceEditor), new FrameworkPropertyMetadata(-1, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, new PropertyChangedCallback(ChoiceEditor.ValueIndexChanged))); - public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(ChoiceEditor), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(ChoiceEditor.ItemsSourceChanged))); - public static readonly DependencyProperty ConverterProperty = DependencyProperty.Register("Converter", typeof(TypeConverter), typeof(ChoiceEditor), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.None)); - - public static readonly DependencyProperty ViewTypeProperty = DependencyProperty.Register("ViewType", typeof(ChoiceEditorViewType), typeof(ChoiceEditor), new FrameworkPropertyMetadata(ChoiceEditorViewType.Combo, FrameworkPropertyMetadataOptions.AffectsRender)); - public static readonly DependencyProperty IsEditableProperty = DependencyProperty.Register("IsEditable", typeof(bool), typeof(ChoiceEditor), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(ChoiceEditor.IsEditableChanged))); - public static readonly DependencyProperty IconResourcePrefixProperty = DependencyProperty.Register("IconResourcePrefix", typeof(string), typeof(ChoiceEditor), new FrameworkPropertyMetadata(null)); - public static readonly DependencyProperty IconResourceSuffixProperty = DependencyProperty.Register("IconResourceSuffix", typeof(string), typeof(ChoiceEditor), new FrameworkPropertyMetadata("Icon")); - public static readonly DependencyProperty IsNinchedProperty = DependencyProperty.Register("IsNinched", typeof(bool), typeof(ChoiceEditor), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(ChoiceEditor.IsNinchedChanged))); - public static readonly DependencyProperty ShowFullControlProperty = DependencyProperty.Register("ShowFullControl", typeof(bool), typeof(ChoiceEditor), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender, null, new CoerceValueCallback(ChoiceEditor.CoerceShowFullControl))); - public static readonly DependencyProperty ItemTemplateProperty = DependencyProperty.Register("ItemTemplate", typeof(DataTemplate), typeof(ChoiceEditor), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender, new PropertyChangedCallback(ChoiceEditor.ItemTemplateChanged))); - public static readonly DependencyProperty ItemTemplateSelectorProperty = DependencyProperty.Register("ItemTemplateSelector", typeof(DataTemplateSelector), typeof(ChoiceEditor), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender, new PropertyChangedCallback(ChoiceEditor.ItemTemplateSelectorChanged))); - public static readonly DependencyProperty UseItemTemplateForSelectionProperty = DependencyProperty.Register("UseItemTemplateForSelection", typeof(Nullable), typeof(ChoiceEditor), new FrameworkPropertyMetadata(null, null, new CoerceValueCallback(ChoiceEditor.CoerceUseItemTemplateForSelection))); - - public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(double), typeof(ChoiceEditor), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.AffectsRender)); - public static readonly DependencyProperty DropButtonInsetProperty = DependencyProperty.Register("DropButtonInset", typeof(Thickness), typeof(ChoiceEditor), new FrameworkPropertyMetadata(new Thickness(), FrameworkPropertyMetadataOptions.AffectsRender)); - public static readonly DependencyProperty TextAreaInsetProperty = DependencyProperty.Register("TextAreaInset", typeof(Thickness), typeof(ChoiceEditor), new FrameworkPropertyMetadata(new Thickness(), FrameworkPropertyMetadataOptions.AffectsRender)); - public static readonly DependencyProperty DropButtonBrushProperty = DependencyProperty.Register("DropButtonBrush", typeof(Brush), typeof(ChoiceEditor), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender)); - public static readonly DependencyProperty InnerCornerRadiusProperty = DependencyProperty.Register("InnerCornerRadius", typeof(double), typeof(ChoiceEditor), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.AffectsRender)); - public static readonly DependencyProperty ButtonIconProperty = DependencyProperty.Register("ButtonIcon", typeof(ImageSource), typeof(ChoiceEditor), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender)); - public static readonly DependencyProperty IconWidthProperty = DependencyProperty.Register("IconWidth", typeof(double), typeof(ChoiceEditor), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.AffectsRender)); - public static readonly DependencyProperty IconHeightProperty = DependencyProperty.Register("IconHeight", typeof(double), typeof(ChoiceEditor), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.AffectsRender)); - - public static readonly DependencyProperty BeginCommandProperty = DependencyProperty.Register("BeginCommand", typeof(ICommand), typeof(ChoiceEditor), new PropertyMetadata(null)); - public static readonly DependencyProperty UpdateCommandProperty = DependencyProperty.Register("UpdateCommand", typeof(ICommand), typeof(ChoiceEditor), new PropertyMetadata(null)); - public static readonly DependencyProperty CancelCommandProperty = DependencyProperty.Register("CancelCommand", typeof(ICommand), typeof(ChoiceEditor), new PropertyMetadata(null)); - public static readonly DependencyProperty CommitCommandProperty = DependencyProperty.Register("CommitCommand", typeof(ICommand), typeof(ChoiceEditor), new PropertyMetadata(null)); - public static readonly DependencyProperty FinishEditingCommandProperty = DependencyProperty.Register("FinishEditingCommand", typeof(ICommand), typeof(ChoiceEditor), new PropertyMetadata(null)); - - public static readonly DependencyProperty ComboBoxLoadingCursorProperty = DependencyProperty.Register("ComboBoxLoadingCursor", typeof(Cursor), typeof(ChoiceEditor), new PropertyMetadata(null)); - - // WORKAROUND this property is used in combination with a trigger to kick the combobox when it clears its bindings Avalon bug: 1756023 - public static readonly DependencyProperty ForceBindingProperty = DependencyProperty.Register("ForceBinding", typeof(bool), typeof(ChoiceEditor), new FrameworkPropertyMetadata(false)); - - - // True if the user is editing the text in an editable combo - private bool isTextEditing = false; - // True if the user is selecting a value (e.g. in a combo when the dropdown is open) - private bool isSelectingValue = false; - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - BEGIN - // ################################################### - - // True if the full editor is being shown - private bool isShowingFullEditor = false; - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - END - // ################################################### - - // Used to lock out internal changes. Do not change this directly. Use Begin/EndIgnoreInternalChangeBlock - private int internalChangeLockCount = 0; - // Used to not set commit action = lost focus when cancelling an edit - private int internalStringValueChangeLockCount = 0; - // True if changes to value should be ignored. - private bool ignoreValueChanges = false; - - // Action to take when this control looses focus - private LostFocusAction lostFocusAction = LostFocusAction.None; - // The selected item of the internal selector. Used to determine Value - private object internalValue = null; - // The string value of the internal selector if it allows text editing - private string internalStringValue = String.Empty; - - // A Collection view over the ItemsSource that we have been passed - private CollectionView collectionView = null; - - [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] - public ChoiceEditor() - { - this.CoerceValue(ChoiceEditor.UseItemTemplateForSelectionProperty); - } - public event PropertyChangedEventHandler PropertyChanged; - - // - // The currently selected choice - // - public object Value - { - get { return this.GetValue(ChoiceEditor.ValueProperty); } - set { this.SetValue(ChoiceEditor.ValueProperty, value); } - } - - // - // The index of the selected choice. -1 if Value is not in the list. - // - public int ValueIndex - { - get { return (int)this.GetValue(ChoiceEditor.ValueIndexProperty); } - set { this.SetValue(ChoiceEditor.ValueIndexProperty, value); } - } - - // - // The items source used to populate the choice - // - public IEnumerable ItemsSource - { - get { return (IEnumerable)this.GetValue(ChoiceEditor.ItemsSourceProperty); } - set { this.SetValue(ChoiceEditor.ItemsSourceProperty, value); } - } - - // - // Converter used to convert text values to object values. - // - public TypeConverter Converter - { - get { return (TypeConverter)this.GetValue(ChoiceEditor.ConverterProperty); } - set { this.SetValue(ChoiceEditor.ConverterProperty, value); } - } - - // - // Sets the view type of this choice. This will change the behavior of the choice. - // - public ChoiceEditorViewType ViewType - { - get { return (ChoiceEditorViewType)this.GetValue(ChoiceEditor.ViewTypeProperty); } - set { this.SetValue(ChoiceEditor.ViewTypeProperty, value); } - } - - // - // Set to true if this choice editor should be editable. Currently only works for Combo - // - public bool IsEditable - { - get { return (bool)this.GetValue(ChoiceEditor.IsEditableProperty); } - set { this.SetValue(ChoiceEditor.IsEditableProperty, value); } - } - - // - // The prefix put on all icon resource references before they are looked up - // - public string IconResourcePrefix - { - get { return (string)this.GetValue(ChoiceEditor.IconResourcePrefixProperty); } - set { this.SetValue(ChoiceEditor.IconResourcePrefixProperty, value); } - } - - // - // The prefix put on all icon resource references before they are looked up - // - public string IconResourceSuffix - { - get { return (string)this.GetValue(ChoiceEditor.IconResourceSuffixProperty); } - set { this.SetValue(ChoiceEditor.IconResourceSuffixProperty, value); } - } - - // - // True if this value editor is ninched - // - public bool IsNinched - { - get { return (bool)this.GetValue(ChoiceEditor.IsNinchedProperty); } - set { this.SetValue(ChoiceEditor.IsNinchedProperty, value); } - } - - // - // True to show the full control instead of the optimized drawing of the control - // - public bool ShowFullControl - { - get { return (bool)this.GetValue(ChoiceEditor.ShowFullControlProperty); } - set { this.SetValue(ChoiceEditor.ShowFullControlProperty, value); } - } - - public DataTemplate ItemTemplate - { - get { return (DataTemplate)this.GetValue(ChoiceEditor.ItemTemplateProperty); } - set { this.SetValue(ChoiceEditor.ItemTemplateProperty, value); } - } - - public DataTemplateSelector ItemTemplateSelector - { - get { return (DataTemplateSelector)this.GetValue(ChoiceEditor.ItemTemplateSelectorProperty); } - set { this.SetValue(ChoiceEditor.ItemTemplateSelectorProperty, value); } - } - - public bool UseItemTemplateForSelection - { - get { return (bool)this.GetValue(ChoiceEditor.UseItemTemplateForSelectionProperty); } - set { this.SetValue(ChoiceEditor.UseItemTemplateForSelectionProperty, value); } - } - - public double BorderCornerRadius - { - get { return (double)this.GetValue(ChoiceEditor.BorderCornerRadiusProperty); } - set { this.SetValue(ChoiceEditor.BorderCornerRadiusProperty, value); } - } - - public Thickness DropButtonInset - { - get { return (Thickness)this.GetValue(ChoiceEditor.DropButtonInsetProperty); } - set { this.SetValue(ChoiceEditor.DropButtonInsetProperty, value); } - } - - public Thickness TextAreaInset - { - get { return (Thickness)this.GetValue(ChoiceEditor.TextAreaInsetProperty); } - set { this.SetValue(ChoiceEditor.TextAreaInsetProperty, value); } - } - - public Brush DropButtonBrush - { - get { return (Brush)this.GetValue(ChoiceEditor.DropButtonBrushProperty); } - set { this.SetValue(ChoiceEditor.DropButtonBrushProperty, value); } - } - - public double InnerCornerRadius - { - get { return (double)this.GetValue(ChoiceEditor.InnerCornerRadiusProperty); } - set { this.SetValue(ChoiceEditor.InnerCornerRadiusProperty, value); } - } - - public ImageSource ButtonIcon - { - get { return (ImageSource)this.GetValue(ChoiceEditor.ButtonIconProperty); } - set { this.SetValue(ChoiceEditor.ButtonIconProperty, value); } - } - - public double IconWidth - { - get { return (double)this.GetValue(ChoiceEditor.IconWidthProperty); } - set { this.SetValue(ChoiceEditor.IconWidthProperty, value); } - } - - public double IconHeight - { - get { return (double)this.GetValue(ChoiceEditor.IconHeightProperty); } - set { this.SetValue(ChoiceEditor.IconHeightProperty, value); } - } - - // - // Command fired when editing begins - // - public ICommand BeginCommand - { - get { return (ICommand)this.GetValue(ChoiceEditor.BeginCommandProperty); } - set { this.SetValue(ChoiceEditor.BeginCommandProperty, value); } - } - - // - // Command fired when an edit value is updated. This command will fire after the - // binding has been updated. - // - public ICommand UpdateCommand - { - get { return (ICommand)this.GetValue(ChoiceEditor.UpdateCommandProperty); } - set { this.SetValue(ChoiceEditor.UpdateCommandProperty, value); } - } - - // - // Command fired when an edit is canceled - // - public ICommand CancelCommand - { - get { return (ICommand)this.GetValue(ChoiceEditor.CancelCommandProperty); } - set { this.SetValue(ChoiceEditor.CancelCommandProperty, value); } - } - - // - // Command fired when an edit is commited - // - public ICommand CommitCommand - { - get { return (ICommand)this.GetValue(ChoiceEditor.CommitCommandProperty); } - set { this.SetValue(ChoiceEditor.CommitCommandProperty, value); } - } - - // - // Command fired when the editor is done editing. At this point the host - // may decide to move on to the next property in the list, return focus - // to the design surface, or perform any other action it pleases to do. - // - public ICommand FinishEditingCommand - { - get { return (ICommand)this.GetValue(ChoiceEditor.FinishEditingCommandProperty); } - set { this.SetValue(ChoiceEditor.FinishEditingCommandProperty, value); } - } - - // - // True if cursor should be an hourglass when loading a ComboBox popup - // - public Cursor ComboBoxLoadingCursor - { - get { return (Cursor)this.GetValue(ChoiceEditor.ComboBoxLoadingCursorProperty); } - set { this.SetValue(ChoiceEditor.ComboBoxLoadingCursorProperty, value); } - } - - // - // Command to rotate the selection of the ChoiceEditor to the next possible item - // or cycle to the first if at the end of the current view. - // - public ICommand NextValueCommand - { - get - { - return new DelegateCommand(new DelegateCommand.SimpleEventHandler(SelectNextValue)); - } - } - - // - // Command to rotate the selection of the ChoiceEditor the previously selected - // item in the view, or to the last item in the view if at the first item in the view. - // - public ICommand PreviousValueCommand - { - get - { - return new DelegateCommand(new DelegateCommand.SimpleEventHandler(SelectPreviousValue)); - } - } - - public bool ForceBinding - { - get { return (bool)this.GetValue(ChoiceEditor.ForceBindingProperty); } - set { this.SetValue(ChoiceEditor.ForceBindingProperty, value); } - } - - // - // This is the value internal to this control. Controls in the - // template of this control should bind to this. - // - public object InternalValue - { - get - { - return this.internalValue; - } - set - { - if (this.internalValue != value) - { - this.internalValue = value; - if (this.ShouldCommitInternalValueChanges) - { - if (!this.isTextEditing) - { - this.CommitChange(); - } - else - { - this.lostFocusAction = LostFocusAction.Commit; - } - } - this.SendPropertyChanged("InternalValue"); - } - } - } - - public string InternalStringValue - { - get { return this.internalStringValue; } - set - { - if (!String.Equals(value, this.internalStringValue)) - { - if (this.ShouldCommitInternalStringValueChanges && this.isTextEditing) - { - this.InternalValue = null; - this.lostFocusAction = LostFocusAction.Commit; - } - this.internalStringValue = value; - this.SendPropertyChanged("InternalStringValue"); - } - } - } - - public bool InternalIsSelectingValue - { - get { return this.isSelectingValue; } - set - { - if (this.isSelectingValue != value) - { - this.isSelectingValue = value; - - if (this.isTextEditing && !this.isSelectingValue) - { - // - // * FinishedEditingCommand in Cider does not - // * move focus off of the control (as we do in Sparkle) The fix is to add code to - // * InternalIsSelectingValue when the value goes to false (when the popup is closing) - // * that checks to see if there is a lostFocusAction of Commit and if so calls CommitChange()// - LostFocusAction oldAction = this.lostFocusAction; - this.lostFocusAction = LostFocusAction.None; - if (oldAction == LostFocusAction.Commit) - { - this.CommitChange(); - } - this.OnFinishEditing(); - } - if (this.isSelectingValue && this.CollectionView != null) - { - this.BeginIgnoreExternalValueChangeBlock(); - try - { - this.ValueIndex = this.CollectionView.IndexOf(this.Value); - } - finally - { - this.EndIgnoreExternalValueChangeBlock(); - } - } - Cursor loadingCursor = this.ComboBoxLoadingCursor; - if (value && this.ViewType == ChoiceEditorViewType.Combo && loadingCursor != null) - { - bool foundPopup = false; - Mouse.OverrideCursor = loadingCursor; - ComboBox comboBox = this.Template.FindName("PART_Combo", this) as ComboBox; - if (comboBox != null) - { - Popup popup = comboBox.Template.FindName("PART_Popup", comboBox) as Popup; - if (popup != null) - { - foundPopup = true; - popup.Opened += new EventHandler(OnPopupLoaded); - } - } - if (!foundPopup) - { - // if we couldn't set up the event handler, just return - // the cursor now so they aren't stuck with an hourglass - Mouse.OverrideCursor = null; - } - } - } - } - } - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - BEGIN - // ################################################### - - private CollectionView CollectionView - { - get { - if (collectionView == null) - { - IEnumerable newItems = this.ItemsSource; - if (newItems != null) - { - this.collectionView = new CollectionView(this.ItemsSource); - } - else - { - this.collectionView = null; - } - } - return collectionView; - } - } - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - END - // ################################################### - - private bool ShouldCommitInternalValueChanges - { - get { return this.internalChangeLockCount == 0; } - } - - private bool ShouldCommitInternalStringValueChanges - { - get { return this.internalStringValueChangeLockCount == 0; } - } - - private bool ShouldIgnoreExternalValueChanges - { - get { return this.ignoreValueChanges; } - } - - - public void SelectNextValue() - { - int currentIndex = this.ValueIndex; - - Fx.Assert(this.CollectionView != null, "ChoiceEditor CollectionView cannot be null."); - if (currentIndex < 0 || currentIndex >= this.CollectionView.Count - 1) - { - currentIndex = 0; - } - else - { - currentIndex = currentIndex + 1; - } - this.ValueIndex = currentIndex; - } - - public void SelectPreviousValue() - { - int currentIndex = this.ValueIndex; - - Fx.Assert(this.CollectionView != null, "ChoiceEditor CollectionView cannot be null."); - if (currentIndex <= 0 || currentIndex > this.CollectionView.Count - 1) - { - currentIndex = this.CollectionView.Count - 1; - } - else - { - currentIndex = currentIndex - 1; - } - this.ValueIndex = currentIndex; - } - - public ImageSource GetIconAsImageSource(object key, object parameter) - { - // This is the place to cache icons if these lookups are costing us too much. - try - { - StringBuilder sb = new StringBuilder(); - string prefix = this.IconResourcePrefix; - string suffix = this.IconResourceSuffix; - string parameterString = parameter as string; - - if (prefix != null) - { - sb.Append(prefix); - } - sb.Append(key.ToString()); - if (suffix != null) - { - sb.Append(suffix); - } - if (parameterString != null) - { - sb.Append(parameterString); - } - - object resource = this.FindResource(sb.ToString()); - ImageSource resourceImageSource = resource as ImageSource; - return resourceImageSource; - } - catch (ResourceReferenceKeyNotFoundException) - { - return null; - } - } - - private void OnPopupLoaded(object sender, EventArgs e) - { - Popup popup = sender as Popup; - - Mouse.OverrideCursor = null; - if (popup != null) - { - popup.Opened -= new EventHandler(OnPopupLoaded); - } - } - - private static void ValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - // Make sure the value actually changed - if (!object.Equals(e.OldValue, e.NewValue)) - { - ChoiceEditor choice = d as ChoiceEditor; - if (choice != null && !choice.ShouldIgnoreExternalValueChanges) - { - choice.UpdateInternalValuesFromValue(); - } - } - } - - private static void ValueIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ChoiceEditor choice = d as ChoiceEditor; - if (choice != null && !choice.ShouldIgnoreExternalValueChanges) - { - choice.UpdateInternalValuesFromValueIndex(); - choice.UpdateValueFromInternalValues(); - } - } - - private static void ItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ChoiceEditor choice = d as ChoiceEditor; - if (choice != null) - { - choice.ItemsSourceChanged(); - } - } - - private static void IsEditableChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - // Make sure that the internal values are up to date now that we know we are editable or not. - ChoiceEditor choice = d as ChoiceEditor; - if (choice != null && !choice.ShouldIgnoreExternalValueChanges) - { - choice.UpdateInternalValuesFromValue(); - } - } - - private static void IsNinchedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ChoiceEditor choice = d as ChoiceEditor; - if (choice != null && !choice.ShouldIgnoreExternalValueChanges) - { - choice.UpdateInternalValuesFromValue(); - } - } - - private static object CoerceShowFullControl(DependencyObject target, object value) - { - ChoiceEditor choice = target as ChoiceEditor; - if (choice != null && value is bool) - { - bool boolValue = (bool)value; - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - BEGIN - // ################################################### - - choice.isShowingFullEditor = boolValue; - choice.CheckUpdateValueIndex(false); - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - END - // ################################################### - - // If we are text editing force the full control to stay showing. - if (!boolValue) - { - return choice.isTextEditing; - } - } - - return value; - } - - private static void ItemTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ChoiceEditor choice = d as ChoiceEditor; - if (choice != null) - { - choice.CoerceValue(ChoiceEditor.UseItemTemplateForSelectionProperty); - } - } - - private static void ItemTemplateSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ChoiceEditor choice = d as ChoiceEditor; - if (choice != null) - { - choice.CoerceValue(ChoiceEditor.UseItemTemplateForSelectionProperty); - } - } - - private static object CoerceUseItemTemplateForSelection(DependencyObject target, object value) - { - ChoiceEditor choice = target as ChoiceEditor; - if (choice != null) - { - if (value == null) - { - return choice.ItemTemplate != null || choice.ItemTemplateSelector != null; - } - } - return value; - } - - private void SendPropertyChanged(string propertyName) - { - if (this.PropertyChanged != null) - { - this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); - } - } - - protected override void OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e) - { - base.OnPreviewGotKeyboardFocus(e); - FrameworkElement element = e.NewFocus as FrameworkElement; - if (element != null && element.Name.Equals("PART_EditableTextBox", StringComparison.Ordinal)) - { - this.isTextEditing = true; - } - } - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - BEGIN - // ################################################### - // CIDER needs to override the Keydown behavior : - // - // * The problem here is just a difference in expectation for control behavior - // * between the two products (CIDER AND BLEND). The fix is entirely in OnPreviewKeyDown - // * a. Remove the condition that we handle navigation keys only when the popup is open - // * b. Add logic that forces a commit when a navigation happens (you could optionally only do the commit when the popup is closed, but I�m not sure what the desired behavior is here). You may or may not want to limit this behavior to editable ChoiceEditors as well.// - - protected override void OnPreviewKeyDown(KeyEventArgs e) - { - bool commitChange = false; - bool finishEditing = false; - - bool markHandled = ValueEditorUtils.GetHandlesCommitKeys(this); - - if (e.Key == Key.Return || e.Key == Key.Enter) - { - e.Handled |= markHandled; - - commitChange = true; - - finishEditing = (e.KeyboardDevice.Modifiers & ModifierKeys.Shift) == 0; - //Hide dropdown on excape key - HideDropDown(); - } - else if (e.Key == Key.Escape) - { - e.Handled |= markHandled; - - LostFocusAction savedAction = this.lostFocusAction; - this.lostFocusAction = LostFocusAction.None; - if (savedAction != LostFocusAction.None) - { - this.CancelChange(); - } - - //Hide dropdown on excape key - HideDropDown(); - this.OnFinishEditing(); - } - // Only pay attention to navigation keys if we are selecting a value from the popup - if (this.CollectionView != null && !this.CollectionView.IsEmpty) - { - bool navigated = false; - if (e.Key == Key.Up || (!this.IsEditable && e.Key == Key.Left)) - { - this.SelectPreviousValue(); - navigated = true; - } - else if (e.Key == Key.Down || (!this.IsEditable && e.Key == Key.Right)) - { - this.SelectNextValue(); - navigated = true; - } - else if (!this.IsEditable && e.Key == Key.Home) - { - this.ValueIndex = 0; - navigated = true; - } - else if (!this.IsEditable && e.Key == Key.End) - { - this.ValueIndex = this.CollectionView.Count - 1; - navigated = true; - } - - if (navigated) - { - this.lostFocusAction = LostFocusAction.Commit; - e.Handled = true; - ComboBox comboBox = this.Template.FindName("_comboChoiceEditor", this) as ComboBox; - if (!comboBox.IsDropDownOpen) - { - commitChange = true; - } - } - } - - if (commitChange) - { - LostFocusAction savedAction = this.lostFocusAction; - this.lostFocusAction = LostFocusAction.None; - if (savedAction == LostFocusAction.Commit) - { - this.CommitChange(); - } - } - if (finishEditing) - { - this.OnFinishEditing(); - } - base.OnPreviewKeyDown(e); - } - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - END - // ################################################### - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - BEGIN - // ################################################### - private void HideDropDown() - { - ComboBox comboBox = this.Template.FindName("_comboChoiceEditor", this) as ComboBox; - if (comboBox != null && comboBox.IsDropDownOpen) - { - comboBox.IsDropDownOpen = false; - } - } - - // When the focus is lost by clicking ouside the choice-editor - // we dont get a preview message. - // The string edtior has OnLostKeyboardFocus and hence we imitate the - // same behavior. - protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e) - { - base.OnLostKeyboardFocus(e); - - FrameworkElement element = e.OldFocus as FrameworkElement; - if (element != null && element.Name.Equals("PART_EditableTextBox", StringComparison.Ordinal)) - { - this.HandleLostFocus(); - } - } - // ################################################# - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - END - // ################################################# - - - protected override void OnPreviewLostKeyboardFocus(KeyboardFocusChangedEventArgs e) - { - base.OnPreviewLostKeyboardFocus(e); - FrameworkElement element = e.OldFocus as FrameworkElement; - if (element != null && element.Name.Equals("PART_EditableTextBox", StringComparison.Ordinal)) - { - this.HandleLostFocus(); - } - } - - private void HandleLostFocus() - { - if (this.isTextEditing) - { - LostFocusAction oldLostFocusAction = this.lostFocusAction; - this.lostFocusAction = LostFocusAction.None; - this.isTextEditing = false; - - - if (oldLostFocusAction == LostFocusAction.Commit) - { - this.CommitChange(); - } - else if (oldLostFocusAction == LostFocusAction.Cancel) - { - this.CancelChange(); - } - - this.CoerceValue(ChoiceEditor.ShowFullControlProperty); - } - } - - protected override void OnRender(DrawingContext drawingContext) - { - base.OnRender(drawingContext); - if (this.ViewType == ChoiceEditorViewType.Combo && !this.ShowFullControl) - { - double borderCornerRadius = this.BorderCornerRadius; - Thickness dropButtonInset = this.DropButtonInset; - Thickness textAreaInset = this.TextAreaInset; - Brush dropButtonBrush = this.DropButtonBrush; - double innerCornerRadius = this.InnerCornerRadius; - ImageSource buttonIcon = this.ButtonIcon; - double iconWidth = this.IconWidth; - double iconHeight = this.IconHeight; - - // Draw something that looks like an Expression combo - Rect fullRect = new Rect(0d, 0d, this.ActualWidth, this.ActualHeight); - - if (RenderUtils.DrawInscribedRoundedRect(drawingContext, this.BorderBrush, null, fullRect, borderCornerRadius)) - { - Rect innerRect = RenderUtils.CalculateInnerRect(fullRect, 0); - double dropButtonLeft = (innerRect.Right > textAreaInset.Right ? innerRect.Right - textAreaInset.Right : 0d) + dropButtonInset.Left; - double dropButtonTop = innerRect.Top + dropButtonInset.Top; - double dropButtonRight = innerRect.Right - dropButtonInset.Right; - double dropButtonBottom = innerRect.Bottom - dropButtonInset.Bottom; - - RenderUtils.DrawInscribedRoundedRect(drawingContext, dropButtonBrush, null, new Rect(new Point(dropButtonLeft, dropButtonTop), new Point(dropButtonRight, dropButtonBottom)), innerCornerRadius); - if (buttonIcon != null) - { - double buttonCenterX = dropButtonLeft + (dropButtonRight - dropButtonLeft) / 2d; - double buttonCenterY = dropButtonTop + (dropButtonBottom - dropButtonTop) / 2d; - drawingContext.DrawImage(buttonIcon, new Rect(new Point(buttonCenterX - iconWidth / 2d, buttonCenterY - iconHeight / 2d), new Point(buttonCenterX + iconWidth / 2d, buttonCenterY + iconHeight / 2d))); - } - - double textAreaLeft = innerRect.Left + textAreaInset.Left; - double textAreaTop = innerRect.Top + textAreaInset.Top; - double textAreaRight = innerRect.Right > textAreaInset.Right ? innerRect.Right - textAreaInset.Right : textAreaLeft; - double textAreaBottom = innerRect.Bottom - textAreaInset.Bottom; - - RenderUtils.DrawInscribedRoundedRect(drawingContext, this.Background, null, new Rect(new Point(textAreaLeft, textAreaTop), new Point(textAreaRight, textAreaBottom)), innerCornerRadius); - } - } - } - - protected override void OnTemplateChanged(ControlTemplate oldTemplate, ControlTemplate newTemplate) - { - this.BeginNoCommitInternalValueChangeBlock(); - // WORKAROUND Turn off bindings on the internal combo while the template is udpating. This works around Avalon bug: 1756023 - this.ForceBinding = false; - base.OnTemplateChanged(oldTemplate, newTemplate); - } - - public override void OnApplyTemplate() - { - base.OnApplyTemplate(); - // WORKAROUND Force the bindings on our internal combo (if there is one) to update. This works around Avalon bug: 1756023 - this.ForceBinding = true; - - this.EndNoCommitInternalValueChangeBlock(); - - this.HandleLostFocus(); - } - - private void CommitChange() - { - ValueEditorUtils.ExecuteCommand(this.BeginCommand, this, null); - - if (this.UpdateValueFromInternalValues()) - { - // We need to update both the binding on the value property and the valueindex property - // so that the value does not bounce around when we commit. - ValueEditorUtils.UpdateBinding(this, ChoiceEditor.ValueProperty, UpdateBindingType.Source); - ValueEditorUtils.UpdateBinding(this, ChoiceEditor.ValueIndexProperty, UpdateBindingType.Source); - ValueEditorUtils.ExecuteCommand(this.CommitCommand, this, null); - ValueEditorUtils.UpdateBinding(this, ChoiceEditor.ValueProperty, UpdateBindingType.Target); - ValueEditorUtils.UpdateBinding(this, ChoiceEditor.ValueIndexProperty, UpdateBindingType.Target); - } - else - { - this.CancelStartedChange(); - } - - this.lostFocusAction = LostFocusAction.None; - } - - private void CancelChange() - { - ValueEditorUtils.ExecuteCommand(this.BeginCommand, this, null); - this.CancelStartedChange(); - } - - private void CancelStartedChange() - { - // Revert External values - ValueEditorUtils.UpdateBinding(this, ChoiceEditor.ValueProperty, UpdateBindingType.Target); - ValueEditorUtils.UpdateBinding(this, ChoiceEditor.ValueIndexProperty, UpdateBindingType.Target); - this.UpdateInternalValuesFromValue(); - ValueEditorUtils.ExecuteCommand(this.CancelCommand, this, null); - } - - private void OnFinishEditing() - { - ICommand finishedEditingCommand = this.FinishEditingCommand; - if (finishedEditingCommand != null) - { - ValueEditorUtils.ExecuteCommand(finishedEditingCommand, this, null); - } - else - { - Keyboard.Focus(null); - } - } - - private void ItemsSourceChanged() - { - // The collection just changed, so we need to make sure that things are in [....] - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - BEGIN - // ################################################### - this.collectionView = null; - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - end - // ################################################### - - this.UpdateInternalValuesFromValue(); - this.UpdateValueFromInternalValues(); - } - - private int IndexOf(object item) - { - if (this.CollectionView != null) - { - return this.CollectionView.IndexOf(item); - } - else - { - return -1; - } - } - - private object GetItemAt(int index) - { - if (this.CollectionView != null) - { - return this.CollectionView.GetItemAt(index); - } - else - { - return null; - } - } - - protected void UpdateInternalValuesFromValue() - { - this.BeginNoCommitInternalValueChangeBlock(); - this.BeginNoCommitInternalStringValueChangeBlock(); - try - { - if (!this.IsNinched) - { - this.InternalValue = this.Value; - } - else - { - this.InternalValue = null; - } - - if (this.IsEditable) - { - string newStringValue = String.Empty; - if (this.InternalValue != null && !this.IsNinched) - { - TypeConverter converter = this.Converter; - if (converter != null && converter.CanConvertFrom(this.InternalValue.GetType())) - { - newStringValue = converter.ConvertToString(this.InternalValue); - } - else - { - newStringValue = this.InternalValue.ToString(); - } - } - - this.InternalStringValue = newStringValue; - } - } - finally - { - this.EndNoCommitInternalStringValueChangeBlock(); - this.EndNoCommitInternalValueChangeBlock(); - } - } - - public void UpdateInternalValuesFromValueIndex() - { - this.BeginNoCommitInternalValueChangeBlock(); - this.BeginNoCommitInternalStringValueChangeBlock(); - try - { - this.InternalValue = this.GetItemAt(this.ValueIndex); - } - finally - { - this.EndNoCommitInternalStringValueChangeBlock(); - this.EndNoCommitInternalValueChangeBlock(); - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Propagating the error might cause VS to crash")] - [SuppressMessage("Reliability", "Reliability108", Justification = "Propagating the error might cause VS to crash")] - protected bool UpdateValueFromInternalValues() - { - this.BeginIgnoreExternalValueChangeBlock(); - try - { - if (!this.IsEditable) - { - this.Value = this.InternalValue; - } - else - { - if (this.InternalValue != null) - { - this.Value = this.InternalValue; - } - else - { - string stringValue = this.InternalStringValue; - // Try to parse a new value from the string value - if (stringValue != null) - { - TypeConverter converter = this.Converter; - object newValue = null; - if (converter != null) - { - try - { - newValue = converter.ConvertFromString(stringValue); - } - catch (Exception) - { - // Have to catch Exception here because Various of these converters (e.g. DoubleConverter) will throw it. - // Do nothing since newValue should still be null; - return false; - } - } - else - { - newValue = stringValue; - } - - this.Value = newValue; - - // At this point it is possible that the value that we just set is out of [....] with the internal value - if (newValue != this.InternalValue) - { - this.UpdateInternalValuesFromValue(); - } - } - } - - } - } - finally - { - this.EndIgnoreExternalValueChangeBlock(); - } - - CheckUpdateValueIndex(true); - return true; - } - - protected void BeginNoCommitInternalValueChangeBlock() - { - this.internalChangeLockCount++; - } - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - BEGIN - // ################################################### - - // - // Updates the value index for the current value, but - // only if necessary. - // - private void CheckUpdateValueIndex(bool sourceChanged) - { - - BeginIgnoreExternalValueChangeBlock(); - try - { - // Check if we need to update the value index. - // We don't need to if we're a combo box and - // we're not showing the drop-down. - - if (ViewType != ChoiceEditorViewType.Combo || this.isShowingFullEditor) - { - if (sourceChanged || ReadLocalValue(ValueIndexProperty) == DependencyProperty.UnsetValue) - { - ValueIndex = IndexOf(Value); - } - } - else - { - ClearValue(ValueIndexProperty); - } - } - finally - { - EndIgnoreExternalValueChangeBlock(); - } - } - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - END - // ################################################### - - protected void EndNoCommitInternalValueChangeBlock() - { - this.internalChangeLockCount--; - Fx.Assert(this.internalChangeLockCount >= 0, "internalChangeLockCount should be positive"); - } - - protected void BeginNoCommitInternalStringValueChangeBlock() - { - this.internalStringValueChangeLockCount++; - } - - protected void EndNoCommitInternalStringValueChangeBlock() - { - this.internalStringValueChangeLockCount--; - Fx.Assert(this.internalStringValueChangeLockCount >= 0, "internalStringValueChangeLockCount should be positive"); - } - - protected void BeginIgnoreExternalValueChangeBlock() - { - Fx.Assert(this.ignoreValueChanges == false, "ignoreValueChanges should be false"); - this.ignoreValueChanges = true; - } - - protected void EndIgnoreExternalValueChangeBlock() - { - Fx.Assert(this.ignoreValueChanges == true, "ignoreValueChanges should be false"); - this.ignoreValueChanges = false; - } - - - enum LostFocusAction - { - None, - Commit, - Cancel - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/RenderUtils.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/RenderUtils.cs deleted file mode 100644 index 98ec4b5eb41..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/RenderUtils.cs +++ /dev/null @@ -1,54 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\ValueEditors -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.ValueEditors -{ - using System; - using System.Windows; - using System.Windows.Media; - - internal sealed class RenderUtils - { - private RenderUtils() - { - } - - public static bool DrawInscribedRoundedRect(DrawingContext drawingContext, Brush fill, Pen stroke, Rect outerBounds, double cornerRadius) - { - Point spineLeftTop = new Point(outerBounds.Left, outerBounds.Top); - Point spineRightBottom = new Point(outerBounds.Right, outerBounds.Bottom); - bool drewSomething = false; - - if (stroke != null && !Tolerances.NearZero(stroke.Thickness)) - { - double halfThickness = stroke.Thickness / 2d; - spineLeftTop.X += halfThickness; - spineLeftTop.Y += halfThickness; - spineRightBottom.X -= halfThickness; - spineRightBottom.Y -= halfThickness; - } - - Rect spineRect = new Rect(spineLeftTop, spineRightBottom); - if (!Tolerances.NearZero(spineRect.Width) && !Tolerances.NearZero(spineRect.Height)) - { - drawingContext.DrawRoundedRectangle(fill, stroke, spineRect, cornerRadius, cornerRadius); - drewSomething = true; - } - - return drewSomething; - } - - public static Rect CalculateInnerRect(Rect outerBounds, double strokeThickness) - { - if (!Tolerances.NearZero(strokeThickness)) - { - return new Rect(new Point(outerBounds.Left + strokeThickness, outerBounds.Top + strokeThickness), new Point(outerBounds.Right - strokeThickness, outerBounds.Bottom - strokeThickness)); - } - else - { - return outerBounds; - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/StringEditor.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/StringEditor.cs deleted file mode 100644 index 6a17c5d8301..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/StringEditor.cs +++ /dev/null @@ -1,376 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\ValueEditors -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.ValueEditors -{ - using System; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - using System.Windows.Documents; - using System.Windows.Input; - using System.Windows.Media; - using System.Windows.Media.Animation; - using System.Windows.Threading; - using System.Activities.Presentation.View; - - internal class StringEditor : TextBox - { - - public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(string), typeof(StringEditor), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, new PropertyChangedCallback(StringEditor.ValueChanged), null, false, UpdateSourceTrigger.PropertyChanged)); - public static readonly DependencyProperty IsNinchedProperty = DependencyProperty.Register("IsNinched", typeof(bool), typeof(StringEditor), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(StringEditor.IsNinchedChanged))); - public static readonly DependencyProperty IsEditingProperty = DependencyProperty.Register("IsEditing", typeof(bool), typeof(StringEditor), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(StringEditor.IsEditingChanged))); - - public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register("CornerRadius", typeof(double), typeof(StringEditor), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.None)); - public static readonly DependencyProperty BorderWidthProperty = DependencyProperty.Register("BorderWidth", typeof(double), typeof(StringEditor), new FrameworkPropertyMetadata(1.0, FrameworkPropertyMetadataOptions.None)); - - public static readonly DependencyProperty BeginCommandProperty = DependencyProperty.Register("BeginCommand", typeof(ICommand), typeof(StringEditor), new PropertyMetadata(null)); - public static readonly DependencyProperty CommitCommandProperty = DependencyProperty.Register("CommitCommand", typeof(ICommand), typeof(StringEditor), new PropertyMetadata(null)); - public static readonly DependencyProperty CancelCommandProperty = DependencyProperty.Register("CancelCommand", typeof(ICommand), typeof(StringEditor), new PropertyMetadata(null)); - public static readonly DependencyProperty FinishEditingCommandProperty = DependencyProperty.Register("FinishEditingCommand", typeof(ICommand), typeof(StringEditor), new PropertyMetadata(null)); - public static readonly DependencyProperty LostFocusCommandProperty = DependencyProperty.Register("LostFocusCommand", typeof(ICommand), typeof(StringEditor), new PropertyMetadata(null)); - - private LostFocusAction lostFocusAction = LostFocusAction.None; - private bool ignoreTextChanges = false; - - public StringEditor() - { - this.CommandBindings.Add(new CommandBinding( DesignerView.CommitCommand, OnDesignerViewCommitExecute)); - } - - public string Value - { - get { return (string)this.GetValue(StringEditor.ValueProperty); } - set { this.SetValue(StringEditor.ValueProperty, value); } - } - - public bool IsNinched - { - get { return (bool)this.GetValue(StringEditor.IsNinchedProperty); } - set { this.SetValue(StringEditor.IsNinchedProperty, value); } - } - - public bool IsEditing - { - get { return (bool)this.GetValue(StringEditor.IsEditingProperty); } - set { this.SetValue(StringEditor.IsEditingProperty, value); } - } - - public double CornerRadius - { - get { return (double)this.GetValue(StringEditor.CornerRadiusProperty); } - set { this.SetValue(StringEditor.CornerRadiusProperty, value); } - } - - public double BorderWidth - { - get { return (double)this.GetValue(StringEditor.BorderWidthProperty); } - set { this.SetValue(StringEditor.BorderWidthProperty, value); } - } - - public ICommand BeginCommand - { - get { return (ICommand)this.GetValue(StringEditor.BeginCommandProperty); } - set { this.SetValue(StringEditor.BeginCommandProperty, value); } - } - - public ICommand CommitCommand - { - get { return (ICommand)this.GetValue(StringEditor.CommitCommandProperty); } - set { this.SetValue(StringEditor.CommitCommandProperty, value); } - } - - public ICommand CancelCommand - { - get { return (ICommand)this.GetValue(StringEditor.CancelCommandProperty); } - set { this.SetValue(StringEditor.CancelCommandProperty, value); } - } - - public ICommand FinishEditingCommand - { - get { return (ICommand)this.GetValue(StringEditor.FinishEditingCommandProperty); } - set { this.SetValue(StringEditor.FinishEditingCommandProperty, value); } - } - - public ICommand LostFocusCommand - { - get { return (ICommand)this.GetValue(StringEditor.LostFocusCommandProperty); } - set { this.SetValue(StringEditor.LostFocusCommandProperty, value); } - } - - private static void ValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - StringEditor editor = d as StringEditor; - if (editor != null) - { - editor.UpdateTextFromValue(); - } - } - - private static void IsNinchedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - StringEditor editor = d as StringEditor; - if (editor != null) - { - editor.UpdateTextFromValue(); - } - } - - private static void IsEditingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - StringEditor editor = d as StringEditor; - if (editor != null) - { - bool isNowEditing = (bool)e.NewValue; - if (isNowEditing) - { - if (editor.IsInitialized) - { - editor.Focus(); - } - else - { - editor.PostFocusCallback(); - } - } - } - } - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - BEGIN - // ################################################### - // StringEditor should select text only when it gets the logical focus and nowhere else. - protected override void OnGotFocus(RoutedEventArgs e) - { - base.OnGotFocus(e); - this.SelectAll(); - } - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - END - // ################################################### - - - protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e) - { - if (!this.IsReadOnly) - { - this.IsEditing = true; - } - base.OnGotKeyboardFocus(e); - } - - protected override void OnPreviewLostKeyboardFocus(KeyboardFocusChangedEventArgs e) - { - // We have to commit on _preview_ lost focus because the ---- tab control does - // work before we loose focus which causes keyframing stuff to happen out of order. - base.OnPreviewLostKeyboardFocus(e); - InternalLostFocus(); - } - - protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e) - { - base.OnLostKeyboardFocus(e); - // We have to commit on lost focus as well, since when WPF application - // loosing focus to another Win32 window, e.g. the MFC Artboard in Acrylic, - // the PreviewLostKeyboardFocus event is not triggered. - InternalLostFocus(); - } - - private void InternalLostFocus() - { - LostFocusAction savedLostFocusAction = this.lostFocusAction; - // Set this to none here so that we will not commit twice when re-entrant (preview lost keyboard focus, then - // lost keyboard focus in the same callstack) - this.lostFocusAction = LostFocusAction.None; - if (savedLostFocusAction == LostFocusAction.Commit) - { - this.CommitChange(); - } - else if (savedLostFocusAction == LostFocusAction.Cancel) - { - this.CancelChange(); - } - } - - protected override void OnLostFocus(RoutedEventArgs e) - { - base.OnLostFocus(e); - this.IsEditing = false; - ValueEditorUtils.ExecuteCommand(this.LostFocusCommand, this, null); - e.Handled = true; - } - - protected override void OnTextChanged(TextChangedEventArgs e) - { - base.OnTextChanged(e); - - if (this.ignoreTextChanges) - { - return; - } - - if (this.IsEditing) - { - // If we get any text change default to commit if focus goes away - this.lostFocusAction = LostFocusAction.Commit; - } - } - - protected override void OnKeyDown(KeyEventArgs e) - { - bool markHandled = ValueEditorUtils.GetHandlesCommitKeys(this); - if (e.Key == Key.Return || e.Key == Key.Enter) - { - LostFocusAction savedAction = this.lostFocusAction; - this.lostFocusAction = LostFocusAction.None; - if (savedAction == LostFocusAction.Commit) - { - this.CommitChange(); - } - - if ((e.KeyboardDevice.Modifiers & ModifierKeys.Shift) == 0) - { - this.OnFinishEditing(); - } - - e.Handled |= markHandled; - } - else if (e.Key == Key.Escape && this.IsEditing) - { - LostFocusAction savedAction = this.lostFocusAction; - this.lostFocusAction = LostFocusAction.None; - if (savedAction != LostFocusAction.None) - { - this.CancelChange(); - } - - this.OnFinishEditing(); - - e.Handled |= markHandled; - } - base.OnKeyDown(e); - } - - protected override void OnInitialized(EventArgs e) - { - base.OnInitialized(e); - } - - protected override void OnRender(DrawingContext drawingContext) - { - Pen strokePen = null; - Double borderWidth = this.BorderWidth; - Brush borderBrush = this.BorderBrush; - if (borderWidth > 0d && borderBrush != null) - { - strokePen = new Pen(borderBrush, borderWidth); - } - - RenderUtils.DrawInscribedRoundedRect(drawingContext, this.Background, strokePen, new Rect(0d, 0d, this.ActualWidth, this.ActualHeight), this.CornerRadius); - - base.OnRender(drawingContext); - } - - private void UpdateTextFromValue() - { - this.ignoreTextChanges = true; - - if (!this.IsNinched) - { - this.Text = this.Value; - } - else - { - this.Text = null; - } - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - BEGIN - // ################################################### - - // Whenever we set the value of a StringEditor programmatically - // (either because the contained property value changed somehow - // or because the user changed the value, hit enter, and we - // are looping back to see what the new value is now), make sure - // to clear the TextBox's UndoManager's buffer. That way, the control - // will not be able to perform Undo and the command will be forwarded - // to the host. - - // TextBoxBase does not provide any API to reset its Undo stack, - // but we can hack around it by resetting the UndoLimit, which - // accomplishes the same thing. - // - int originalUndoLimit = this.UndoLimit; - this.UndoLimit = 0; - this.UndoLimit = originalUndoLimit; - - // ################################################### - // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - END - // ################################################### - - this.ignoreTextChanges = false; - } - - private void CommitChange() - { - - ValueEditorUtils.ExecuteCommand(this.BeginCommand, this, null); - this.Value = this.Text; - ValueEditorUtils.ExecuteCommand(this.CommitCommand, this, null); - ValueEditorUtils.UpdateBinding(this, StringEditor.ValueProperty, UpdateBindingType.Target); - // Now update the text value in case the model or a binding has reformated - this.UpdateTextFromValue(); - } - - void OnDesignerViewCommitExecute(object sender, ExecutedRoutedEventArgs e) - { - this.InternalLostFocus(); - e.Handled = true; - } - - private void CancelChange() - { - ValueEditorUtils.ExecuteCommand(this.BeginCommand, this, null); - ValueEditorUtils.UpdateBinding(this, StringEditor.ValueProperty, false); - ValueEditorUtils.ExecuteCommand(this.CancelCommand, this, null); - ValueEditorUtils.UpdateBinding(this, StringEditor.ValueProperty, UpdateBindingType.Target); - this.UpdateTextFromValue(); - } - - private void OnFinishEditing() - { - ICommand finishedEditingCommand = this.FinishEditingCommand; - if (finishedEditingCommand != null) - { - ValueEditorUtils.ExecuteCommand(finishedEditingCommand, this, null); - } - else - { - Keyboard.Focus(null); - } - } - - private void PostFocusCallback() - { - UIThreadDispatcher.Instance.BeginInvoke(DispatcherPriority.Input, new DispatcherOperationCallback(this.SetFocus), null); - } - - private object SetFocus(object o) - { - if (this.Visibility == Visibility.Visible) - { - this.Focus(); - } - - return null; - } - private enum LostFocusAction - { - None, - Commit, - Cancel - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/ValueEditorUtils.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/ValueEditorUtils.cs deleted file mode 100644 index 1cd35bf261e..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/ValueEditorUtils.cs +++ /dev/null @@ -1,87 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -// ------------------------------------------------------------------- - -//Cider comment: -// - Removed class MouseCursor - -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\ValueEditors -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.ValueEditors -{ - using System; - using System.ComponentModel; - using System.Runtime.InteropServices; - using System.Windows; - using System.Windows.Data; - using System.Windows.Input; - using System.Windows.Interop; - using System.Windows.Media; - - internal enum UpdateBindingType - { - Source, - Target, - Both - } - internal static class ValueEditorUtils - { - // This property determines whether the commit keys (enter and escape) are marked handled by value editors or not. It inherits - // so can be set at any point in the tree, and all ValueEditors below that point in the UI will use this behavior. - public static readonly DependencyProperty HandlesCommitKeysProperty = DependencyProperty.RegisterAttached("HandlesCommitKeys", typeof(bool), typeof(ValueEditorUtils), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.Inherits)); - - public static bool GetHandlesCommitKeys(DependencyObject dependencyObject) - { - return (bool)dependencyObject.GetValue(ValueEditorUtils.HandlesCommitKeysProperty); - } - - public static void SetHandlesCommitKeys(DependencyObject dependencyObject, bool value) - { - dependencyObject.SetValue(ValueEditorUtils.HandlesCommitKeysProperty, value); - } - - public static void UpdateBinding(FrameworkElement element, DependencyProperty property, bool updateSource) - { - ValueEditorUtils.UpdateBinding(element, property, (updateSource ? UpdateBindingType.Both : UpdateBindingType.Target)); - } - - public static void UpdateBinding(FrameworkElement element, DependencyProperty property, UpdateBindingType updateType) - { - BindingExpression bindingExpression = element.GetBindingExpression(property); - if (bindingExpression != null) - { - // If desired, push the current text value to the source of the binding. - if (updateType == UpdateBindingType.Source || updateType == UpdateBindingType.Both) - { - bindingExpression.UpdateSource(); - } - - // Update the text from the source of the binding. - if (updateType == UpdateBindingType.Target || updateType == UpdateBindingType.Both) - { - bindingExpression.UpdateTarget(); - } - } - } - - public static void ExecuteCommand(ICommand command, IInputElement element, object parameter) - { - RoutedCommand routedCommand = command as RoutedCommand; - if (routedCommand != null) - { - if (routedCommand.CanExecute(parameter, element)) - { - routedCommand.Execute(parameter, element); - } - } - else - { - if (command != null && command.CanExecute(parameter)) - { - command.Execute(parameter); - } - } - } - } - - -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/ValueToIconConverter.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/ValueToIconConverter.cs deleted file mode 100644 index ccdbf4d8952..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/FromExpression/Framework/ValueEditors/ValueToIconConverter.cs +++ /dev/null @@ -1,51 +0,0 @@ -// ------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -// ------------------------------------------------------------------- -//From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\ValueEditors -namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.ValueEditors -{ - using System; - using System.Globalization; - using System.Windows; - using System.Windows.Data; - using System.Windows.Media; - using System.Diagnostics.CodeAnalysis; - using System.Activities.Presentation; - - // - // Implement this interface to provide icons to the ValueToIconProvider - // - internal interface IIconProvider - { - ImageSource GetIconAsImageSource(object key, object parameter); - } - - // - // Gets an Icon as a Brush from the IIconProvider passed in as the first object of a multibinding - // using the second object as the key. - // - - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - internal class ValueToIconConverter : IMultiValueConverter - { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) - { - if (values.Length == 2) - { - IIconProvider iconProvider = values[0] as IIconProvider; - object objectToLookUp = values[1]; - if (iconProvider != null && objectToLookUp != null) - { - return iconProvider.GetIconAsImageSource(objectToLookUp, parameter); - } - } - - return null; - } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) - { - throw FxTrace.Exception.AsError(new NotImplementedException(ExceptionStringTable.NoConvertBackForValueToIconConverter)); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/IStateContainer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/IStateContainer.cs deleted file mode 100644 index 928b50d7726..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/IStateContainer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.State -{ - - // - // Internal interface we use to mark classes that manage state that we want to - // marshal across control instances as well as AppDomains. - // - internal interface IStateContainer - { - - // - // Retrieves the state stored in the object implementing this interface - // - // AppDomain-friendly state object - object RetrieveState(); - - // - // Restores its state based on the specified state object - // - // State to apply - void RestoreState(object state); - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/KeyboardEnabledRadioButton.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/KeyboardEnabledRadioButton.cs deleted file mode 100644 index 4b4d2fbebba..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/KeyboardEnabledRadioButton.cs +++ /dev/null @@ -1,28 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System.Windows.Controls; - using System.Windows.Input; - - // - // WPF's RadioButton responds to Space key to trigger selection, but - // not the Enter or Return keys. This class responds to both. - // - internal class KeyboardEnabledRadioButton : RadioButton - { - protected override void OnKeyDown(KeyEventArgs e) - { - if (e.Key == Key.Enter || - e.Key == Key.Return) - { - - this.IsChecked = true; - e.Handled = true; - } - - base.OnKeyDown(e); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Metadata/PropertyInspectorMetadata.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Metadata/PropertyInspectorMetadata.cs deleted file mode 100644 index 01fe37f0a9a..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Metadata/PropertyInspectorMetadata.cs +++ /dev/null @@ -1,70 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Metadata -{ - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Input; - using System.Windows.Media.Effects; - - using System.Activities.Presentation.Metadata; - using System.Activities.Presentation.PropertyEditing; - - using System.Activities.Presentation.Internal.PropertyEditing.Editors; - - // - // Metadata specific to PropertyEditing -- associates specific PropertyValueEditors with - // specific property Types or properties themselves. - // - [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes", Justification = "Suppress to avoid churning the code base.")] - static class PropertyInspectorMetadata - { - - private static bool _initialized; - - // - // Initializes the metadata provided by this class. Multiple class - // are ignored. - // - public static void Initialize() - { - if (_initialized) - { - return; - } - - // Introduce any Cider-specific customizations - AttributeTableBuilder builder = new AttributeTableBuilder(); - - // Make Name and FlowDirection properties browsable. The reason why - // these attributes are here instead of in the BaseOverridesAttributeTable - // is because the BaseAttributeTable explicitly hides these properties - // and adding conflicting attributes to the same table (via BaseOverridesAttributeTable - // which derives from BaseAttributeTable) currently results in unspeciefied - // behavior. Hence we use this table to deal with these attributes. - // - MakeBasic(builder, typeof(FrameworkElement), FrameworkElement.FlowDirectionProperty); - MakeBasic(builder, typeof(Control), Control.NameProperty); - - // Note: Add any new attributes here or into System.Activities.Presentation.Developer / - // System.Activities.Presentation.Internal.Metadata.BaseOverridesAttributeTable - - MetadataStore.AddAttributeTable(builder.CreateTable()); - - _initialized = true; - } - - private static void MakeBasic(AttributeTableBuilder builder, Type owningType, DependencyProperty property) - { - builder.AddCustomAttributes(owningType, property, BrowsableAttribute.Yes); - builder.AddCustomAttributes(owningType, property, new EditorBrowsableAttribute(EditorBrowsableState.Always)); - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelCategoryEntry.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelCategoryEntry.cs deleted file mode 100644 index b8535a217f5..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelCategoryEntry.cs +++ /dev/null @@ -1,331 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Model -{ - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Collections.Specialized; - using System.Diagnostics; - using System.Activities.Presentation.PropertyEditing; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector; - using System.Activities.Presentation; - - // - // Cider's concrete implementation of CategoryEntry (CategoryBase comes from Sparkle - // and it has a few extra goodies that we want to reuse). This class implements - // INotifyCollectionChanged. We need to push this implementation to the base class - // in v2. - // - internal class ModelCategoryEntry : CategoryBase, INotifyCollectionChanged - { - - private ObservableCollectionWorkaround _basicProperties; - private ObservableCollectionWorkaround _advancedProperties; - - // - // Basic ctor - // - // Localized name for this category - public ModelCategoryEntry(string categoryName) : base(categoryName) - { - _basicProperties = new ObservableCollectionWorkaround(); - _advancedProperties = new ObservableCollectionWorkaround(); - } - - public event NotifyCollectionChangedEventHandler CollectionChanged; - - // - // Gets the advanced properties contained in this category - // - public override ObservableCollection AdvancedProperties - { - get { - return _advancedProperties; - } - } - - // - // Gets the basic properties contained in this category - // - public override ObservableCollection BasicProperties - { - get { - return _basicProperties; - } - } - - // - // Gets a flag indicating whether this category contains any properties - // - internal bool IsEmpty - { - get { - return _advancedProperties.Count + _basicProperties.Count == 0; - } - } - - // - // Returns either the basic or the advanced bucket based on the IsAdvanced flag - // set in the PropertyEntry itself - // - // Property to examine - // The corresponding basic or advanced bucket - internal ObservableCollectionWorkaround GetBucket(PropertyEntry property) - { - if (property == null) - { - throw FxTrace.Exception.ArgumentNull("property"); - } - return property.IsAdvanced ? _advancedProperties : _basicProperties; - } - - // - // Adds the given property to the specified property bucket (use - // ModelCategoryEntry.BasicProperties, ModelCategoryEntry.AdvancedProperties, or - // ModelCategoryEntry.GetBucket()) sorted using the specified comparer. - // - // Property to add - // Property bucket to populate - // Sort algorithm to use - // If set to true, NotifyCollectionChanged event is fired - internal void Add( - PropertyEntry property, - ObservableCollection bucket, - IComparer comparer) - { - Add(property, bucket, comparer, true); - } - - // - // Adds the given property to the specified property bucket (use - // ModelCategoryEntry.BasicProperties, ModelCategoryEntry.AdvancedProperties, or - // ModelCategoryEntry.GetBucket()) sorted using the specified comparer. - // - private void Add( - PropertyEntry property, - ObservableCollection bucket, - IComparer comparer, - bool fireCollectionChangedEvent) - { - - if (property == null) - { - throw FxTrace.Exception.ArgumentNull("property"); - } - if (bucket == null) - { - throw FxTrace.Exception.ArgumentNull("bucket"); - } - if (comparer == null) - { - throw FxTrace.Exception.ArgumentNull("comparer"); - } - - ObservableCollectionWorkaround castBucket = bucket as ObservableCollectionWorkaround; - int insertionIndex = 0; - - if (castBucket == null) - { - Debug.Fail("Invalid property bucket. The property sort order will be broken."); - } - else - { - insertionIndex = castBucket.BinarySearch(property, comparer); - if (insertionIndex < 0) - { - insertionIndex = ~insertionIndex; - } - } - - bucket.Insert(insertionIndex, property); - - if (fireCollectionChangedEvent) - { - FirePropertiesChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, property)); - } - } - - // - // Removes and re-adds the specified property from this category, if it existed - // there to begin with. Noop otherwise. - // - // Use this method to refresh the cate----zation of a property if it suddenly - // becomes Advanced if it was Basic before, or if its IsBrowsable status changes. - // - // Property to refresh - // Property bucket to repopulate - // Comparer to use to reinsert the given property in its new place - internal void Refresh(ModelPropertyEntry property, ObservableCollection bucket, IComparer sortComparer) - { - if (property == null) - { - throw FxTrace.Exception.ArgumentNull("property"); - } - if (bucket != _basicProperties && bucket != _advancedProperties) - { - Debug.Fail("Invalid bucket specified. Property was not refreshed."); - return; - } - - // Let's see if we know about this property - ObservableCollectionWorkaround collection; - collection = _advancedProperties; - - int index = collection.BinarySearch(property, null); - if (index < 0) - { - collection = _basicProperties; - index = collection.BinarySearch(property, null); - } - - // If not, noop - if (index < 0) - { - return; - } - - // We know about this property, so refresh it. It may have changed - // somehow (eg. switched from basic to advanced, become hidden, etc.) - // so make sure it's thrown into the right bucket. - collection.RemoveAt(index); - Add(property, bucket, sortComparer, false); - } - - // - // This is a work-around fix because Blend's CategoryBase does not handle null filters (valid value) - // correctly. We need to ask Blend to eventually fix this issue. - // - // Filter to apply, can be null - public override void ApplyFilter(PropertyFilter filter) - { - if (filter == null) - { - this.MatchesFilter = true; - this.BasicPropertyMatchesFilter = true; - this.AdvancedPropertyMatchesFilter = true; - - foreach (PropertyEntry property in this.BasicProperties) - { - property.ApplyFilter(filter); - } - - foreach (PropertyEntry property in this.AdvancedProperties) - { - property.ApplyFilter(filter); - } - } - else - { - base.ApplyFilter(filter); - } - } - - // Another Blend work-around - we expose all properties through the OM, not just the - // Browsable ones. However, as a result, we need to cull the non-browsable ones from - // consideration. Otherwise, empty categories may appear. - protected override bool DoesPropertyMatchFilter(PropertyFilter filter, PropertyEntry property) - { - property.ApplyFilter(filter); - - bool isBrowsable = true; - ModelPropertyEntry modelPropertyEntry = property as ModelPropertyEntry; - if (modelPropertyEntry != null) - { - //display given property if it is browsable or - isBrowsable = modelPropertyEntry.IsBrowsable || - // it may not be browsable, but if there is a category editor associated - display it anyway - (this.CategoryEditors != null && this.CategoryEditors.Count != 0); - } - - return isBrowsable && property.MatchesFilter; - } - - // - // Sets the Disassociated flag on all contained properties to True - // - internal void MarkAllPropertiesDisassociated() - { - MarkAllPropertiesDisassociated(_basicProperties); - MarkAllPropertiesDisassociated(_advancedProperties); - } - - // - // Sets the Disassociated flag on all contained attached properties to True - // - internal void MarkAttachedPropertiesDisassociated() - { - MarkAttachedPropertiesDisassociated(_basicProperties); - MarkAttachedPropertiesDisassociated(_advancedProperties); - } - - // - // Removes all properties from this category whose Disassociated flag is set to True - // - internal void CullDisassociatedProperties() - { - bool propertiesCulled = false; - propertiesCulled |= CullDisassociatedProperties(_basicProperties); - propertiesCulled |= CullDisassociatedProperties(_advancedProperties); - - if (propertiesCulled) - { - FirePropertiesChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); - } - } - - private static void MarkAllPropertiesDisassociated(ObservableCollectionWorkaround propertyList) - { - foreach (ModelPropertyEntry property in propertyList) - { - property.Disassociated = true; - } - } - - private static void MarkAttachedPropertiesDisassociated(ObservableCollectionWorkaround propertyList) - { - foreach (ModelPropertyEntry property in propertyList) - { - if (property.IsAttached) - { - property.Disassociated = true; - } - } - } - - private static bool CullDisassociatedProperties(ObservableCollectionWorkaround propertyList) - { - bool propertiesCulled = false; - for (int i = propertyList.Count - 1; i >= 0; i--) - { - ModelPropertyEntry property = (ModelPropertyEntry)propertyList[i]; - if (property.Disassociated) - { - property.Disconnect(); - propertyList.RemoveAt(i); - propertiesCulled = true; - } - } - - return propertiesCulled; - } - - // INotifyCollectionChanged Members - - private void FirePropertiesChanged(NotifyCollectionChangedEventArgs collectionChangedEventArgs) - { - // Fire both "Properties" changed events - OnPropertyChanged("Properties"); - OnPropertyChanged("Item[]"); - - // as well as the appropriate collection-changed event - if (CollectionChanged != null) - { - CollectionChanged(this, collectionChangedEventArgs); - } - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyEntry.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyEntry.cs deleted file mode 100644 index 64d8a0fa4cd..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyEntry.cs +++ /dev/null @@ -1,1387 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Model -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Text; - using System.Windows; - using System.Windows.Data; - using System.Windows.Markup; - using System.Windows.Media; - - using System.Activities.Presentation; - using System.Activities.Presentation.Model; - using System.Activities.Presentation.PropertyEditing; - using System.Activities.Presentation.Services; - - using System.Activities.Presentation.Internal.Properties; - using System.Runtime; - using System.Activities.Presentation.Internal.PropertyEditing.Editors; - - // - // ModelPropertyEntry is a wrapper around Cider's ModelProperty and that - // exposes its functionality through the PropertyEntry object model. It handles - // all get / set / clear functionality. - // - internal class ModelPropertyEntry : ModelPropertyEntryBase, IComparable - { - private const string _textBlockInlinesPropertyName = "Inlines"; - - // Property names for TextBlock properties that require special handling - private static string _textBlockTextPropertyName = System.Windows.Controls.TextBlock.TextProperty.Name; - - // Cached values that need to be nixed when the underlying ModelProperty changes - // (ie. someone calls SetProperty()) - private CachedValues _valueCache; - - // List of ModelProperties that this instance wraps around. It - // is guaranteed to contain at least one ModelProperty instance (single - // selection scenario), but it may contain multiple ModelProperty instances - // (multi-select scenario) - private List _properties = new List(); - - // Flag indicating whether this instance points to something valid. - // Used both as a perf optimization from PropertyInspector.UpdateCategories() - // as well as to disable the making of changes to ModelPropertyEntries - // when the underlying ModelProperties are no longer available. - private bool _disassociated; - - // Bool indicating whether this property is a wrapper around the Name property - // (which we special case for display purposes) - private bool _wrapsAroundNameProperty; - - // - // Basic ctor that wraps around a single ModelProperty - // - // ModelProperty to wrap around - // Parent PropertyValue, if any - [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] - public ModelPropertyEntry(ModelProperty property, ModelPropertyValue parentValue) - : base(parentValue) - { - - _valueCache = new CachedValues(this); - SetUnderlyingModelPropertyHelper(property, false); - } - - // - // Basic ctor that wraps around multiple ModelProperties in the - // multi-select scenario. The code assumes that the ModelProperties in - // the set all represent the same property (eg. Background) across different - // ModelItems (eg. Button, Grid, and ComboBox). - // - // Set of ModelProperties to wrap around - // Parent PropertyValue, if any - [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] - public ModelPropertyEntry(IEnumerable propertySet, ModelPropertyValue parentValue) - : base(parentValue) - { - - _valueCache = new CachedValues(this); - SetUnderlyingModelPropertyHelper(propertySet, false); - } - - - // - // Gets the name of the contained property - // - public override string PropertyName - { - get { - return _properties[0].Name; - } - } - - // - // Gets the display name of the contained property, if any. - // Defaults to property name if none is found. - // - public override string DisplayName - { - get { - return _valueCache.DisplayName; - } - } - - // - // Gets the type of the contained property - // - public override Type PropertyType - { - get { - return _properties[0].PropertyType; - } - } - - // - // Gets the category name of the contained property - // - public override string CategoryName - { - get { - return _valueCache.CategoryName; - } - } - - // - // Gets the description of the contained property - // - public override string Description - { - get { - return _valueCache.Description; - } - } - - // - // Gets a flad indicating whether the property is read-only - // - public override bool IsReadOnly - { - get { - return _valueCache.IsReadOnly; - } - } - - // - // Gets a flag indicating whether the property is advanced - // - public override bool IsAdvanced - { - get { - return _valueCache.IsAdvanced; - } - } - - // - // Gets a flag indicating whether this property is browsable or not - // (All properties are exposed through the object model. It's up to the - // UI to make the display / don't-display decision) - // - public bool IsBrowsable - { - get { - return _valueCache.IsBrowsable; - } - } - - // - // Gets a collection of standard values that can be assigned to - // the property - // - public override ICollection StandardValues - { - get { - return _valueCache.StandardValues; - } - } - - // - // Gets a flag indicating whether the list of StandardValues is complete - // or whether the user can type a value that's different from the ones in the list - // Note: this property is referenced from XAML - // - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public bool StandardValuesExclusive - { - get { - return _valueCache.StandardValuesExclusive; - } - } - - // - // Gets the PropertyValueEditor for this property - // - public override PropertyValueEditor PropertyValueEditor - { - get { - return _valueCache.PropertyValueEditor; - } - } - - // - // Gets the TypeConverted for the contained property - // - public override TypeConverter Converter - { - get { - return _valueCache.Converter; - } - } - - // - // Gets the value Type for all contained properties if it matches, - // null otherwise - // - public override Type CommonValueType - { - get { - return _valueCache.CommonValueType; - } - } - - // - // Returns true if the contained ModelProperties don't - // share the same value - // - public override bool IsMixedValue - { - get { - return _valueCache.IsMixedValue; - } - } - - // - // Gets the source of the value contained by this property - // - public override PropertyValueSource Source - { - get { - return _valueCache.Source; - } - } - - // - // Gets the sub-properties of the contained property - // - public override PropertyEntryCollection SubProperties - { - get { - return _valueCache.SubProperties; - } - } - - // - // Gets the collection of PropertyValues if this ModelProperty represents - // a collection - // - public override PropertyValueCollection Collection - { - get { - return _valueCache.Collection; - } - } - - // - // Gets a flag indicating whether the collection instance has already - // been instantiated (perf optimization) - // - internal override bool CollectionInstanceExists - { - get { - return _valueCache.CollectionInstanceExists; - } - } - - // - // Gets the underlying collection of ModelProperties - // - internal ICollection ModelPropertySet - { - get { - return _properties; - } - } - - // - // Gets the first underlying ModelProperty for cases when - // this class wraps around multiple - // - internal ModelProperty FirstModelProperty - { - get { - return _properties[0]; - } - } - - // - // Gets an order token for property ordering - // - internal PropertyOrder PropertyOrder - { - get { - return _valueCache.PropertyOrder; - } - } - - // - // Gets or sets the disassociated flag - // - internal bool Disassociated - { - get { return _disassociated; } - set { _disassociated = value; } - } - - // - // Gets a flag indicating whether this instance represents an attached DP - // - internal bool IsAttached - { - get { - return _valueCache.IsAttached; - } - } - - // - // Gets a list of CategoryEditor types associated with this PropertyEntry - // - internal IEnumerable CategoryEditorTypes - { - get { - return _valueCache.CategoryEditorTypes; - } - } - - - // - // Returns true if there are standard values for this property. - // - protected override bool HasStandardValues - { - get { return _valueCache.StandardValuesSupported; } - } - - // - // Replaces the underlying ModelProperty/ies with the specified ModelProperties. - // Fires the appropriate PropertyChanged events - // - // Property set to wrap around - public void SetUnderlyingModelProperty(IEnumerable propertySet) - { - SetUnderlyingModelPropertyHelper(propertySet, true); - } - - private void SetUnderlyingModelPropertyHelper(ModelProperty property, bool firePropertyValueChangedEvents) - { - if (property == null) - { - throw FxTrace.Exception.ArgumentNull("property"); - } - - // Store the value - ClearUnderlyingModelProperties(); - AddUnderlyingModelProperty(property); - - // Clear any cached values - RefreshCache(); - - if (firePropertyValueChangedEvents) - { - // Update the PropertyValue (always, except when it doesn't exist yet (ctor time)) - this.ModelPropertyValue.OnUnderlyingModelChanged(); - } - } - - private void SetUnderlyingModelPropertyHelper(IEnumerable propertySet, bool firePropertyValueChangedEvents) - { - if (propertySet == null) - { - throw FxTrace.Exception.ArgumentNull("propertySet"); - } - - // Attempt to store the values - int count = 0; - foreach (ModelProperty property in propertySet) - { - if (property == null) - { - continue; - } - - if (count == 0) - { - ClearUnderlyingModelProperties(); - } - - AddUnderlyingModelProperty(property); - count++; - } - - // Throw if the underlying property set was invalid - if (count == 0) - { - throw FxTrace.Exception.AsError(new ArgumentException("Cannot set the underlying ModelProperty to an empty set.")); - } - - // Clear any cached values - RefreshCache(); - - if (firePropertyValueChangedEvents) - { - // Update the PropertyValue (always, except when it doesn't exist yet (ctor time)) - this.ModelPropertyValue.OnUnderlyingModelChanged(); - } - } - - // Adds the property to the internal collection list and hooks into its PropertyChanged event - private void AddUnderlyingModelProperty(ModelProperty property) - { - if (property == null) - { - return; - } - - property.Parent.PropertyChanged += new PropertyChangedEventHandler(OnUnderlyingPropertyChanged); - _properties.Add(property); - _wrapsAroundNameProperty = "Name".Equals(property.Name); - } - - internal void Disconnect() - { - foreach (ModelProperty property in _properties) - { - property.Parent.PropertyChanged -= new PropertyChangedEventHandler(OnUnderlyingPropertyChanged); - } - } - - // Removes all properties from the internal collection and unhooks from their PropertyChanged events - private void ClearUnderlyingModelProperties() - { - foreach (ModelProperty property in _properties) - { - property.Parent.PropertyChanged -= new PropertyChangedEventHandler(OnUnderlyingPropertyChanged); - } - - _properties.Clear(); - _wrapsAroundNameProperty = false; - } - - // Event handler for PropertyChanged event. Called whenever any of the underlying properties that - // this ModelPropertyEntry wraps around changes. - private void OnUnderlyingPropertyChanged(object sender, PropertyChangedEventArgs e) - { - if (!this.PropertyName.Equals(e.PropertyName)) - { - return; - } - - this.OnUnderlyingModelChanged(); - - // If this property is a sub-property of some other property we know and care - // about, notify the parents as well - PropertyValue parentValue = this.ParentValue; - while (parentValue != null) - { - ModelPropertyEntryBase parentProperty = (ModelPropertyEntryBase)parentValue.ParentProperty; - parentProperty.OnUnderlyingSubModelChanged(); - parentValue = parentProperty.ParentValue; - } - } - - // - // Clear any cached values - // - protected override void RefreshCache() - { - base.RefreshCache(); - _valueCache.ClearAll(); - } - - // - // Gets the underlying value as an object instance. Mixed values will - // return null. - // - // Underlying value contained by this property. - public override object GetValueCore() - { - if (this.IsMixedValue) - { - return null; - } - - object retValue = ModelUtilities.GetSafeComputedValue(_properties[0]); - - return retValue; - } - - // - // Sets the value of the underlying property / ies. - // - // Value to set - public override void SetValueCore(object value) - { - // If this ModelPropertyEntry instance is no longer hooked up into - // the underlying model, ignore calls to SetValueCore() - if (_disassociated) - { - return; - } - - bool textBlockTextHackNeeded = false; - List textBlockTextProperties = null; - if (typeof(System.Windows.Controls.TextBlock).IsAssignableFrom(_properties[0].Parent.ItemType)) { - textBlockTextHackNeeded = true; - } - - // POSSIBLE OPTIMIZATION: remember which properties were altered. When on Idle we - // receive global property changed events, ignore the ones we know about - using (ModelEditingScope group = _properties[0].Parent.BeginEdit( - string.Format( - CultureInfo.CurrentCulture, - Resources.PropertyEditing_UndoText, - this.DisplayName))) - { - - for (int i = 0; i < _properties.Count; i++) - { - if (textBlockTextHackNeeded && _properties[i].Name.Equals(_textBlockTextPropertyName)) { - // We need to set Text after we clear inlines! - if (textBlockTextProperties == null) - { - textBlockTextProperties = new List(); - } - textBlockTextProperties.Add(_properties[i]); - continue; - } - _properties[i].SetValue(value); - } - - // TextBlock has very bad IAddChild behavior with two properties contributing and having different - // views into the content (Text and Inlines). To simplify editing, we clear Inlines when Text is set - // which is what most users want anyways - if (textBlockTextProperties != null) - { - foreach (ModelProperty textBlockTextProperty in textBlockTextProperties) - { - ModelProperty inlinesProperty = textBlockTextProperty.Parent.Properties[_textBlockInlinesPropertyName]; - if (inlinesProperty != null && inlinesProperty.Collection != null) - { - inlinesProperty.Collection.Clear(); - } - textBlockTextProperty.SetValue(value); - } - } - - if (group != null) - { - group.Complete(); - } - } - - _valueCache.ClearValueRelatedCacheItems(); - NotifyParentOfNameChanged(); - } - - // - // Clears the underlying property / ies. - // - public override void ClearValue() - { - - // If this ModelPropertyEntry instance is no longer hooked up into - // the underlying model, ignore calls to ClearValue() - if (_disassociated) - { - return; - } - - // POSSIBLE OPTIMIZATION: remember which properties were altered. When on Idle we - // receive global property changed events, ignore the ones we know about - - using (ModelEditingScope group = _properties[0].Parent.BeginEdit( - string.Format( - CultureInfo.CurrentCulture, - Resources.PropertyEditing_UndoText, - this.DisplayName))) - { - - for (int i = 0; i < _properties.Count; i++) - { - _properties[i].ClearValue(); - } - - group.Complete(); - } - - _valueCache.ClearValueRelatedCacheItems(); - NotifyParentOfNameChanged(); - } - - // If this property happens to wrap around the "Name" property, give our parent - // (if one exists) a heads-up that the value has changed. We use this mechanism - // to update display names of items in a collection editor. - private void NotifyParentOfNameChanged() - { - if (!_wrapsAroundNameProperty) - { - return; - } - - ModelPropertyValue parentValue = this.ParentValue as ModelPropertyValue; - if (parentValue == null) - { - return; - } - - // This PropertyEntry is the Name sub-property of another PropertyValue, - // so let our parent know that its name has changed. - parentValue.OnNameSubPropertyChanged(); - } - - // - // Called when the underlying ModelProperty changes. Clears any cached - // values and fires the appropriate changed events. - // - internal void OnUnderlyingModelChanged() - { - _valueCache.ClearValueRelatedCacheItems(); - this.ModelPropertyValue.OnUnderlyingModelChanged(); - } - - // - // Called when the sub-property of the underlying ModelProperty changes. - // - protected override void OnUnderlyingSubModelChangedCore() - { - _valueCache.ClearSubValueRelatedCacheItems(); - } - - // - // Creates new instance of ModelPropertyValue - // - // New instance of ModelPropertyValue - protected override PropertyValue CreatePropertyValueInstance() - { - return new ModelPropertyValue(this); - } - - // - // Opens a new ModelEditingScope - // - // Change description (may be null) - // A new, opened ModelEditingScope - internal override ModelEditingScope BeginEdit(string description) - { - return description == null ? FirstModelProperty.Parent.BeginEdit() : FirstModelProperty.Parent.BeginEdit(description); - } - - // IPropertyFilterTarget Members - - // - // IPropertyFilterTarget method. We override the default behavior which matches - // both property DisplayName as well as the property Type name. - // - // the predicate to match against - // true if there is a match - public override bool MatchesPredicate(PropertyFilterPredicate predicate) - { - return predicate == null ? false : predicate.Match(this.DisplayName); - } - - - // IComparable Members - - // - // Compares 'this' with the object passed into it using the ModelPropertyEntryComparer, - // which looks at both PropertyOrder as well as DisplayName to do the comparison - // - // Object to compare this instance to - // Comparison result - public int CompareTo(object obj) - { - return PropertyEntryPropertyOrderComparer.Instance.Compare(this, obj); - } - - - // - // Debuging-friendly ToString() - // - // - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - public override string ToString() - { - try - { - if (string.Equals(this.PropertyName, this.DisplayName)) - { - return string.Format(CultureInfo.CurrentCulture, "{0} (PropertyEntry)", this.PropertyName); - } - else - { - return string.Format(CultureInfo.CurrentCulture, "{0} (\"{1}\" - PropertyEntry)", this.PropertyName, this.DisplayName); - } - } - catch - { - return base.ToString(); - } - } - - // Cached values that need to be nixed when the underlying ModelProperty changes - // (ie. someone calls SetProperty()). Pretty much everything in here is an "expensive" - // calculation which requires us to evaluate some attributes associated with the given - // property or a set of properties, so we cache the return values and keep that cache - // in a single place so that it's easy to know what needs to be ----d when the underlying - // ModelProperties change. - private class CachedValues - { - - private static readonly PropertyValueEditor NoPropertyValueEditor = new PropertyValueEditor(); - private static readonly PropertyOrder NoPropertyOrder = PropertyOrder.CreateAfter(PropertyOrder.Default); - private static readonly TypeConverter NoTypeConverter = new TypeConverter(); - private static readonly ValueSerializer NoSerializer = new NoValueSerializer(); - private static readonly Type NoCommonValueType = typeof(CachedValues); // some private type that we can use as a marker - private static readonly List NoCategoryEditorTypes = new List(); - private static readonly PropertyValueSource NoSource = new NoPropertyValueSource(); - - private ModelPropertyEntry _parent; - - // Cached values - private string _displayName; - private string _categoryName; - private string _description; - private bool? _isAdvanced; - private bool? _isBrowsable; - private bool? _isReadOnly; - private bool? _isAttached; - private ArrayList _standardValues; - private bool? _standardValuesExclusive; - private bool? _standardValuesSupported; - private PropertyValueEditor _propertyValueEditor; - private bool? _isMixedValue; - private PropertyValueSource _source; - private ModelPropertyEntryCollection _subProperties; - private ModelPropertyValueCollection _collection; - private TypeConverter _converter; - private ValueSerializer _valueSerializer; - private Type _commonValueType; - private PropertyOrder _propertyOrder; - private IEnumerable _categoryEditorTypes; - - public CachedValues(ModelPropertyEntry parent) - { - _parent = parent; - } - - // - // Gets the display name of the contained property, if any. - // Defaults to property name if none is found. - // - public string DisplayName - { - get { - if (_displayName == null) - { - _displayName = - ExtensibilityAccessor.GetDisplayName(_parent.FirstModelProperty) ?? - _parent.PropertyName; - } - - Fx.Assert(_displayName != null, "_displayName should not be null"); - return _displayName; - } - } - - // - // Pick the first category name - // - public string CategoryName - { - get { - if (_categoryName == null) - { - _categoryName = ExtensibilityAccessor.GetCategoryName(_parent.FirstModelProperty); - } - - Fx.Assert(_categoryName != null, "_categoryName should not be null"); - return _categoryName; - } - } - - // - // Pick the first description - // - public string Description - { - get { - if (_description == null) - { - _description = ExtensibilityAccessor.GetDescription(_parent.FirstModelProperty); - } - - Fx.Assert(_description != null, "_description should not be null"); - return _description; - } - } - - // - // OR mutliple values of IsAdvanced together - // - public bool IsAdvanced - { - get { - if (_isAdvanced == null) - { - _isAdvanced = false; - for (int i = 0; i < _parent._properties.Count; i++) - { - _isAdvanced |= ExtensibilityAccessor.GetIsAdvanced(_parent._properties[i]); - if (_isAdvanced == true) - { - break; - } - } - } - - Fx.Assert(_isAdvanced != null, "_isAdvanced should not be null"); - return (bool)_isAdvanced; - } - } - - // - // AND multiple values of IsBrowsable together - // - public bool IsBrowsable - { - get { - if (_isBrowsable == null) - { - _isBrowsable = true; - for (int i = 0; i < _parent._properties.Count; i++) - { - - // Look for the BrowsableAttribute - bool? temp = ExtensibilityAccessor.IsBrowsable(_parent._properties[i]); - - // Go by the IsReadOnly flag, if not found - if (temp == null) - { - temp = !this.IsReadOnly; - } - - // AND multiple values together - _isBrowsable &= (bool)temp; - - if (_isBrowsable == false) - { - break; - } - } - } - - Fx.Assert(_isBrowsable != null, "_isBrowsable should not be null"); - return (bool)_isBrowsable; - } - } - - // - // Gets a flags indicating whether this property is read only. - // - public bool IsReadOnly - { - get { - if (_isReadOnly == null) - { - - _isReadOnly = ExtensibilityAccessor.IsReadOnly( - _parent._properties, - new ExtensibilityAccessor.IsMixedValueEvaluator(delegate() - { - return this.IsMixedValue; - })); - - Fx.Assert(_isReadOnly != null, "_isReadOnly should not be null"); - } - - return (bool)_isReadOnly; - } - } - - // - // Merge collection of standard values and only present the subset that exists in all. - // We do fancy magic here because presenting the user with invalid set of StandardValues - // could actually cause bad things to happen (read: exceptions when the value is actually changed) - // - public ICollection StandardValues - { - get { - if (_standardValues == null) - { - - // Note: this.Converter will return the converter associated with _parent._properties[0] - if (ExtensibilityAccessor.GetStandardValuesSupported(this.Converter)) - { - _standardValues = ExtensibilityAccessor.GetStandardValues(this.Converter); - } - - if (_standardValues == null) - { - _standardValues = new ArrayList(); - } - - for (int i = 1; i < _parent._properties.Count && _standardValues.Count > 0; i++) - { - ArrayList nextSetOfValues = null; - - if (ExtensibilityAccessor.GetStandardValuesSupported(_parent._properties[i].Converter)) - { - nextSetOfValues = ExtensibilityAccessor.GetStandardValues(_parent._properties[i].Converter); - } - - if (nextSetOfValues == null || nextSetOfValues.Count == 0) - { - // The AND of something and nothing = nothing, so clear any remaining list and exit - _standardValues.Clear(); - break; - } - - for (int j = 0; j < _standardValues.Count; j++) - { - - object expectedValue = _standardValues[j]; - - if (!nextSetOfValues.Contains(expectedValue)) - { - _standardValues.RemoveAt(j); - j--; - continue; - } - } - } - } - - Fx.Assert(_standardValues != null, "_standardValues should not be null"); - return _standardValues; - } - } - - // - // Gets a flag indicating whether the list of StandardValues is complete - // or whether the user can type a value that's different from the ones in the list - // - public bool StandardValuesExclusive - { - get { - if (_standardValuesExclusive == null) - { - _standardValuesExclusive = (this.Converter == null || this.Converter.GetStandardValuesExclusive()); - } - - Fx.Assert(_standardValuesExclusive != null, "_standardValuesExclusive should not be null"); - return (bool)_standardValuesExclusive; - } - } - - // - // Gets a flag indicating whether the StandardValues list has any contents. - // - public bool StandardValuesSupported - { - get { - if (_standardValuesSupported == null) - { - _standardValuesSupported = (this.Converter != null && this.Converter.GetStandardValuesSupported()); - } - - Fx.Assert(_standardValuesSupported != null, "_standardValuesSupported should not be null"); - return (bool)_standardValuesSupported; - } - } - - // - // Pick the editor of the first ModelProperty - // - public PropertyValueEditor PropertyValueEditor - { - get { - if (_propertyValueEditor == null) - { - - _propertyValueEditor = - ExtensibilityAccessor.GetCustomPropertyValueEditor(_parent.FirstModelProperty) ?? - ExtensibilityAccessor.GetSubPropertyEditor(_parent.FirstModelProperty); - - if (_propertyValueEditor == null && _parent.PropertyType == typeof(bool)) - { - _propertyValueEditor = new BoolViewEditor(); - } - - _propertyValueEditor = _propertyValueEditor == null ? NoPropertyValueEditor : _propertyValueEditor; - } - - return _propertyValueEditor == NoPropertyValueEditor ? null : _propertyValueEditor; - } - } - - public bool IsMixedValue - { - get { - if (_isMixedValue == null) - { - - _isMixedValue = false; - - if (_parent._properties.Count > 1) - { - - object mergedValue = null; - string mergedValueString = null; - ValueSerializer valueSerializer = null; - - for (int i = 0; i < _parent._properties.Count; i++) - { - ModelProperty property = _parent._properties[i]; - if (i == 0) - { - - // Note: Calling GetValue on ModelProperty has the potential to - // to reset internal stores and, even though the value doesn't change, - // we get a value changed notification. That notification clears - // our _isMixedValue, which, in fact, we want to retain. - // - bool oldIsMixedValue = (bool)_isMixedValue; - mergedValue = ModelUtilities.GetSafeRawValue(property); - _isMixedValue = oldIsMixedValue; - } - else - { - - // See comment above - bool oldIsMixedValue = (bool)_isMixedValue; - object nextValue = ModelUtilities.GetSafeRawValue(property); - _isMixedValue = oldIsMixedValue; - - // Are the objects equal? - if (object.Equals(mergedValue, nextValue)) - { - continue; - } - - // No, so if any of them is null, we might as well bail - if (mergedValue == null || nextValue == null) - { - _isMixedValue = true; - break; - } - - valueSerializer = valueSerializer ?? this.ValueSerializer; - - // If there is no ValueSerializer found, we can't - // be clever and need to bail - if (valueSerializer == null) - { - _isMixedValue = true; - break; - } - - // If we can't even convert the original value to string, - // there is nothing to compare, so we bail - // the CanConvertToString call may throw an ArgumentException, for - // example if mergedValue isn't a supported type - try - { - if (mergedValueString == null && - !valueSerializer.CanConvertToString(mergedValue, null)) - { - _isMixedValue = true; - break; - } - } - catch (ArgumentException) - { - _isMixedValue = true; - break; - } - - if (mergedValueString == null) - { - mergedValueString = valueSerializer.ConvertToString(mergedValue, null); - } - - // Finally, check to see if the nextValue can be converted to string - // and, if so, compare it to the mergedValue. - if (!valueSerializer.CanConvertToString(nextValue, null) || - string.CompareOrdinal(mergedValueString, valueSerializer.ConvertToString(nextValue, null)) != 0) - { - _isMixedValue = true; - break; - } - } - } - } - - } - - return (bool)_isMixedValue; - } - } - - // - // Gets the source of the given property - // - public PropertyValueSource Source - { - get { - if (_source == null && this.IsMixedValue) - { - _source = NoSource; - } - - if (_source == null) - { - - foreach (ModelProperty property in _parent._properties) - { - - if (_source == null) - { - _source = ExtensibilityAccessor.GetPropertySource(property); - - // Default value if we can't figure out anything else (this should never happen) - Fx.Assert(_source != null, "Could not figure out the source for property " + _parent.PropertyName); - _source = _source ?? DependencyPropertyValueSource.Local; - } - else if (_source != ExtensibilityAccessor.GetPropertySource(property)) - { - _source = NoSource; - break; - } - } - } - - return _source == NoSource ? null : _source; - } - } - - public ModelPropertyEntryCollection SubProperties - { - get { - if (_subProperties == null) - { - _subProperties = new ModelPropertyEntryCollection(_parent); - } - - return _subProperties; - } - } - - public bool CollectionInstanceExists - { - get { - return _collection != null; - } - } - - public ModelPropertyValueCollection Collection - { - get { - if (_collection == null) - { - _collection = new ModelPropertyValueCollection(_parent.ModelPropertyValue); - } - - return _collection; - } - } - - // - // Pick the first converter - // - public TypeConverter Converter - { - get { - if (_converter == null) - { - _converter = ExtensibilityAccessor.GetTypeConverter(_parent.FirstModelProperty) ?? NoTypeConverter; - } - - return _converter == NoTypeConverter ? null : _converter; - } - } - - // - // Gets the Type of value instance for this property. For multi-properties, - // CommonValueType returns the Type of all properties if it matches, null otherwise. - // - public Type CommonValueType - { - get { - if (_commonValueType == null) - { - - foreach (ModelProperty modelProperty in _parent.ModelPropertySet) - { - object value = modelProperty.ComputedValue; - if (value != null) - { - Type valueType = value.GetType(); - - if (_commonValueType == null) - { - _commonValueType = valueType; - } - else if (_commonValueType != valueType) - { - _commonValueType = NoCommonValueType; - break; - } - } - else - { - _commonValueType = NoCommonValueType; - break; - } - } - - _commonValueType = _commonValueType ?? NoCommonValueType; - } - - return _commonValueType == NoCommonValueType ? null : _commonValueType; - } - } - - // - // Pick the first PropertyOrder - // - public PropertyOrder PropertyOrder - { - get { - if (_propertyOrder == null) - { - _propertyOrder = ExtensibilityAccessor.GetPropertyOrder(_parent.FirstModelProperty); - _propertyOrder = _propertyOrder ?? NoPropertyOrder; - } - - return _propertyOrder == NoPropertyOrder ? null : _propertyOrder; - } - } - - // - // Gets a list of CategoryEditor types associated with this PropertyEntry - // - public IEnumerable CategoryEditorTypes - { - get { - if (_categoryEditorTypes == null) - { - if (_parent.FirstModelProperty.IsAttached) - { - _categoryEditorTypes = ExtensibilityAccessor.GetCategoryEditorTypes(_parent.FirstModelProperty.AttachedOwnerType); - } - _categoryEditorTypes = _categoryEditorTypes ?? NoCategoryEditorTypes; - } - - return _categoryEditorTypes == NoCategoryEditorTypes ? null : _categoryEditorTypes; - } - } - - public bool IsAttached - { - get { - if (_isAttached == null) - { - _isAttached = _parent.PropertyName.IndexOf('.') > -1; - } - - return (bool)_isAttached; - } - } - - // - // Gets the ValueSerializer corresponding to the property type - // - private ValueSerializer ValueSerializer - { - get { - if (_valueSerializer == null) - { - _valueSerializer = ValueSerializer.GetSerializerFor(_parent.PropertyType) ?? NoSerializer; - } - - return _valueSerializer == NoSerializer ? null : _valueSerializer; - } - } - - // Clear everything this class caches - public void ClearAll() - { - _categoryName = null; - _description = null; - _isAdvanced = null; - _isBrowsable = null; - _propertyValueEditor = null; - _propertyOrder = null; - _categoryEditorTypes = null; - _displayName = null; - - // Internal properties we don't bind to and, hence, - // don't need to fire PropertyChanged event: - _isAttached = null; - - ClearValueRelatedCacheItems(); - - _parent.OnPropertyChanged("CategoryName"); - _parent.OnPropertyChanged("Description"); - _parent.OnPropertyChanged("IsAdvanced"); - _parent.OnPropertyChanged("IsBrowsable"); - _parent.OnPropertyChanged("PropertyValueEditor"); - _parent.OnPropertyChanged("PropertyOrder"); - _parent.OnPropertyChanged("CategoryEditorTypes"); - _parent.OnPropertyChanged("DisplayName"); - } - - // Clear value-related things that this class caches - public void ClearValueRelatedCacheItems() - { - _subProperties = null; - _collection = null; - _standardValues = null; - _standardValuesExclusive = null; - _converter = null; - _commonValueType = null; - _source = null; - _isReadOnly = null; - _valueSerializer = null; - - ClearSubValueRelatedCacheItems(); - - _parent.OnPropertyChanged("StandardValues"); - _parent.OnPropertyChanged("StandardValuesExclusive"); - _parent.OnPropertyChanged("Converter"); - _parent.OnPropertyChanged("CommonValueType"); - _parent.OnPropertyChanged("IsReadOnly"); - - // The following properties are only exposed by ModelPropertyEntry, not PropertyEntry. - // People should bind to these properties through the PropertyValue. - // However, if they ---- up in Xaml, the binding will still work and if that happens - // we should try to update them when things change. - _parent.OnPropertyChanged("SubProperties"); - _parent.OnPropertyChanged("Collection"); - _parent.OnPropertyChanged("Source"); - } - - public void ClearSubValueRelatedCacheItems() - { - _isMixedValue = null; - - // The following property is only exposed by ModelPropertyEntry, not PropertyEntry. - // People should bind to this property through the PropertyValue. - // However, if they ---- up in Xaml, the binding will still work and if that happens - // we should try to update them when things change. - _parent.OnPropertyChanged("IsMixedValue"); - } - - private class NoPropertyValueSource : PropertyValueSource - { - public NoPropertyValueSource() - { - } - } - - private class NoValueSerializer : ValueSerializer - { - public NoValueSerializer() - { - } - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyEntryBase.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyEntryBase.cs deleted file mode 100644 index fefa12f09dd..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyEntryBase.cs +++ /dev/null @@ -1,175 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Model -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.Text; - - using System.Activities.Presentation; - using System.Activities.Presentation.Model; - using System.Activities.Presentation.PropertyEditing; - using System.Activities.Presentation.Services; - - // - // Cider-specific base class for PropertyEntry. It is shared by both - // ModelPropertyEntry and ModelPropertyIndexer. ModelPropertyEntry is used - // to model regular properties that are backed by Cider's ModelProperty. - // ModelPropertyIndexers are used to model items in collections that are - // backed by Cider's ModelItems. - // - internal abstract class ModelPropertyEntryBase : PropertyEntry - { - - // Cache the depth of this property because once a property entry is create - // it doesn't jump levels. Depth is only used to track sub-property tree's - // not collection trees. - private int _depth; - private string _propertyPath; - - protected ModelPropertyEntryBase() : this(null) - { - } - protected ModelPropertyEntryBase(PropertyValue parentValue) : base(parentValue) - { - UpdateDepth(); - } - - public abstract PropertyValueSource Source - { get; } - public abstract bool IsMixedValue - { get; } - public abstract Type CommonValueType - { get; } - public abstract TypeConverter Converter - { get; } - - // - // Gets a flag indicating whether this property exposes any sub-properties. - // We rely on TypeConverter.GetPropertiesSupported() for this value. - // - public bool HasSubProperties - { - get { - return this.PropertyValue.Value != null && this.Converter != null && - this.Converter.GetPropertiesSupported() && !this.IsMarkupExtension; - } - } - - public abstract PropertyEntryCollection SubProperties - { get; } - - // - // Gets a flag indicating whether the type of the contained property - // can be assigned to an IList - // - public bool IsCollection - { - get { - return typeof(IList).IsAssignableFrom(this.PropertyType); - } - } - public abstract PropertyValueCollection Collection - { get; } - - // - // Gets the depth of this property in the PI sub-property tree - // - public virtual int Depth - { - get { - return _depth; - } - } - - // - // Gets a ',' separated path of this property through its - // sub-property hierarchy. - // - public string SubPropertyHierarchyPath - { - get { - if (_propertyPath == null) - { - _propertyPath = ModelUtilities.GetSubPropertyHierarchyPath(this); - } - - return _propertyPath; - } - } - - // - // Checks to see if the value of this property comes from a MarkupExtension - // - internal bool IsMarkupExtension - { - get { - DependencyPropertyValueSource source = this.Source as DependencyPropertyValueSource; - return source != null && source.IsExpression; - } - } - - internal abstract bool CollectionInstanceExists - { get; } - - // - // Convenience accessor - // - protected ModelPropertyValue ModelPropertyValue - { - get { - return (ModelPropertyValue)this.PropertyValue; - } - } - public abstract object GetValueCore(); - public abstract void SetValueCore(object value); - public abstract void ClearValue(); - - // Calculate the depth of this property in the sub-property - // hierarchy - // - private void UpdateDepth() - { - if (ParentValue != null) - { - _depth = ((ModelPropertyEntryBase)ParentValue.ParentProperty).Depth + 1; - } - } - - // - // Called when one of the sub-properties exposed by this class changes. - // There is a call to the concrete implementation of this class so that it - // can do any internal cache clean up as needed, followed by the firing - // of the appropriate changed events. - // - public void OnUnderlyingSubModelChanged() - { - OnUnderlyingSubModelChangedCore(); - this.ModelPropertyValue.OnUnderlyingSubModelChanged(); - } - - // - // Called when one of the sub-properties exposed by this class changes - // that allows the concrete implementation of this class to clean up - // any internal state. - // - protected abstract void OnUnderlyingSubModelChangedCore(); - - // - // Clears or updates any cached values - call this method - // when the underlying ModelProperty changes and cached values - // may have become invalid - // - protected virtual void RefreshCache() - { - UpdateDepth(); - _propertyPath = null; - } - - internal abstract ModelEditingScope BeginEdit(string description); - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyEntryCollection.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyEntryCollection.cs deleted file mode 100644 index 7a6c65b36e9..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyEntryCollection.cs +++ /dev/null @@ -1,177 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Model -{ - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.ComponentModel; - using System.Diagnostics; - using System.Text; - using System.Activities.Presentation.Model; - using System.Activities.Presentation.PropertyEditing; - using System.Runtime; - - // - // Collection of ModelPropertyEntries used to model sub-properties of PropertyValues - // - internal class ModelPropertyEntryCollection : PropertyEntryCollection - { - - List _properties; - - // - // Basic ctor - // - // Parent property - public ModelPropertyEntryCollection(ModelPropertyEntry parentProperty) - : base(parentProperty.PropertyValue) - { - - CreateCollection(parentProperty); - } - - // - // Basic ctor - // - // Parent indexer - public ModelPropertyEntryCollection(ModelPropertyIndexer parentProperty) - : base(parentProperty.PropertyValue) - { - - CreateCollection(parentProperty); - } - - // - // Gets the number of PropertyEntries in this collection - // - public override int Count - { - get { - return _properties == null ? 0 : _properties.Count; - } - } - - // - // Gets the property from this collection of the given name (case sensitive) - // - // Name to look up - // Corresponding PropertyEntry if one exists. - public override PropertyEntry this[string propertyName] { - get { - if (_properties == null) - { - return null; - } - - foreach (ModelPropertyEntry entry in _properties) - { - if (string.Equals(entry.PropertyName, propertyName)) - { - return entry; - } - } - - return null; - } - } - - // - // Gets the enumerator for this collection - // - // - public override IEnumerator GetEnumerator() - { - if (_properties == null) - { - yield break; - } - - for (int i = 0; i < _properties.Count; i++) - { - yield return _properties[i]; - } - } - - // Parses the sub-properties of the given parent collection item and populates a corresponding - // private list of ModelPropertyEntries that represents it. - private void CreateCollection(ModelPropertyIndexer parentCollectionItem) - { - - // Assert some assumptions that should be true at this point - Fx.Assert(parentCollectionItem.ModelItem != null, "parentCollectionItem.ModelItem should not be null"); - - List subProperties = ExtensibilityAccessor.GetSubProperties(parentCollectionItem.ModelItem); - - if (subProperties == null || subProperties.Count < 1) - { - return; - } - - // At this point we have at least one ModelProperty that acts as a subProperty of the - // given ModelItem. Wrap the list in ModelPropertyEntries and exit. - - _properties = new List(subProperties.Count); - - for (int i = 0; i < subProperties.Count; i++) - { - _properties.Add(new ModelPropertyEntry(subProperties[i], (ModelPropertyValue)parentCollectionItem.PropertyValue)); - } - - // Sort the sub-properties by their OrderToken as well as their name - if (_properties != null) - { - _properties.Sort(); - } - } - - private void CreateCollection(ModelPropertyEntry parentProperty) - { - - // Assert some assumptions that should be true at this point - Fx.Assert(parentProperty != null, "parentProperty should not be null"); - Fx.Assert(parentProperty.ModelPropertySet != null, "parentProperty.ModelPropertySet should not be null"); - Fx.Assert(parentProperty.ModelPropertySet.Count > 0, "parentProperty.ModelPropertySet.Count should be > 0"); - - // Ignore sub-properties of MarkupExtensions for v1 - if (parentProperty.IsMarkupExtension) - { - return; - } - - IEnumerable> mergedSubProperties = ModelPropertyMerger.GetMergedSubProperties(parentProperty.ModelPropertySet); - - int index = 0; - bool multiSelect = parentProperty.ModelPropertySet.Count > 1; - foreach (IList subPropertySet in mergedSubProperties) - { - - if (index == 0) - { - _properties = new List(); - } - - ModelPropertyEntry entry; - - if (multiSelect) - { - entry = new ModelPropertyEntry(subPropertySet, (ModelPropertyValue)parentProperty.PropertyValue); - } - else - { - entry = new ModelPropertyEntry(subPropertySet[0], (ModelPropertyValue)parentProperty.PropertyValue); - } - - _properties.Add(entry); - index++; - } - - // Sort the sub-properties by their OrderToken as well as their name - if (_properties != null) - { - _properties.Sort(); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyIndexer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyIndexer.cs deleted file mode 100644 index b5504e02c42..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyIndexer.cs +++ /dev/null @@ -1,375 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Model -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.Globalization; - using System.Text; - - using System.Activities.Presentation; - using System.Activities.Presentation.Model; - using System.Activities.Presentation.PropertyEditing; - - using System.Activities.Presentation.Internal.Properties; - - // - // ModelPropertyIndexer is used to represent ModelItems in a collection. As such - // and unlike ModelProperty, the class wraps around a single ModelItem instead of - // one or more ModelProperties. - // - internal class ModelPropertyIndexer : ModelPropertyEntryBase - { - - private static readonly ICollection EmptyCollection = new object[0]; - - private ModelItem _modelItem; - private int _index; - private ModelPropertyValueCollection _parentCollection; - - private CachedValues _valueCache; - - // - // Basic ctor. Note, however, that this class should only be created by ModelPropertyValueCollection - // as that class ensures that the new instance is correctly added and removed from the - // ModelItemMap. - // - // ModelItem to wrap around - // Index of the ModelItem in the collection - // Parent collection - public ModelPropertyIndexer( - ModelItem modelItem, - int index, - ModelPropertyValueCollection parentCollection) - : base(parentCollection.ParentValue) - { - - if (modelItem == null) - { - throw FxTrace.Exception.ArgumentNull("modelItem"); - } - if (parentCollection == null) - { - throw FxTrace.Exception.ArgumentNull("parentCollection"); - } - - _modelItem = modelItem; - _index = index; - _parentCollection = parentCollection; - _valueCache = new CachedValues(this); - } - - - // - // Gets the index of the underlying ModelItem. If index < 0, this - // ModelPropertyIndexer no longer belongs to a collection and setting its value - // will fail. - // - public int Index - { - get { - return _index; - } - internal set { - _index = value; - } - } - - // - // Gets the name category name of the parent collection - // - public override string CategoryName - { - get { - return _parentCollection.ParentValue.ParentProperty.CategoryName; - } - } - - // - // Gets the description of the parent collection - // - public override string Description - { - get { - return _parentCollection.ParentValue.ParentProperty.Description; - } - } - - // - // Gets the IsAdvanced flag of the parent collection - // - public override bool IsAdvanced - { - get { - return _parentCollection.ParentValue.ParentProperty.IsAdvanced; - } - } - - // - // Returns true - // - public override bool IsReadOnly - { - get { return true; } - } - - // - // Gets the index of this item as string - // - public override string PropertyName - { - get { - return _index.ToString(CultureInfo.InvariantCulture); - } - } - - // - // Gets the type of items in the parent collection - // - public override Type PropertyType - { - get { - return _modelItem.ItemType; - } - } - - // - // Returns null because there are no ValueEditors for values that belong to a collection - // - public override PropertyValueEditor PropertyValueEditor - { - get { - // There are no ValueEditors for items in a collection - return null; - } - } - - // - // Returns an empty collection - there are no StandardValues for items in a collection - // - public override ICollection StandardValues - { - get { - // There are no StandardValues for items in a collection - return EmptyCollection; - } - } - - // - // Returns false - ModelPropertyIndexers always wrap around a single ModelItem - // - public override bool IsMixedValue - { - get { return false; } - } - - // - // Returns Local - this PropertyEntry always contains a collection item value which is local - // - public override PropertyValueSource Source - { - get { return DependencyPropertyValueSource.Local; } - } - - // - // Gets the TypeConverter - // - public override TypeConverter Converter - { - get { - return _valueCache.Converter; - } - } - - // - // Gets the Type of the contained ModelItem - // - public override Type CommonValueType - { - get { - return _modelItem.ItemType; - } - } - - // - // Gets the sub-properties of the underlying item - // - public override PropertyEntryCollection SubProperties - { - get { - return _valueCache.SubProperties; - } - } - - // - // Gets the collection of the underlying ModelItem - // - public override PropertyValueCollection Collection - { - get { - return _valueCache.Collection; - } - } - - // - // Gets the depth of this property in the PI sub-property tree. - // Since this class represents an item in the collection, it's depth - // resets to -1 so that it's children start at depth 0 ( -1 + 1 = 0) again. - // - public override int Depth - { - get { - return -1; - } - } - - - // - // Gets the underlying ModelItem - // - internal ModelItem ModelItem - { - get { - return _modelItem; - } - } - - // - // Gets a flag indicating whether the underlying collection instance has already been - // initialized. Optimization. - // - internal override bool CollectionInstanceExists - { - get { - return _valueCache.CollectionInstanceExists; - } - } - - // - // Creates a new ModelPropertyValue instance - // - // New ModelPropertyValue instance - protected override PropertyValue CreatePropertyValueInstance() - { - return new ModelPropertyValue(this); - } - - // - // Gets the actual object instance respresented by this class - // - // Actual object instance respresented by this class - public override object GetValueCore() - { - return _modelItem.GetCurrentValue(); - } - - // - // Sets the value of the collection item at the same position as the - // ModelItem represented by this class. Identical to removing the old - // item and adding a new one - // - // Value to set - public override void SetValueCore(object value) - { - throw FxTrace.Exception.AsError(new InvalidOperationException(Resources.PropertyEditing_ErrorSetValueOnIndexer)); - } - - // - // Throws an exception -- invalid operation - // - public override void ClearValue() - { - throw FxTrace.Exception.AsError(new InvalidOperationException(Resources.PropertyEditing_ClearIndexer)); - } - - // - // Opens a new ModelEditingScope with the specified description. - // - // Change description (may be null). - // New, opened ModelEditingScope with the specified description - internal override ModelEditingScope BeginEdit(string description) - { - return description == null ? _modelItem.BeginEdit() : _modelItem.BeginEdit(description); - } - - // - // Called when one of the sub-properties exposed by this class changes - // - protected override void OnUnderlyingSubModelChangedCore() - { - // Do nothing. There is nothing in CachedValues right now that would need to - // be refreshed as a result of one of our sub-properties changing value - } - - // Cached values that need to be nixed when the underlying ModelItem changes - // (ie. someone calls SetValueCore()). Pretty much everything in here is an "expensive" - // calculation which requires us to evaluate some attributes associated with the given - // property of set of properties, so we cache the return values and keep that cache - // in a single place so that it's easy to know what needs to be ----d when the underlying - // ModelItem changes. - private class CachedValues - { - - private static readonly TypeConverter NoTypeConverter = new TypeConverter(); - - private ModelPropertyIndexer _parent; - - private TypeConverter _converter; - private ModelPropertyEntryCollection _subProperties; - private ModelPropertyValueCollection _collection; - - public CachedValues(ModelPropertyIndexer indexer) - { - _parent = indexer; - } - - public TypeConverter Converter - { - get { - if (_converter == null) - { - _converter = ExtensibilityAccessor.GetTypeConverter(_parent._modelItem); - _converter = _converter ?? NoTypeConverter; - } - - return _converter == NoTypeConverter ? null : _converter; - } - } - - public ModelPropertyEntryCollection SubProperties - { - get { - if (_subProperties == null) - { - _subProperties = new ModelPropertyEntryCollection(_parent); - } - - return _subProperties; - } - } - - public bool CollectionInstanceExists - { - get { - return _collection != null; - } - } - - public ModelPropertyValueCollection Collection - { - get { - if (_collection == null) - { - _collection = new ModelPropertyValueCollection(_parent.ModelPropertyValue); - } - - return _collection; - } - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyMerger.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyMerger.cs deleted file mode 100644 index f9e06d4c67e..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyMerger.cs +++ /dev/null @@ -1,303 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Model -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Diagnostics.CodeAnalysis; - using System.Text; - using System.Activities.Presentation.Model; - - // - // Helper class that knows how to merge ModelProperties across multiple ModelItems - // - internal static class ModelPropertyMerger - { - - private static IEnumerable> _emptyCollection; - - private static IEnumerable> EmptyCollection - { - get - { - if (_emptyCollection == null) - { - _emptyCollection = new List>(); - } - - return _emptyCollection; - } - } - - // - // Uber method that returns a list of list of ModelProperties that represent the - // merged set of properties across the specified ModelItems - // - // ModelItems to examine - // Count on ModelItems to examine - // List of list of merged properties - public static IEnumerable> GetMergedProperties(IEnumerable items, int itemCount) - { - return GetMergedPropertiesHelper(new ModelItemExpander(items, itemCount)); - } - - // - // Uber method that returns a list of list of ModelProperties that represent the - // merged set of sub-properties across the values of the specified parent properties - // - // ModelProperties to examine - // List of list of merged properties - public static IEnumerable> GetMergedSubProperties(ICollection parentProperties) - { - return GetMergedPropertiesHelper(new SubPropertyExpander(parentProperties)); - } - - // - // Finds the consolidated default property name and returns it. If there is no shared - // default property betweem the specified items, null is returned. - // - // Items to examine - // Shared default property, if any. - public static string GetMergedDefaultProperty(IEnumerable items) - { - if (items == null) - { - return null; - } - - bool firstIteration = true; - string mergedDefaultProperty = null; - - foreach (ModelItem item in items) - { - string currentDefaultProperty = ExtensibilityAccessor.GetDefaultProperty(item.ItemType); - - if (firstIteration) - { - mergedDefaultProperty = currentDefaultProperty; - } - else if (!string.Equals(currentDefaultProperty, mergedDefaultProperty)) - { - mergedDefaultProperty = null; - } - - if (string.IsNullOrEmpty(mergedDefaultProperty)) - { - return null; - } - - firstIteration = false; - } - - return mergedDefaultProperty; - } - - // Optimization that speeds up the common case (single selection) - private static IEnumerable> GetMergedPropertiesHelper(PropertyExpander expander) - { - // Check empty list - if (expander == null || expander.ContainerCount == 0) - { - return EmptyCollection; - } - - if (expander.ContainerCount == 1) - { - // Corner case - one object selected, don't bother with merging - return GetFirstProperties(expander); - } - else - { - // Calculate the list anew - return GetMergedPropertiesCore(expander); - } - } - - // Optimization that speeds up the common case (single selection) - private static IEnumerable> GetFirstProperties(PropertyExpander expander) - { - IEnumerator> propertyContainers = expander.GetEnumerator(); - propertyContainers.MoveNext(); - - if (propertyContainers.Current != null) - { - foreach (ModelProperty property in propertyContainers.Current) - { - yield return new ModelProperty[] { property }; - } - } - } - - private static IEnumerable> GetMergedPropertiesCore(PropertyExpander expander) - { - - Dictionary> counter = new Dictionary>(); - - int containerCounter = 0; - foreach (IEnumerable properties in expander) - { - - if (properties == null) - { - yield break; - } - - foreach (ModelProperty property in properties) - { - - IList existingModelPropertiesForProperty; - if (!counter.TryGetValue(property.Name, out existingModelPropertiesForProperty)) - { - - if (containerCounter == 0) - { - existingModelPropertiesForProperty = new List(expander.ContainerCount); - counter[property.Name] = existingModelPropertiesForProperty; - } - else - { - // This property has not been encountered yet in the previous objects, - // so skip it altogether. - continue; - } - - } - - if (existingModelPropertiesForProperty.Count < containerCounter) - { - // There has been a ModelItem in the list that didn't have this property, - // so delete any record of it and skip it in the future. - counter.Remove(property.Name); - continue; - } - - // Verify that the properties are equivalent - if (containerCounter > 0 && - !ModelUtilities.AreEquivalent( - existingModelPropertiesForProperty[containerCounter - 1], property)) - { - // They are not, so scrap this property altogether - counter.Remove(property.Name); - continue; - } - - existingModelPropertiesForProperty.Add(property); - } - - containerCounter++; - } - - foreach (KeyValuePair> pair in counter) - { - // Once again, if there is a property that is not shared by all - // selected items, ignore it - if (pair.Value.Count < containerCounter) - { - continue; - } - - // We should not set the same instance to multiple properties, - // so ignore types that are not value type or string in case of multi-selection - if (pair.Value.Count > 1 && !(pair.Value[0].PropertyType.IsValueType || pair.Value[0].PropertyType.Equals(typeof(string)))) - { - continue; - } - - yield return (IList)pair.Value; - } - } - - // - // We use the same code to merge properties across a set of ModelItems as well - // as to merge sub-properties across a set of ModelProperties. PropertyExpander - // class is a helper that abstracts the difference between these two inputs, so - // that the merge methods don't have to worry about it. - // - private abstract class PropertyExpander : IEnumerable> - { - public abstract int ContainerCount - { get; } - public abstract IEnumerator> GetEnumerator(); - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } - - // - // Version of PropertyExpander that returns the properties of a set of ModelItems - // - private class ModelItemExpander : PropertyExpander - { - - private IEnumerable _items; - private int _itemCount; - - public ModelItemExpander(IEnumerable items, int itemCount) - { - _items = items; - _itemCount = itemCount; - } - - public override int ContainerCount - { - get { return _itemCount; } - } - - public override IEnumerator> GetEnumerator() - { - if (_items == null) - { - yield break; - } - - foreach (ModelItem item in _items) - { - if (item.Properties == null) - { - continue; - } - - yield return item.Properties; - } - } - } - - // - // Version of PropertyExpander that returns the sub-properties of a set of - // ModelProperty values. - // - private class SubPropertyExpander : PropertyExpander - { - - private ICollection _parentProperties; - - public SubPropertyExpander(ICollection parentProperties) - { - _parentProperties = parentProperties; - } - - public override int ContainerCount - { - get { return _parentProperties == null ? 0 : _parentProperties.Count; } - } - - public override IEnumerator> GetEnumerator() - { - if (_parentProperties == null) - { - yield break; - } - - foreach (ModelProperty property in _parentProperties) - { - yield return ExtensibilityAccessor.GetSubProperties(property); - } - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyValue.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyValue.cs deleted file mode 100644 index 2e1e041e2f7..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyValue.cs +++ /dev/null @@ -1,429 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Model -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.ComponentModel; - using System.Data; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Windows; - using System.Windows.Input; - using System.Windows.Media; - using System.Windows.Media.Imaging; - using System.Text; - - using System.Activities.Presentation; - using System.Activities.Presentation.Model; - using System.Activities.Presentation.PropertyEditing; - - using System.Activities.Presentation.Internal.PropertyEditing.Resources; - using System.Activities.Presentation.Internal.Properties; - using System.Activities.Presentation.Internal.PropertyEditing.Editors; - - // - // Concrete implementation of PropertyValue that delegates to ModelPropertyEntryBase for - // all actions. - // - internal class ModelPropertyValue : PropertyValue - { - - // Object used to mark a property value that should be cleared instead of set - private static readonly object ClearValueMarker = new object(); - - // CultureInfo instance we use for formatting values so that they reflect what is in Xaml - private static CultureInfo _xamlCultureInfo; - - // - // Basic ctor - // - // Parent ModelPropertyEntryBase - public ModelPropertyValue(ModelPropertyEntryBase parentProperty) : base(parentProperty) - { - } - - // - // Returns the source of this property value - // - public override PropertyValueSource Source - { - get { - return ParentModelPropertyEntry.Source; - } - } - - // - // Returns true if this value represents the default value of the property - // - public override bool IsDefaultValue - { - get { - return Source == DependencyPropertyValueSource.DefaultValue; - } - } - - // - // Returns true if the value contained by this property is mixed - // - public override bool IsMixedValue - { - get { - return ParentModelPropertyEntry.IsMixedValue; - } - } - - // - // Returns true if custom TypeConverter exists and if it can convert - // the value from string. - // - public override bool CanConvertFromString - { - get { - return ParentModelPropertyEntry.Converter != null && - ParentModelPropertyEntry.Converter.CanConvertFrom(typeof(string)); - } - } - - // - // Gets a flag indicating whether this PropertyValue has sub properties - // - public override bool HasSubProperties - { - get { - return ParentModelPropertyEntry.HasSubProperties; - } - } - - // - // Gets the sub-properties of the PropertyValue - // - public override PropertyEntryCollection SubProperties - { - get { - return ParentModelPropertyEntry.SubProperties; - } - } - - // - // Gets a flag indicating whether this PropertyValue represents a collection - // - public override bool IsCollection - { - get { - return ParentModelPropertyEntry.IsCollection; - } - } - - // - // Gets the collection represented by this PropertyValue - // - public override PropertyValueCollection Collection - { - get { - return ParentModelPropertyEntry.Collection; - } - } - - // - // This is an internal helper to which we can bind and on which we fire PropertyChanged - // event when the Name sub-property (if one exists) changes. More-specifically, - // we bind to this property in CollectionEditor to display the Type as well as the - // Name of the items in the collection. This property is accessed from XAML. - // - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public PropertyValue NameSensitiveInstance - { - get { - return this; - } - } - - // - // Always catch exceptions - // - protected override bool CatchExceptions - { - get { - return true; - } - } - - // - // Gets an en-us CultureInfo that ignores user-specified settings - // - private static CultureInfo XamlCultureInfo - { - get { - if (_xamlCultureInfo == null) - { - _xamlCultureInfo = new CultureInfo("en-us", false); - } - - return _xamlCultureInfo; - } - } - - // Convenience accessor - private ModelPropertyEntryBase ParentModelPropertyEntry - { - get { - return (ModelPropertyEntryBase)this.ParentProperty; - } - } - - // - // Validates the value using the TypeConverter, if one exists - // - // Value to validate - protected override void ValidateValue(object valueToValidate) - { - // Noop. We used to rely on TypeConverter.IsValid() here, but it turns out - // that a bunch of standard TypeConverters don't really work (eg. Int32TypeConverter - // returns true for IsValid("abc") and EnumConverter returns false for - // IsValid(MyEnum.One | MyEnum.Two) even if MyEnum if adorned with FlagsAttribute) - } - - // Called when there exists a Name sub-property for this value and it changes - internal void OnNameSubPropertyChanged() - { - // Updates XAML bindings (collection editor item-display-name-template for one) - this.OnPropertyChanged("NameSensitiveInstance"); - } - - // - // Convert the specified string to a value - // - // - // - protected override object ConvertStringToValue(string stringToConvert) - { - if (this.ParentProperty.PropertyType == typeof(string)) - { - return stringToConvert; - } - else if (string.IsNullOrEmpty(stringToConvert)) - { - - // If the type of this property is string: - // - // StringValue of '' -> set Value to '' - // StringValue of null -> ClearValue() - // - // Otherwise - // - // StringValue of '' -> ClearValue() - // StringValue of null -> ClearValue() - // - if (stringToConvert != null && typeof(string).Equals(this.ParentProperty.PropertyType)) - { - return null; - } - else - { - return ClearValueMarker; - } - - } - else if (EditorUtilities.IsNullableEnumType(this.ParentProperty.PropertyType) && stringToConvert.Equals(EditorUtilities.NullString, StringComparison.Ordinal)) - { - // PS 107537: Special case handling when converting a string to a nullable enum type. - return null; - } - else if (this.ParentModelPropertyEntry.Converter != null && - this.ParentModelPropertyEntry.Converter.CanConvertFrom(typeof(string))) - { - - return this.ParentModelPropertyEntry.Converter.ConvertFromString(null, XamlCultureInfo, stringToConvert); - } - - throw FxTrace.Exception.AsError(new InvalidOperationException(string.Format( - CultureInfo.CurrentCulture, - Resources.PropertyEditing_NoStringToValueConversion, - this.ParentProperty.DisplayName))); - } - - // - // Convert the specified value to a string - // - // - // - protected override string ConvertValueToString(object valueToConvert) - { - string stringValue = string.Empty; - - if (valueToConvert == null) - { - if (typeof(IList).IsAssignableFrom(this.ParentProperty.PropertyType)) - { - stringValue = Resources.PropertyEditing_DefaultCollectionStringValue; - } - else if (EditorUtilities.IsNullableEnumType(this.ParentProperty.PropertyType)) - { - // PS 107537: Special case handling when converting a nullable enum type to a string. - return EditorUtilities.NullString; - } - return stringValue; - } - else if ((stringValue = valueToConvert as string) != null) - { - return stringValue; - } - - TypeConverter typeConverter = this.ParentModelPropertyEntry.Converter; - if (valueToConvert is Array) - { - stringValue = Resources.PropertyEditing_DefaultArrayStringValue; - } - else if (valueToConvert is IList - || valueToConvert is ICollection - || ModelUtilities.ImplementsICollection(valueToConvert.GetType()) - || ModelUtilities.ImplementsIList(valueToConvert.GetType())) - { - stringValue = Resources.PropertyEditing_DefaultCollectionStringValue; - } - else if (valueToConvert is IEnumerable) - { - stringValue = Resources.PropertyEditing_DefaultEnumerableStringValue; - } - else if (typeConverter != null && typeConverter.CanConvertTo(typeof(string))) - { - stringValue = typeConverter.ConvertToString(null, XamlCultureInfo, valueToConvert); - } - else - { - stringValue = valueToConvert.ToString(); - } - - return stringValue ?? string.Empty; - } - - - // - // Redirect the call to parent PropertyEntry - // - // - protected override object GetValueCore() - { - return ParentModelPropertyEntry.GetValueCore(); - } - - // - // Redirect the call to parent PropertyEntry - // - // - protected override void SetValueCore(object value) - { - if (value == ClearValueMarker) - { - ParentModelPropertyEntry.ClearValue(); - } - else - { - ParentModelPropertyEntry.SetValueCore(value); - } - } - - // - // Apply the FlowDirection to the resource. - // - private void CheckAndSetFlowDirectionResource() - { - // Check if the value being edited is FlowDirection - // and if so, reset the resource to the current value that the user is setting. - // This will refresh the property inspector and all the string editors, showing "string" properties, - // would have their FlowDirection set to the current value. - if (ParentModelPropertyEntry.PropertyName.Equals(FrameworkElement.FlowDirectionProperty.Name)) - { - object value = Value; - if (value != null) - { - PropertyInspectorResources.GetResources()["SelectedControlFlowDirectionRTL"] = value; - } - } - } - - // - // Redirect the call to parent PropertyEntry - // - public override void ClearValue() - { - ParentModelPropertyEntry.ClearValue(); - } - - // - // Fires the appropriate PropertyChanged events - // - public void OnUnderlyingModelChanged() - { - CheckAndSetFlowDirectionResource(); - this.NotifyRootValueChanged(); - } - - // - // Fires the appropriate PropertyChanged events - // - public void OnUnderlyingSubModelChanged() - { - this.NotifySubPropertyChanged(); - } - - // - // Called when there is an error setting or getting a PropertyValue. - // Displays an error dialog. - // - // - protected override void OnPropertyValueException(PropertyValueExceptionEventArgs e) - { - if (e.Source == PropertyValueExceptionSource.Set) - { - if (e.Exception != null) - { - Debug.WriteLine(e.Exception.ToString()); - } - - ErrorReporting.ShowErrorMessage(e.Exception.Message); - - base.OnPropertyValueException(e); - } - else - { - base.OnPropertyValueException(e); - } - } - - // - // Debuging-friendly ToString() - // - // - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - public override string ToString() - { - try - { - string value; - if (this.Value == null) - { - value = "{null}"; - } - else - { - value = this.StringValue; - if (string.IsNullOrEmpty(value)) - { - value = "{empty}"; - } - } - - return string.Format(CultureInfo.CurrentCulture, "{0} (PropertyValue)", value ?? "{null}"); - } - catch - { - return base.ToString(); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyValueCollection.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyValueCollection.cs deleted file mode 100644 index 2a98410bad2..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelPropertyValueCollection.cs +++ /dev/null @@ -1,530 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Model -{ - using System; - using System.Collections.Generic; - using System.Collections.Specialized; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Text; - - using System.Activities.Presentation; - using System.Activities.Presentation.Model; - using System.Activities.Presentation.PropertyEditing; - - using System.Activities.Presentation.Internal.Properties; - using System.Runtime; - - // - // Collection of ModelPropertyValues used to model collections of ModelItems - // - internal class ModelPropertyValueCollection : PropertyValueCollection - { - - private List _values; - private bool _listenToCollectionChanges = true; - - // - // Basic ctor - // - // Parent PropertyValue - public ModelPropertyValueCollection(ModelPropertyValue parentValue) : base(parentValue) - { - if (parentValue == null) - { - throw FxTrace.Exception.ArgumentNull("parentValue"); - } - - // Wrap each existing item in the collection in ModelPropertyEntryIndexer - ModelItemCollection collection = this.GetRawCollection(); - if (collection != null && collection.Count > 0) - { - _values = new List(); - int i = 0; - foreach (ModelItem item in collection) - { - _values.Add(CreateModelPropertyIndexer(item, i++)); - } - } - - // Hook into the collection changed events - if (collection != null) - { - collection.CollectionChanged += new NotifyCollectionChangedEventHandler(OnUnderlyingCollectionChanged); - } - } - - // - // Gets the number of items in this collection - // - public override int Count - { - get { - return _values == null ? 0 : _values.Count; - } - } - - // - // Gets the PropertyValue at the specified index - // - // Index to look up - // PropertyValue at the specified index - public override PropertyValue this[int index] { - get { - VerifyExistingIndex(index); - return _values[index].PropertyValue; - } - } - - // - // Adds the specified object to this collection, returning its wrapped version - // - // Value to add and wrap in PropertyValue - // Wrapped value - public override PropertyValue Add(object value) - { - return Insert(value, this.Count); - } - - // - // Inserts the specified object into this collection, returning its wrapped version - // - // Value to insert and wrap - // Index to insert at - // Wrapped version of the inserted value - public override PropertyValue Insert(object value, int index) - { - VerifyNewIndex(index); - - if (_values == null) - { - _values = new List(); - } - - ModelItem item; - bool previouslyActive = SnoozeListeningToCollectionChanges(); - try - { - item = GetRawCollection().Insert(index, value); - } - finally - { - StartListeningToCollectionChanges(previouslyActive); - } - - return InsertExternal(item, index); - } - - // Same as Insert(), except it doesn't modify the raw collection, because it assumes - // that the raw collection was already modified externally. - private PropertyValue InsertExternal(ModelItem item, int index) - { - if (_values == null) - { - _values = new List(); - } - - PropertyValue insertedValue = InsertHelper(item, index); - - // Fire OnChanged event - this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, insertedValue, index)); - - return insertedValue; - } - - // Updates internal structures, but does not fire any notification - private PropertyValue InsertHelper(ModelItem item, int index) - { - // Only insert the value into the collection, if it's not already there. - // Say that an ItemAdded event comes in even though this collection has not yet been used. - // By requesting the instance of this collection for the first time, the collection - // gets populated correctly and fully. Now when InsertExternal is called as a result - // of the ItemAdded event, we would be adding the new item into the collection twice. - // We need to prevent that from happening. - if (_values.Count > index && - object.Equals(_values[index].ModelItem, item)) - { - return _values[index].PropertyValue; - } - - ModelPropertyIndexer indexer = CreateModelPropertyIndexer(item, index); - _values.Insert(index, indexer); - - // Adjust all indexes of the remaining indexers in the list - for (int i = index + 1; i < _values.Count; i++) - { - _values[i].Index++; - } - - return indexer.PropertyValue; - } - - // - // Removes the specified PropertyValue from the collection. - // - // Property to remove - // True, if the PropertyValue was found and removed, false - // otherwise. - public override bool Remove(PropertyValue propertyValue) - { - if (propertyValue == null) - { - throw FxTrace.Exception.ArgumentNull("property"); - } - - if (_values == null) - { - return false; - } - - for (int i = 0; i < _values.Count; i++) - { - if (_values[i].PropertyValue == propertyValue) { - this.RemoveAt(i); - return true; - } - } - - // Call to RemoveAt() already fires the right CollectionChanged events - return false; - } - - // Same as Remove, except it doesn't modify the raw collection, because it's - // assumed that the raw collection was already modified externally. - private bool RemoveExternal(ModelItem item) - { - Fx.Assert(item != null, "item parameter should not be null"); - Fx.Assert(_values != null, "_values parameter should not be null"); - - for (int i = 0; i < _values.Count; i++) - { - if (_values[i].ModelItem == item) { - this.RemoveAtExternal(i); - return true; - } - } - - return false; - } - - // - // Removes the PropertyValue at the specified index. - // - // Index at which to remove the value. - public override void RemoveAt(int index) - { - VerifyExistingIndex(index); - - bool previouslyActive = SnoozeListeningToCollectionChanges(); - try - { - this.GetRawCollection().RemoveAt(index); - } - finally - { - StartListeningToCollectionChanges(previouslyActive); - } - - RemoveAtExternal(index); - } - - // Same as RemoveAt, except it doesn't modify the raw collection, because it's - // assumed that the raw collection was already modified externally. - private void RemoveAtExternal(int index) - { - VerifyExistingIndex(index); - PropertyValue removedValue = RemoveAtHelper(index); - - // Fire OnChanged event - this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, removedValue, index)); - } - - // Updates internal structures, but does not fire any notification - private PropertyValue RemoveAtHelper(int index) - { - // invalidate the ModelPropertyEntryIndexer at the index and adjust all other indexes - ModelPropertyIndexer indexer = _values[index]; - DestroyModelPropertyIndexer(indexer); - - _values.RemoveAt(index); - for (int i = index; i < _values.Count; i++) - { - _values[i].Index--; - } - - return indexer.PropertyValue; - } - - // Replaces the old ModelItem with the new one, assuming that the raw collection - // has already been verified - private void ReplaceExternal(ModelItem oldItem, ModelItem newItem) - { - Fx.Assert(_values != null, "_values parameter should not be null"); - Fx.Assert(oldItem != null, "oldItem parameter should not be null"); - Fx.Assert(newItem != null, "newItem parameter should not be null"); - - for (int i = 0; i < _values.Count; i++) - { - if (_values[i].ModelItem == oldItem) { - this.RemoveAtHelper(i); - this.InsertHelper(newItem, i); - - // Fire OnChanged event - this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, _values[i].PropertyValue)); - return; - } - } - - Debug.Fail("Didn't find the expected item to remove"); - } - - // Clears the collection, assuming that the raw collection was already cleared externally - private void ClearExternal() - { - _values.Clear(); - this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); - } - - // - // Swaps the items at the specified indexes - // - // Index of item 1 - // Index of item 2 - public override void SetIndex(int currentIndex, int newIndex) - { - - VerifyExistingIndex(currentIndex); - VerifyExistingIndex(newIndex); - - if (currentIndex == newIndex) - { - return; - } - - ModelItemCollection collection = this.GetRawCollection(); - ModelPropertyIndexer currentIndexer = _values[currentIndex]; - ModelPropertyIndexer newIndexer = _values[newIndex]; - - bool previouslyActive = SnoozeListeningToCollectionChanges(); - try - { - // Remove the higher index first (doesn't affect the value of the lower index) - if (currentIndex < newIndex) - { - collection.RemoveAt(newIndex); - collection.RemoveAt(currentIndex); - } - else - { - collection.RemoveAt(currentIndex); - collection.RemoveAt(newIndex); - } - - // Insert the lower index first (fixes the value of the higher index) - if (currentIndex < newIndex) - { - collection.Insert(currentIndex, newIndexer.ModelItem); - collection.Insert(newIndex, currentIndexer.ModelItem); - } - else - { - collection.Insert(newIndex, currentIndexer.ModelItem); - collection.Insert(currentIndex, newIndexer.ModelItem); - } - } - finally - { - StartListeningToCollectionChanges(previouslyActive); - } - - SetIndexExternal(currentIndex, newIndex); - } - - // Same as SetIndex, except it doesn't modify the raw collection, because it's - // assumed that the raw collection was already modified externally. - private void SetIndexExternal(int currentIndex, int newIndex) - { - - if (currentIndex == newIndex) - { - return; - } - - ModelPropertyIndexer currentIndexer = _values[currentIndex]; - ModelPropertyIndexer newIndexer = _values[newIndex]; - - // Remove the higher index first (doesn't affect the value of the lower index) - if (currentIndex < newIndex) - { - _values.RemoveAt(newIndex); - _values.RemoveAt(currentIndex); - } - else - { - _values.RemoveAt(currentIndex); - _values.RemoveAt(newIndex); - } - - // Insert the lower index first (fixes the value of the higher index) - if (currentIndex < newIndex) - { - _values.Insert(currentIndex, newIndexer); - _values.Insert(newIndex, currentIndexer); - } - else - { - _values.Insert(newIndex, currentIndexer); - _values.Insert(currentIndex, newIndexer); - } - - newIndexer.Index = currentIndex; - currentIndexer.Index = newIndex; - - // Fire OnChanged event - this.OnCollectionChanged(new NotifyCollectionChangedEventArgs( - NotifyCollectionChangedAction.Move, currentIndexer.PropertyValue, newIndex, currentIndex)); - } - - // - // Gets the underlying ModelItemCollection - // - // The underlying ModelItemCollection - internal ModelItemCollection GetRawCollection() - { - ModelPropertyEntry parentAsEntry = ParentValue.ParentProperty as ModelPropertyEntry; - if (parentAsEntry != null) - { - return parentAsEntry.FirstModelProperty.Collection; - } - - ModelPropertyIndexer parentAsIndexer = ParentValue.ParentProperty as ModelPropertyIndexer; - if (parentAsIndexer != null) - { - ModelItemCollection modelItemCollection = parentAsIndexer.ModelItem as ModelItemCollection; - - // If the parent is an indexer, that means we are a collection within another collection - // and the ModelItem of the indexer is really a ModelItemCollection. - Fx.Assert(modelItemCollection != null, "modelItemCollection should not be null"); - - return modelItemCollection; - } - - Debug.Fail("A new class was introduced that derives from PropertyEntry. Need to update ModelPropertyValueCollection code as well."); - return null; - } - - // - // Gets the enumerator over this collection - // - // Enumerator over this collection - public override IEnumerator GetEnumerator() - { - if (_values == null) - { - yield break; - } - - foreach (ModelPropertyIndexer value in _values) - { - yield return value.PropertyValue; - } - } - - // Handler for all collection changed events that happen through the model - private void OnUnderlyingCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) - { - if (!_listenToCollectionChanges) - { - return; - } - - switch (e.Action) - { - case NotifyCollectionChangedAction.Add: - int startingIndex = e.NewStartingIndex < 0 ? this.Count : e.NewStartingIndex; - foreach (ModelItem item in e.NewItems) - { - this.InsertExternal(item, startingIndex++); - } - break; - - case NotifyCollectionChangedAction.Remove: - foreach (ModelItem item in e.OldItems) - { - this.RemoveExternal(item); - } - break; - - case NotifyCollectionChangedAction.Move: - int oldIndex = e.OldStartingIndex, newIndex = e.NewStartingIndex; - for (int i = 0; i < e.OldItems.Count; i++) - { - this.SetIndexExternal(oldIndex++, newIndex++); - } - - break; - - case NotifyCollectionChangedAction.Replace: - for (int i = 0; i < e.OldItems.Count; i++) - { - ModelItem oldItem = e.OldItems[i] as ModelItem; - ModelItem newItem = e.NewItems[i] as ModelItem; - this.ReplaceExternal(oldItem, newItem); - } - break; - - case NotifyCollectionChangedAction.Reset: - this.ClearExternal(); - break; - } - } - - // Activates the CollectionChanged event handler - private void StartListeningToCollectionChanges(bool previousValue) - { - _listenToCollectionChanges = previousValue; - } - - // Suspends the CollectionChanged event handler - private bool SnoozeListeningToCollectionChanges() - { - bool previousValue = _listenToCollectionChanges; - _listenToCollectionChanges = false; - return previousValue; - } - - [SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] - private void VerifyExistingIndex(int index) - { - if (_values == null || _values.Count <= index || index < 0) - { - throw FxTrace.Exception.AsError(new IndexOutOfRangeException(index.ToString(CultureInfo.InvariantCulture))); - } - } - - [SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] - private void VerifyNewIndex(int index) - { - if ((_values == null && index != 0) || - (_values != null && _values.Count < index) || - index < 0) - { - throw FxTrace.Exception.AsError(new IndexOutOfRangeException(index.ToString(CultureInfo.InvariantCulture))); - } - } - - private ModelPropertyIndexer CreateModelPropertyIndexer(ModelItem item, int index) - { - ModelPropertyIndexer indexer = new ModelPropertyIndexer(item, index, this); - return indexer; - } - - private static void DestroyModelPropertyIndexer(ModelPropertyIndexer indexer) - { - indexer.Index = -1; - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelUtilities.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelUtilities.cs deleted file mode 100644 index 9c27ef2a65a..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/ModelUtilities.cs +++ /dev/null @@ -1,258 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Model -{ - using System; - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - using System.Text; - using System.Windows.Markup; - using System.Activities.Presentation.Model; - using System.Activities.Presentation.PropertyEditing; - - // - // Static class full of useful helpers - // - internal static class ModelUtilities - { - public static Type GetPropertyType(IEnumerable propertySet) - { - // all the ModelProperty should be of the same type, so returning the first type. - foreach (ModelProperty property in propertySet) - { - return property.PropertyType; - } - return null; - } - - // - // Compares the name and Type of the specified ModelProperties, - // returning true if they are equal. - // - // ModelProperty A - // ModelProperty B - // True if the names and Types of the specified ModelProperties - // match, false otherwise. - public static bool AreEquivalent(ModelProperty a, ModelProperty b) - { - return object.Equals(a.Name, b.Name) && - object.Equals(a.PropertyType, b.PropertyType); - } - - // - // Gets the underlying value object of the specified ModelProperty. MarkupExtensions - // (resources and such) will be returned as they are, with the exception of NullExtension, - // which will be returned as null. - // - // ModelProperty to ---- open (can be null) - // Underlying value object, if any - public static object GetSafeRawValue(ModelProperty property) - { - return GetSafeValue(property, false); - } - - // - // Gets the underlying computed value object of the specified ModelProperty. MarkupExtensions - // (resources and such) will be resolved into their final value. - // - // ModelProperty to ---- open (can be null) - // Underlying value object, if any - public static object GetSafeComputedValue(ModelProperty property) - { - return GetSafeValue(property, true); - } - - private static object GetSafeValue(ModelProperty property, bool resolveReferences) - { - if (property == null) - { - return null; - } - - object value; - - // We have to special case TextBlock due to IAddChild behavior with Text and Inlines - if (resolveReferences && !(typeof(System.Windows.Controls.TextBlock).IsAssignableFrom(property.Parent.ItemType) && - property.Name.Equals(System.Windows.Controls.TextBlock.TextProperty.Name))) - { - value = property.ComputedValue; - } - else - { - value = property.Value == null ? null : property.Value.GetCurrentValue(); - } - - if (value == null || value.GetType().Equals(typeof(NullExtension))) - { - return null; - } - - return value; - } - - // - // Looks for the x:Name or Name property of the given PropertyValue and returns it if found. - // Note: this method is expensive because it evaluates all the sub-properties of the given - // PropertyValue. - // - // PropertyValue instance to look at - // Name if the PropertyValue defines one, null otherwise - public static string GetPropertyName(PropertyValue propertyValue) - { - if (propertyValue == null) - { - return null; - } - - if (propertyValue.HasSubProperties) - { - PropertyEntry nameProperty = propertyValue.SubProperties["Name"]; - if (nameProperty != null) - { - return nameProperty.PropertyValue.StringValue; - } - } - - return null; - } - - // - // Returns ',' separated property name for sub-properties, going all the way - // to the root ancestor in the property editing OM. (ie. you get strings - // such as 'ContextMenu,IsEnabled' instead of just 'IsEnabled'. - // - // Property to get the name of - // ',' separated property name for sub-properties - public static string GetSubPropertyHierarchyPath(PropertyEntry property) - { - if (property == null) - { - return null; - } - - if (property.ParentValue == null) - { - return property.PropertyName; - } - - StringBuilder sb = new StringBuilder(); - do - { - if (sb.Length > 0) - { - sb.Insert(0, ','); - } - - sb.Insert(0, property.PropertyName); - property = property.ParentValue == null ? null : property.ParentValue.ParentProperty; - - } while (property != null && !(property is ModelPropertyIndexer)); - - return sb.ToString(); - } - - // - // Same as GetSubPropertyHierarchyPath(), but it looks up a cached version - // of this path, if one exists, or calculates one from scratch and caches it - // if it doesn't. - // - // Property to get the name of - // ',' separated property name for sub-properties - public static string GetCachedSubPropertyHierarchyPath(PropertyEntry property) - { - ModelPropertyEntry mpe = property as ModelPropertyEntry; - return mpe == null ? GetSubPropertyHierarchyPath(property) : mpe.SubPropertyHierarchyPath; - } - - // - // Determines whether the specified type is implement generic Ilist interface. - // - // The type. - // - // true if the specified type is implement generic Ilist interface;otherwise, false. - // - public static bool ImplementsIList(Type type) - { - bool ret = false; - if (!type.IsGenericType) - { - ret = false; - } - Type[] interfaceTypes = type.GetInterfaces(); - foreach (Type interfaceType in interfaceTypes) - { - if (interfaceType.IsGenericType && - interfaceType.GetGenericTypeDefinition() == typeof(IList<>)) - { - ret = true; - break; - } - } - return ret; - } - - // - // Determines whether the specified type is implement generic ICollection interface. - // - // The type. - // - // true if the specified type is implement generic ICollection interface;otherwise, false. - // - public static bool ImplementsICollection(Type type) - { - bool ret = false; - if (!type.IsGenericType) - { - ret = false; - } - Type[] interfaceTypes = type.GetInterfaces(); - foreach (Type interfaceType in interfaceTypes) - { - if (interfaceType.IsGenericType && - interfaceType.GetGenericTypeDefinition() == typeof(ICollection<>)) - { - ret = true; - break; - } - } - return ret; - } - - // - // Tries to determine the common type ancestor of the specified types - // - // Type 1 - // Type 2 - // Common ancestor Type, if any - public static Type GetCommonAncestor(Type t1, Type t2) - { - if (t1 == null || t2 == null) - { - return null; - } - - if (t1 == typeof(object) || t2 == typeof(object)) - { - return typeof(object); - } - - if (t1.IsAssignableFrom(t2)) - { - return t1; - } - - while (t2 != typeof(object)) - { - if (t2.IsAssignableFrom(t1)) - { - return t2; - } - - t2 = t2.BaseType; - } - - return typeof(object); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/PropertyEntryNameComparer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/PropertyEntryNameComparer.cs deleted file mode 100644 index 4d29abf6cde..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/PropertyEntryNameComparer.cs +++ /dev/null @@ -1,57 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Model -{ - using System; - using System.Collections; - using System.Collections.Generic; - - using System.Activities.Presentation.PropertyEditing; - - // - // Compares PropertyEntry instances solely on their DisplayName - // - internal class PropertyEntryNameComparer : IComparer, IComparer - { - - public static readonly PropertyEntryNameComparer Instance = new PropertyEntryNameComparer(); - - private static int CompareCore(object x, object y) - { - ModelPropertyEntry j = x as ModelPropertyEntry; - ModelPropertyEntry k = y as ModelPropertyEntry; - - if (j == null && k == null) - { - return 0; - } - if (j == null) - { - return -1; - } - if (k == null) - { - return 1; - } - - return string.Compare(j.DisplayName, k.DisplayName, StringComparison.CurrentCulture); - } - - // IComparer Members - - public int Compare(PropertyEntry x, PropertyEntry y) - { - return CompareCore(x, y); - } - - - // IComparer Members - - public int Compare(object x, object y) - { - return CompareCore(x, y); - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/PropertyEntryPropertyOrderComparer.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/PropertyEntryPropertyOrderComparer.cs deleted file mode 100644 index e80e1d69df5..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Model/PropertyEntryPropertyOrderComparer.cs +++ /dev/null @@ -1,89 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing.Model -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Activities.Presentation.PropertyEditing; - - // - // Compares PropertyEntry instances based on their PropertyOrder tokens - // as well as their DisplayNames - // - internal class PropertyEntryPropertyOrderComparer : IComparer, IComparer - { - - private static readonly PropertyOrder DefaultOrder = PropertyOrder.Default; - private static PropertyEntryPropertyOrderComparer _instance; - - // - // Gets a singleton instance of this class - // - public static PropertyEntryPropertyOrderComparer Instance - { - get { - if (_instance == null) - { - _instance = new PropertyEntryPropertyOrderComparer(); - } - - return _instance; - } - } - - // - // Compares two instances of PropertyEntry class, using both - // PropertyOrder and DisplayName to cast its vote. - // - // Left side - // Right side - // Comparison result - public int Compare(object x, object y) - { - return CompareCore(x, y); - } - - // - // Compares two instances of PropertyEntry class, using both - // PropertyOrder and DisplayName to cast its vote. - // Same method, different signature. - // - // Left - // Right - // Left side - // Right side - // Comparison result - public int Compare(PropertyEntry x, PropertyEntry y) - { - return CompareCore(x, y); - } - - private static int CompareCore(object x, object y) - { - ModelPropertyEntry j = x as ModelPropertyEntry; - ModelPropertyEntry k = y as ModelPropertyEntry; - - if (j == null && k == null) - { - return 0; - } - if (j == null) - { - return -1; - } - if (k == null) - { - return 1; - } - - PropertyOrder a = j.PropertyOrder ?? DefaultOrder; - PropertyOrder b = k.PropertyOrder ?? DefaultOrder; - - int result = a.CompareTo(b); - - return result != 0 ? result : string.Compare(j.DisplayName, k.DisplayName, StringComparison.CurrentCulture); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyInspector.xaml.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyInspector.xaml.cs deleted file mode 100644 index a97aca163a8..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyInspector.xaml.cs +++ /dev/null @@ -1,1052 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Windows; - using System.Windows.Automation.Peers; - using System.Windows.Controls; - using System.Windows.Media; - using System.Windows.Media.Imaging; - using System.Windows.Shapes; - using System.Windows.Threading; - - using System.Activities.Presentation; - using System.Activities.Presentation.Model; - using View = System.Activities.Presentation.View; - using System.Activities.Presentation.PropertyEditing; - using System.Runtime; - - using System.Activities.Presentation.Internal.PropertyEditing.Automation; - using System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.ValueEditors; - using System.Activities.Presentation.Internal.PropertyEditing.Model; - using ModelUtilities = System.Activities.Presentation.Internal.PropertyEditing.Model.ModelUtilities; - using System.Activities.Presentation.Internal.PropertyEditing.Resources; - using System.Activities.Presentation.Internal.PropertyEditing.Selection; - using System.Activities.Presentation.Internal.PropertyEditing.State; - using System.Text; - using Microsoft.Activities.Presentation; - - // - // The main control that acts as the PropertyInspector - // - [SuppressMessage(FxCop.Category.Naming, "CA1724:TypeNamesShouldNotMatchNamespaces", - Justification = "Code imported from Cider; keeping changes to a minimum as it impacts xaml files as well")] - partial class PropertyInspector : - INotifyPropertyChanged - { - - private static readonly Size DesiredIconSize = new Size(40, 40); - - private View.Selection _displayedSelection; - private View.Selection _lastNotifiedSelection; - private ModelItem _lastParent; - - private bool _ignoreSelectionNameChanges; - - private List _pendingTransactions = new List(); - private PropertyValueEditorCommandHandler _defaultCommandHandler; - private IStateContainer _sessionStateContainer; - - private SelectionPath _lastSelectionPath; - private bool _objectSelectionInitialized; - - private bool _disposed; - private bool _isReadOnly; - - private string propertyPathToSelect; - - private ContextItemManager designerContextItemManager; - private DesignerPerfEventProvider designerPerfEventProvider; - - // Map between currently displayed category editors and the names of the categories they belong to - private Dictionary _activeCategoryEditors = new Dictionary(); - - // - // Basic ctor - // - // FxCop complains this.DataContext, which is somewhat bogus - [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] - public PropertyInspector() - { - this.DataContext = this; - - HookIntoCommands(); - - this.InitializeComponent(); - - //Handle the commit and cancel keys within the property inspector - ValueEditorUtils.SetHandlesCommitKeys(this, true); - - _propertyToolBar.CurrentViewManagerChanged += new EventHandler(OnCurrentViewManagerChanged); - } - - // - // Event fired when the IsInAlphaView changes as a result of some - // user or internal interaction. When IsInAlphaView is set by the - // external host, this event will not and should not be fired. - // - public event EventHandler RootViewModified; - - public event PropertyChangedEventHandler PropertyChanged; - - [SuppressMessage("Microsoft.Design", "CA1044:PropertiesShouldNotBeWriteOnly", Justification = "No need for a Setter")] - public ContextItemManager DesignerContextItemManager - { - set - { - this.designerContextItemManager = value; - this.designerContextItemManager.Subscribe(this.OnSelectionChanged); - } - } - - // - // Gets a value indicating whether the selected object Name should be read-only - // - public bool IsInfoBarNameReadOnly - { - get - { - return _displayedSelection == null || _displayedSelection.SelectionCount != 1; - } - } - - // - // Gets the selection name to display - // - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Propagating the error might cause VS to crash")] - [SuppressMessage("Reliability", "Reliability108", Justification = "Propagating the error might cause VS to crash")] - public string SelectionName - { - get - { - if (_displayedSelection == null || _displayedSelection.SelectionCount == 0) - { - return null; - } - - if (_displayedSelection.SelectionCount == 1) - { - return _displayedSelection.PrimarySelection.Name; - } - - return System.Activities.Presentation.Internal.Properties.Resources.PropertyEditing_MultipleObjectsSelected; - } - set - { - if (_disposed) - { - return; - } - - if (CanSetSelectionName(_displayedSelection)) - { - ModelItem selection = _displayedSelection.PrimarySelection; - Fx.Assert(selection != null, "PrimarySelection should not be null"); - - try - { - _ignoreSelectionNameChanges = true; - - using (ModelEditingScope change = selection.BeginEdit(System.Activities.Presentation.Internal.Properties.Resources.PropertyEditing_NameChangeUndoText)) - { - if (string.IsNullOrEmpty(value)) - { - // Null with cause ClearValue to be called in the base implementation on the NameProperty - selection.Name = null; - } - else - { - selection.Name = value; - } - - if (change != null) - change.Complete(); - } - } - catch (Exception e) - { - Debug.WriteLine(e.ToString()); - - ErrorReporting.ShowErrorMessage(e.Message); - } - finally - { - _ignoreSelectionNameChanges = false; - } - - OnPropertyChanged("SelectionName"); - } - else - { - Debug.Fail("Shouldn't be able to set a selection name if no or more than one object is selected."); - } - } - } - - // - // Gets the icon for the selection - // - public object SelectionIcon - { - get - { - if (_displayedSelection == null || _displayedSelection.SelectionCount == 0) - { - return null; - } - - if (_displayedSelection.SelectionCount == 1 || AreHomogenous(_displayedSelection.SelectedObjects)) - { - - if (_displayedSelection.SelectionCount == 1) - { - - Visual selectedVisual = _displayedSelection.PrimarySelection.View as Visual; - // We dont want to show tooltips for elements that derive from "Window" class. - // But we do want to show it for DesignTimeWindow, hence we check the View, so that modelItem returns the correct value - // for designtimewindow. - if (selectedVisual != null && !typeof(Window).IsAssignableFrom(_displayedSelection.PrimarySelection.View.GetType())) - { - // Show a small preview of the selected single object - VisualBrush controlBrush = new VisualBrush(selectedVisual); - controlBrush.Stretch = Stretch.Uniform; - Rectangle rect = new Rectangle(); - rect.Width = DesiredIconSize.Width; - rect.Height = DesiredIconSize.Height; - rect.DataContext = string.Empty; - - // If the control's parent is RTLed, then the VisualBrush "mirrors" the text. - // so apply "mirror" transform to "negate" the mirroring. - FrameworkElement curElement = selectedVisual as FrameworkElement; - FrameworkElement parentElement = curElement.Parent as FrameworkElement; - if (parentElement != null && parentElement.FlowDirection == FlowDirection.RightToLeft) - { - ScaleTransform mirrorTransform = new ScaleTransform(-1, 1); - mirrorTransform.CenterX = rect.Width / 2; - mirrorTransform.CenterY = rect.Height / 2; - controlBrush.Transform = mirrorTransform; - } - rect.Fill = controlBrush; - return rect; - } - else - { - // The selected object is not a visual, so show a non-designable object icon - return GetEmbeddedImage("NonDesignableSelection.png"); - } - } - - // Show mutliple-selection of the same type icon - return GetEmbeddedImage("MultiSelectionSameType.png"); - } - - // Show multiple-selection of different types icon - return GetEmbeddedImage("MultiSelectionDifferentType.png"); - } - } - - // - // Gets the Type name for the current selection - // - public string SelectionTypeName - { - get - { - if (_displayedSelection == null || _displayedSelection.SelectionCount == 0) - { - return null; - } - - if (_displayedSelection.SelectionCount == 1 || AreHomogenous(_displayedSelection.SelectedObjects)) - { - return GetStringRepresentation(_displayedSelection.PrimarySelection.ItemType); - } - - return System.Activities.Presentation.Internal.Properties.Resources.PropertyEditing_MultipleTypesSelected; - } - } - - static string GetStringRepresentation(Type type) - { - return TypeNameHelper.GetDisplayName(type, true); - } - - // Property View - - // - // Gets the state that should be persisted while the host is - // running, but discarded when the host shuts down. - // - public object SessionState - { - get - { - // Don't instantiate the SessionStateContainer until - // CategoryList has been instantiated. Otherwise, we would - // get an invalid container. - if (_categoryList == null) - { - return null; - } - - return SessionStateContainer.RetrieveState(); - } - set - { - // Don't instantiate the SessionStateContainer until - // CategoryList has been instantiated. Otherwise, we would - // get an invalid container. - if (_categoryList == null || value == null) - { - return; - } - - SessionStateContainer.RestoreState(value); - - _objectSelectionInitialized = false; - } - } - - public bool IsReadOnly - { - get { return this._isReadOnly; } - internal set - { - this._isReadOnly = value; - this._categoryList.Opacity = this._isReadOnly ? 0.8 : 1.0; - this._categoryList.ToolTip = this._isReadOnly ? this.FindResource("editingDisabledHint") : null; - this.OnPropertyChanged("IsReadOnly"); - } - } - - // - // Gets or sets a flag indicating whether the root PropertyInspector - // control is in alpha-view. We isolate this state from any other - // to make VS integration easier. - // - public bool IsInAlphaView - { - get { return _propertyToolBar.IsAlphaViewSelected; } - set { _propertyToolBar.IsAlphaViewSelected = value; } - } - - private void SelectPropertyByPathOnIdle() - { - SelectionPath selectionPath = - new SelectionPath(PropertySelectionPathInterpreter.PropertyPathTypeId, propertyPathToSelect); - bool pendingGeneration; - bool result = this._categoryList.SetSelectionPath(selectionPath, out pendingGeneration); - if (!result && pendingGeneration) - { - Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new MethodInvoker(SelectPropertyByPathOnIdle)); - } - } - - internal void SelectPropertyByPath(string path) - { - this.propertyPathToSelect = path; - // must do it in application idle time, otherwise the propertygrid is not popugrated yet. - Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new MethodInvoker(SelectPropertyByPathOnIdle)); - } - - internal TextBlock SelectionTypeLabel - { get { return _typeLabel; } } - //internal TextBlock SelectionNameLabel - //{ get { return _nameLabel; } } - //internal StringEditor SelectionNameEditor - //{ get { return _nameEditor; } } - internal PropertyToolBar PropertyToolBar - { get { return _propertyToolBar; } } - internal TextBlock NoSearchResultsLabel - { get { return _noSearchResultsLabel; } } - internal TextBlock UninitializedLabel - { get { return _uninitializedLabel; } } - internal CategoryList CategoryList - { get { return _categoryList; } } - - internal EditingContext EditingContext { get; set; } - - private DesignerPerfEventProvider DesignerPerfEventProvider - { - get - { - if (this.designerPerfEventProvider == null && this.EditingContext != null) - { - this.designerPerfEventProvider = this.EditingContext.Services.GetService(); - } - return this.designerPerfEventProvider; - } - } - - private SelectionPath LastSelectionPath - { - get { return _lastSelectionPath; } - set { _lastSelectionPath = value; } - } - - private IStateContainer SessionStateContainer - { - get - { - if (_categoryList == null) - { - return null; - } - - if (_sessionStateContainer == null) - { - _sessionStateContainer = new AggregateStateContainer( - PropertyStateContainer.Instance, - _categoryList, - new SelectionPathStateContainer(this), - PropertyActiveEditModeStateContainer.Instance, - PropertyViewManagerStateContainer.Instance); - } - - return _sessionStateContainer; - } - } - - // IPropertyInspectorState - - internal void Dispose() - { - _disposed = true; - DisassociateAllProperties(); - UpdateSelectionPropertyChangedEventHooks(_displayedSelection, null); - _displayedSelection = null; - _defaultCommandHandler.Dispose(); - _defaultCommandHandler = null; - } - - private void HookIntoCommands() - { - // Use a helper classes to handle all the standard PI commands - _defaultCommandHandler = new PropertyValueEditorCommandHandler(this); - } - - // - // Marks all shown properties as disassociated which disables all modifications - // done to them through the PI model objects. - // - private void DisassociateAllProperties() - { - if (_categoryList != null && _categoryList.IsLoaded) - { - foreach (ModelCategoryEntry category in _categoryList) - { - category.MarkAllPropertiesDisassociated(); - } - } - } - - // Properties - - private void OnCurrentViewManagerChanged(object sender, EventArgs e) - { - this.RefreshPropertyList(false); - - // Isolate the current view of the root PropertyInspector into - // its own separate flag and event to appease the VS ----s - // - if (this.RootViewModified != null) - { - RootViewModified(null, EventArgs.Empty); - } - } - - private void RefreshPropertyList(bool attachedOnly) - { - UpdateCategories(_lastNotifiedSelection, attachedOnly); - UpdateCategoryEditors(_lastNotifiedSelection); - - // - // The first time SelectionChanges, there is nothing selected, so don't store the - // current property selected. It would just overwrite the selection path that we - // received from SelectionPathStateContainer, which is not what we want. - // - if (_objectSelectionInitialized) - { - LastSelectionPath = _categoryList.SelectionPath; - } - - _objectSelectionInitialized = true; - - // - // Call UpdateSelectedProperty() _after_ the UI renders. We need to set PropertySelection.IsSelected - // property on a templated visual objects (CategoryContainer, PropertyContainer) and those may not exist yet. - // - Dispatcher.BeginInvoke(DispatcherPriority.Render, new UpdateSelectedPropertyInvoker(UpdateSelectedProperty), _lastNotifiedSelection); - } - - - // Selection Logic - - // SelectionPathStateContainer - - // - // Called externally whenever selection changes - // - // New selection - public void OnSelectionChanged(View.Selection selection) - { - _lastNotifiedSelection = selection; - RefreshSelection(); - } - - // - // Called when visibility of the PropertyBrowserPane changes and the - // PropertyInspector may be showing a stale selection. This method is identical - // to OnSelectionChanged() but with no new selection instance introduced. - // - public void RefreshSelection() - { - Dispatcher.BeginInvoke(DispatcherPriority.Background, new MethodInvoker(OnSelectionChangedIdle)); - } - - // Updates PI when the application becomes Idle (perf optimization) - private void OnSelectionChangedIdle() - { - if (DesignerPerfEventProvider != null) - { - DesignerPerfEventProvider.PropertyInspectorUpdatePropertyListStart(); - } - - if (AreSelectionsEquivalent(_lastNotifiedSelection, _displayedSelection)) - { - return; - } - - if (!VisualTreeUtils.IsVisible(this)) - { - return; - } - - // Change the SelectedControlFlowDirectionRTL resource property - // This will allow the 3rd party editors to look at this property - // and change to RTL for controls that support RTL. - // We set the resource to the primary selections RTL property. - FlowDirection commmonFD = this.FlowDirection; - if (_lastNotifiedSelection != null && _lastNotifiedSelection.PrimarySelection != null) - { - - FrameworkElement selectedElement = _lastNotifiedSelection.PrimarySelection.View as FrameworkElement; - if (selectedElement != null) - { - commmonFD = selectedElement.FlowDirection; - } - - // In case of mulitislection, - // if the FlowDirection is different then always set it to LTR. - // else set it to common FD. - if (_lastNotifiedSelection.SelectionCount > 1) - { - foreach (ModelItem item in _lastNotifiedSelection.SelectedObjects) - { - FrameworkElement curElm = item.View as FrameworkElement; - if (curElm != null && curElm.FlowDirection != commmonFD) - { - //reset to LTR (since the FD's are different within multiselect) - commmonFD = FlowDirection.LeftToRight; - break; - } - } - } - } - - PropertyInspectorResources.GetResources()["SelectedControlFlowDirectionRTL"] = commmonFD; - - RefreshPropertyList(false); - - UpdateSelectionPropertyChangedEventHooks(_displayedSelection, _lastNotifiedSelection); - _displayedSelection = _lastNotifiedSelection; - _lastParent = GetCommonParent(_lastNotifiedSelection); - - // Handle dangling transactions - _defaultCommandHandler.CommitOpenTransactions(); - - OnPropertyChanged("IsInfoBarNameReadOnly"); - OnPropertyChanged("SelectionName"); - OnPropertyChanged("SelectionIcon"); - OnPropertyChanged("SelectionTypeName"); - } - - // Removes / adds a PropertyChanged listener from / to the previous / current selection - private void UpdateSelectionPropertyChangedEventHooks(View.Selection previousSelection, View.Selection currentSelection) - { - if (previousSelection != null && previousSelection.PrimarySelection != null) - { - previousSelection.PrimarySelection.PropertyChanged -= OnSelectedItemPropertyChanged; - } - - if (currentSelection != null && currentSelection.PrimarySelection != null) - { - currentSelection.PrimarySelection.PropertyChanged += OnSelectedItemPropertyChanged; - } - } - - private void OnSelectedItemPropertyChanged(object sender, PropertyChangedEventArgs e) - { - if (_ignoreSelectionNameChanges) - { - return; - } - - // PS 40699 - Name is not a special property for WF - //if ("Name".Equals(e.PropertyName)) - //{ - // OnSelectedItemNameChanged(); - //} - - if ("Parent".Equals(e.PropertyName)) - { - OnParentChanged(); - } - } - - // Called when the name changes - private void OnSelectedItemNameChanged() - { - OnPropertyChanged("SelectionName"); - } - - // Called when the parent of the current selection changes - private void OnParentChanged() - { - Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new MethodInvoker(OnParentChangedIdle)); - } - - private void OnParentChangedIdle() - { - if (_displayedSelection == null || _displayedSelection.SelectionCount < 1) - { - return; - } - - ModelItem newParent = GetCommonParent(_displayedSelection); - - if (_lastParent != newParent) - { - RefreshPropertyList(true); - _lastParent = newParent; - } - } - - // Looks for common parent ModelItem among all the items in the selection - private static ModelItem GetCommonParent(View.Selection selection) - { - if (selection == null || selection.SelectionCount < 1) - { - return null; - } - - ModelItem parent = null; - foreach (ModelItem item in selection.SelectedObjects) - { - if (parent == null) - { - parent = item.Parent; - } - else if (parent != item.Parent) - { - return null; - } - } - - return parent; - } - - // The user can only specify the name for the selected objects iff exactly one - // object is selected. - private static bool CanSetSelectionName(View.Selection selection) - { - return selection != null && selection.SelectionCount == 1; - } - - private static bool AreSelectionsEquivalent(View.Selection a, View.Selection b) - { - if (a == null && b == null) - { - return true; - } - if (a == null || b == null) - { - return false; - } - if (a.SelectionCount != b.SelectionCount) - { - return false; - } - - // POSSIBLE OPTIMIZATION: be smarter about same selection in a different order - IEnumerator ea = a.SelectedObjects.GetEnumerator(); - IEnumerator eb = b.SelectedObjects.GetEnumerator(); - - while (ea.MoveNext() && eb.MoveNext()) - { - if (!object.Equals(ea.Current, eb.Current)) - { - return false; - } - } - - return true; - } - - // This is the work-horse that refreshes the list of properties and categories within a PropertyInspector - // window, including refreshing of CategoryEditors, based on the specified selection - private void UpdateCategories(View.Selection selection, bool attachedOnly) - { - - // Optimization stolen from Sparkle: - // re-rendering the categories is the number one perf issue. Clearing - // the databound collection results in massive Avalon code execution, and - // then re-adding everything causes another huge shuffle. What is more, - // even when changing the selection between different objects, most properties - // do not change. Therefore we are going to take the new list of properties - // and we are going to merge them into the existing stuff, using an - // approach I call Mark, Match, and Cull. - // - // First we mark all the properties in the current collection. Those which - // are still marked at the end will be culled out - foreach (ModelCategoryEntry category in _categoryList) - { - if (attachedOnly) - { - category.MarkAttachedPropertiesDisassociated(); - } - else - { - category.MarkAllPropertiesDisassociated(); - } - } - - // Second we try to match each property in the list of properties for the newly selected objects - // against something that we already have. If we have a match, then we reset the existing - // ModelPropertyEntry and clear the mark - // - foreach (IEnumerable propertySet in - ModelPropertyMerger.GetMergedProperties( - selection == null ? null : selection.SelectedObjects, - selection == null ? 0 : selection.SelectionCount)) - { - - string propertyName = GetPropertyName(propertySet); - - // Specifically filter out the Name property - // PS 40699 - Name is not a special property for WF - //if ("Name".Equals(propertyName)) - //{ - // continue; - //} - - if (attachedOnly && propertyName.IndexOf('.') < 0) - { - continue; - } - - ModelPropertyEntry wrappedProperty = _propertyToolBar.CurrentViewManager.AddProperty(propertySet, propertyName, _categoryList); - - // Make sure no valid properties get culled out - wrappedProperty.Disassociated = false; - } - - // Third, we walk the properties and categories, and we cull out all of the - // marked properties. Empty categories are removed. - // - for (int i = _categoryList.Count - 1; i >= 0; i--) - { - ModelCategoryEntry category = (ModelCategoryEntry)_categoryList[i]; - category.CullDisassociatedProperties(); - if (category.IsEmpty) - { - _categoryList.RemoveAt(i); - } - } - - _categoryList.RefreshFilter(); - } - - // Helper method that adjusts the visible set of CategoryEditors based on the specified selection - private void UpdateCategoryEditors(View.Selection selection) - { - - // Figure out which category editors to show - Dictionary newCategoryEditorTypes = _propertyToolBar.CurrentViewManager.GetCategoryEditors( - FindCommonType(selection == null ? null : selection.SelectedObjects), - _categoryList); - - // Figure out which CategoryEditors are no longer needed and remove them - List editorTypesToRemove = null; - foreach (KeyValuePair item in _activeCategoryEditors) - { - if (!newCategoryEditorTypes.ContainsKey(item.Key) || !IsCategoryShown(item.Key)) - { - - // New selection does not include this existing category editor - // or the category that contains this editor - // so remove the editor. - if (editorTypesToRemove == null) - { - editorTypesToRemove = new List(); - } - - editorTypesToRemove.Add(item.Key); - } - else - { - // This category editor already exists, so don't re-add it - newCategoryEditorTypes.Remove(item.Key); - } - } - - if (editorTypesToRemove != null) - { - foreach (Type editorTypeToRemove in editorTypesToRemove) - { - ModelCategoryEntry affectedCategory = _categoryList.FindCategory(_activeCategoryEditors[editorTypeToRemove]) as ModelCategoryEntry; - if (affectedCategory != null) - { - affectedCategory.RemoveCategoryEditor(editorTypeToRemove); - } - - _activeCategoryEditors.Remove(editorTypeToRemove); - } - } - - // Figure out which CategoryEditors are now required and add them - foreach (Type editorTypeToAdd in newCategoryEditorTypes.Keys) - { - CategoryEditor editor = (CategoryEditor)ExtensibilityAccessor.SafeCreateInstance(editorTypeToAdd); - if (editor == null) - { - continue; - } - - ModelCategoryEntry affectedCategory = _categoryList.FindCategory(editor.TargetCategory) as ModelCategoryEntry; - if (affectedCategory == null) - { - continue; - } - - affectedCategory.AddCategoryEditor(editor); - _activeCategoryEditors[editorTypeToAdd] = editor.TargetCategory; - } - } - - // Check if the category is shown for the current category editor type - private bool IsCategoryShown(Type categoryEditorType) - { - bool ret = true; - CategoryEditor editorToRemove = (CategoryEditor)ExtensibilityAccessor.SafeCreateInstance(categoryEditorType); - if (editorToRemove != null) - { - ModelCategoryEntry affectedCategory = _categoryList.FindCategory(editorToRemove.TargetCategory) as ModelCategoryEntry; - if (affectedCategory == null) - { - ret = false; - } - } - else - { - ret = false; - } - return ret; - } - - // Tries to figure out what property to select and selects is - private void UpdateSelectedProperty(View.Selection selection) - { - - // If we are not loaded, skip any and all selection magic - if (!this.IsLoaded) - { - return; - } - - if (selection != null) - { - - // See what the view would like us to select if we run out of things - // we can think of selecting - // - SelectionPath fallbackSelection = null; - if (_propertyToolBar.CurrentViewManager != null) - { - fallbackSelection = _propertyToolBar.CurrentViewManager.GetDefaultSelectionPath(_categoryList); - } - - // Select the first thing we request that exists, using the following - // precedence order: - // - // * LastSelectionPath - // * DefaultProperty - // * Whatever the view wants to show (first category, first property, ...) - // - _categoryList.UpdateSelectedProperty( - this.LastSelectionPath, - ModelPropertyMerger.GetMergedDefaultProperty(selection.SelectedObjects), - fallbackSelection); - } - - if (DesignerPerfEventProvider != null) - { - DesignerPerfEventProvider.PropertyInspectorUpdatePropertyListEnd(); - } - } - - private static Type FindCommonType(IEnumerable modelItems) - { - Type commonType = null; - - if (modelItems != null) - { - foreach (ModelItem selectedItem in modelItems) - { - if (commonType == null) - { - commonType = selectedItem.ItemType; - } - else - { - commonType = ModelUtilities.GetCommonAncestor(commonType, selectedItem.ItemType); - } - } - } - - return commonType; - } - - private static bool AreHomogenous(IEnumerable items) - { - Fx.Assert(items != null, "items parameter is null"); - - Type type = null; - foreach (ModelItem item in items) - { - if (type == null) - { - type = item.ItemType; - } - else if (type != item.ItemType) - { - return false; - } - } - - return true; - } - - // Static Helpers - - private static string GetPropertyName(IEnumerable propertySet) - { - if (propertySet == null) - { - return null; - } - foreach (ModelProperty property in propertySet) - { - return property.Name; - } - return null; - } - - private static Image GetEmbeddedImage(string imageName) - { - Image image = new Image(); - image.Source = new BitmapImage(new Uri( - string.Concat( - "/System.Activities.Presentation;component/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/Resources/", - imageName), - UriKind.RelativeOrAbsolute)); - return image; - } - - - // AutomationPeer Stuff - - protected override AutomationPeer OnCreateAutomationPeer() - { - return new PropertyInspectorAutomationPeer(this); - } - - - // Cross-domain State Storage - - // - // Clears the FilterString - // - public void ClearFilterString() - { - _categoryList.FilterString = null; - } - - // INotifyPropertyChanged Members - - private void OnPropertyChanged(string propertyName) - { - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); - } - } - - private delegate void MethodInvoker(); - private delegate void UpdateSelectedPropertyInvoker(View.Selection selection); - - // Container for property-selection state represented by SelectionPath. - // Since we receive a stored SelectionPath on the reload of this control, - // at which point the visuals themselves have not been rendered yet, we - // store the supplied SelectionPath instance and use it to select the - // correct property only after the UI has been rendered. - // - private class SelectionPathStateContainer : IStateContainer - { - private PropertyInspector _parent; - - public SelectionPathStateContainer(PropertyInspector parent) - { - if (parent == null) - { - throw FxTrace.Exception.ArgumentNull("parent"); - } - _parent = parent; - } - - // - // Pulls the SelectionPath from the CategoryList, but only if it was Sticky, - // meaning we should preserve it - // - public object RetrieveState() - { - if (_parent.CategoryList != null) - { - SelectionPath path = _parent._objectSelectionInitialized ? _parent.CategoryList.SelectionPath : _parent.LastSelectionPath; - return path == null ? null : path.State; - } - - return null; - } - - // - // Pulls the SelectionPath from the CategoryList, but only if it was Sticky, - // meaning we should preserve it - // - public void RestoreState(object state) - { - if (state != null) - { - SelectionPath restoredPath = SelectionPath.FromState(state); - _parent.LastSelectionPath = restoredPath; - } - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyInspectorFontAndColorDictionary.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyInspectorFontAndColorDictionary.cs deleted file mode 100644 index b21bf66e033..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyInspectorFontAndColorDictionary.cs +++ /dev/null @@ -1,70 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- - -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System.Collections.Generic; - using System.Windows; - using System.Windows.Media; - using System.Diagnostics.CodeAnalysis; - - internal class PropertyInspectorFontAndColorDictionary : ResourceDictionary - { - [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] - internal PropertyInspectorFontAndColorDictionary(Dictionary fontAndColorData) - { - try - { - BeginInit(); - - foreach (KeyValuePair keyValuePair in fontAndColorData) - { - if (keyValuePair.Value is System.Drawing.SolidBrush) - { - System.Drawing.SolidBrush drawingBrush = (System.Drawing.SolidBrush)(keyValuePair.Value); - Color color = new Color(); - color.A = drawingBrush.Color.A; - color.R = drawingBrush.Color.R; - color.G = drawingBrush.Color.G; - color.B = drawingBrush.Color.B; - - Add(keyValuePair.Key, new SolidColorBrush(color)); - } - else if (keyValuePair.Value is System.Drawing.Drawing2D.LinearGradientBrush) - { - System.Drawing.Drawing2D.LinearGradientBrush drawingBrush = (System.Drawing.Drawing2D.LinearGradientBrush)keyValuePair.Value; - Color startingColor = new Color(); - startingColor.A = drawingBrush.LinearColors[0].A; - startingColor.R = drawingBrush.LinearColors[0].R; - startingColor.G = drawingBrush.LinearColors[0].G; - startingColor.B = drawingBrush.LinearColors[0].B; - Color endingColor = new Color(); - endingColor.A = drawingBrush.LinearColors[1].A; - endingColor.R = drawingBrush.LinearColors[1].R; - endingColor.G = drawingBrush.LinearColors[1].G; - endingColor.B = drawingBrush.LinearColors[1].B; - Add(keyValuePair.Key, new System.Windows.Media.LinearGradientBrush(startingColor, endingColor, 90)); - } - else if (keyValuePair.Value is System.Drawing.FontFamily) - { - System.Drawing.FontFamily drawingFontFamily = (System.Drawing.FontFamily)keyValuePair.Value; - Add(keyValuePair.Key, new FontFamily(drawingFontFamily.Name)); - } - else if (keyValuePair.Key == "FontWeightKey") - { - Add(keyValuePair.Key, System.Windows.FontWeights.Normal); - } - else - { - Add(keyValuePair.Key, keyValuePair.Value); - } - } - } - finally - { - EndInit(); - } - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyInspectorMergedResources.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyInspectorMergedResources.cs deleted file mode 100644 index 0874120f076..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyInspectorMergedResources.cs +++ /dev/null @@ -1,202 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - - using System.Diagnostics.CodeAnalysis; - using System.Collections.Generic; - using System.Windows; - using System.Windows.Media; - using System.Activities.Presentation.Internal.PropertyEditing.Resources; - - // - // This class merges the font and brush resources for PropertyInspector. - // PropertyInspectorMergedResources uses AdornerResources to hook on to the theme-changes to - // re-apply the color values. - // - [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes", Justification = "Suppress to avoid churning the code base.")] - internal static class PropertyInspectorMergedResources - { - private static readonly string _fontSizeKey = CreateKey("FontSizeKey"); - private static readonly string _fontFamilyKey = CreateKey("FontFamilyKey"); - private static readonly string _fontWeightKey = CreateKey("FontWeightKey"); - private static readonly string _textBrushKey = CreateKey("TextBrushKey"); - private static readonly string _selectedForegroundBrushKey = CreateKey("SelectedForegroundBrushKey"); - private static readonly string _selectedBackgroundBrushKey = CreateKey("SelectedBackgroundBrushKey"); - private static readonly string _backgroundBrushKey = CreateKey("BackgroundBrushKey"); - private static readonly string _borderBrushKey = CreateKey("BorderBrushKey"); - private static readonly string _categoryCaptionTextBrushKey = CreateKey("CategoryCaptionTextBrushKey"); - private static readonly string _paneBrushKey = CreateKey("PaneBrushKey"); - private static readonly string _popupBrushKey = CreateKey("PopupBrushKey"); - private static readonly string _toolBarItemHoverBackgroundBrushKKey = CreateKey("ToolBarItemHoverBackgroundBrushKey"); - private static readonly string _toolBarItemHoverBorderBrushKey = CreateKey("ToolBarItemHoverBorderBrushKey"); - private static readonly string _toolBarItemSelectedBackgroundBrushKey = CreateKey("ToolBarItemSelectedBackgroundBrushKey"); - private static readonly string _toolBarItemSelectedBorderBrushKey = CreateKey("ToolBarItemSelectedBorderBrushKey"); - private static readonly string _toolBarBackgroundBrushKey = CreateKey("ToolBarBackgroundBrushKey"); - private static readonly string _toolBarSeparatorBrushKey = CreateKey("ToolBarSeparatorBrushKey"); - private static readonly string _toolBarTextBoxBorderBrushKey = CreateKey("ToolBarTextBoxBorderBrushKey"); - - // - // Specifies a FontSizeKey. - // - public static string FontSizeKey - { - get { return _fontSizeKey; } - } - - // - // Specifies FontFamilyKey - // - public static string FontFamilyKey - { - get { return _fontFamilyKey; } - } - - // - // Specifies FontWeightKey - // - public static string FontWeightKey - { - get { return _fontWeightKey; } - } - - - public static string TextBrushKey - { - get { return _textBrushKey; } - } - - public static string SelectedForegroundBrushKey - { - get { return _selectedForegroundBrushKey; } - } - - - - public static string SelectedBackgroundBrushKey - { - get { return _selectedBackgroundBrushKey; } - } - - - - public static string BackgroundBrushKey - { - get { return _backgroundBrushKey; } - } - - - - public static string BorderBrushKey - { - get { return _borderBrushKey; } - } - - - - - public static string CategoryCaptionTextBrushKey - { - get { return _categoryCaptionTextBrushKey; } - } - - - - - public static string PaneBrushKey - { - get { return _paneBrushKey; } - } - - - - - public static string PopupBrushKey - { - get { return _popupBrushKey; } - } - - - - - - public static string ToolBarItemHoverBackgroundBrushKey - { - get { return _toolBarItemHoverBackgroundBrushKKey; } - } - - - - - public static string ToolBarItemHoverBorderBrushKey - { - get { return _toolBarItemHoverBorderBrushKey; } - } - - - - - public static string ToolBarItemSelectedBackgroundBrushKey - { - get { return _toolBarItemSelectedBackgroundBrushKey; } - } - - - - - public static string ToolBarItemSelectedBorderBrushKey - { - get { return _toolBarItemSelectedBorderBrushKey; } - } - - - - public static string ToolBarBackgroundBrushKey - { - get { return _toolBarBackgroundBrushKey; } - } - - - - - public static string ToolBarSeparatorBrushKey - { - get { return _toolBarSeparatorBrushKey; } - } - - - - - public static string ToolBarTextBoxBorderBrushKey - { - get { return _toolBarTextBoxBorderBrushKey; } - } - - - //HelperFunctions - - // - // Creates a new key. Used at static construction time. - // - private static string CreateKey(string name) - { - //return AdornerResources.CreateResourceKey(typeof(PropertyInspectorMergedResources), name); - return name; - } - - - - // - //return (Collection) for custom collection editor defined in other assemblies to use, e.g. DynamicArgumentDictionary - // - public static string DefaultCollectionStringValue - { - get - { - return System.Activities.Presentation.Internal.Properties.Resources.PropertyEditing_DefaultCollectionStringValue; - } - } - - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyPanel.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyPanel.cs deleted file mode 100644 index 47505694952..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyPanel.cs +++ /dev/null @@ -1,308 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Media; - - // - // PropertyPanel is a simplified version of a horizontal StackPanel that we use for PropertyContainer - // visuals in lieu of Grid, which was too heavy-weight and bogging down perf. It exposes a property, - // LastChildWidth, that specifies the forced width of the last child in the panel. All other - // children are stacked on the left and eat up the remainder of the space left on the panel. - // - // The panel also deals with drawing compartments for itself and the last child and it deals with - // visually nesting sub-properties based on their depth (Level). - // - internal class PropertyPanel : Panel - { - - // LastChildWidth DP - - public static readonly DependencyProperty OutlineBrushProperty = - DependencyProperty.Register("OutlineBrush", - typeof(Brush), - typeof(PropertyPanel), - new FrameworkPropertyMetadata((Brush)null, - FrameworkPropertyMetadataOptions.AffectsRender | - FrameworkPropertyMetadataOptions.SubPropertiesDoNotAffectRender)); - - public static readonly DependencyProperty SelectionBrushProperty = - DependencyProperty.Register("SelectionBrush", - typeof(Brush), - typeof(PropertyPanel), - new FrameworkPropertyMetadata((Brush)null, - FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.SubPropertiesDoNotAffectRender)); - - public static readonly DependencyProperty OutlineThicknessProperty = - DependencyProperty.Register("OutlineThickness", - typeof(double), - typeof(PropertyPanel), - new FrameworkPropertyMetadata((double)1, - FrameworkPropertyMetadataOptions.AffectsRender)); - - public static readonly DependencyProperty IgnoreFirstChildBackgroundProperty = - DependencyProperty.Register("IgnoreFirstChildBackground", - typeof(bool), - typeof(PropertyPanel), - new FrameworkPropertyMetadata( - false, - FrameworkPropertyMetadataOptions.AffectsRender)); - - public static DependencyProperty LastChildWidthProperty = DependencyProperty.Register( - "LastChildWidth", - typeof(double), - typeof(PropertyPanel), - new FrameworkPropertyMetadata( - (double)0, - FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender)); - - public static DependencyProperty LevelProperty = DependencyProperty.Register( - "Level", - typeof(int), - typeof(PropertyPanel), - new FrameworkPropertyMetadata( - (int)0, - FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure)); - - public static DependencyProperty LevelIndentProperty = DependencyProperty.Register( - "LevelIndent", - typeof(double), - typeof(PropertyPanel), - new FrameworkPropertyMetadata( - (double)13, - FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure)); - - // - // Gets or sets the pixel width of the last child added into this panel. - // - public double LastChildWidth - { - get { return (double)this.GetValue(LastChildWidthProperty); } - set { this.SetValue(LastChildWidthProperty, value); } - } - - - - // Level DP - - // - // Gets or sets the indentation level for the first child in this panel. Levels are - // measured in ints, with 0 = no indentation, 1 = 1st sub-property, ... - // The actual amount of space taken up by each level is controled by LevelIndent property - // - public int Level - { - get { return (int)this.GetValue(LevelProperty); } - set { this.SetValue(LevelProperty, value); } - } - - - - // LevelIndent DP - - // - // Gets or sets the pixel width that the first child is indented for each level that - // it belongs to - // - public double LevelIndent - { - get { return (double)this.GetValue(LevelIndentProperty); } - set { this.SetValue(LevelIndentProperty, value); } - } - - - - // OutlineBrush DP - - // - // Gets or sets the line brush to use for the panel compartments - // - public Brush OutlineBrush - { - get { return (Brush)GetValue(OutlineBrushProperty); } - set { SetValue(OutlineBrushProperty, value); } - } - - - - // SelectionBrush DP - - // - // Gets or sets the brush to be used as the background for everything but the last - // element in the panel - // - public Brush SelectionBrush - { - get { return (Brush)GetValue(SelectionBrushProperty); } - set { SetValue(SelectionBrushProperty, value); } - } - - - - // OutlineThickness DP - - // - // Gets or sets the line thickness for the panel compartments (not as Thickness, but - // instead as a simple double) - // - public double OutlineThickness - { - get { return (double)GetValue(OutlineThicknessProperty); } - set { SetValue(OutlineThicknessProperty, value); } - } - - - - // IgnoreFirstChildBackground DP - - // - // Gets or sets a flag indicating whether the SelectionBrush background should - // or should not be applied to the first child of the panel - // - public bool IgnoreFirstChildBackground - { - get { return (bool)GetValue(IgnoreFirstChildBackgroundProperty); } - set { SetValue(IgnoreFirstChildBackgroundProperty, value); } - } - - - - // Stacks the children to the left, leaving LastChildWidth amount of space for the last child - protected override Size MeasureOverride(Size availableSize) - { - - double lastChildWidth = Math.Max(0, this.LastChildWidth); - double indent = this.LevelIndent * this.Level; - double availableWidth = Math.Max(0, availableSize.Width - lastChildWidth - indent); - int childrenCount = InternalChildren.Count; - int lastIndex = childrenCount - 1; - Size actualSize = new Size(); - - for (int i = 0; i < childrenCount; i++) - { - UIElement child = InternalChildren[i]; - - if (i == lastIndex) - { - InternalChildren[i].Measure(new Size(lastChildWidth, availableSize.Height)); - } - else - { - InternalChildren[i].Measure(new Size(availableWidth, availableSize.Height)); - } - - availableWidth -= child.DesiredSize.Width; - //Compute the actual size for the propertypanel - actualSize.Height = Math.Max(actualSize.Height, child.DesiredSize.Height); - actualSize.Width += child.DesiredSize.Width; - } - - return actualSize; - } - - // Stacks the children to the left, leaving LastChildWidth amount of space for the last child - protected override Size ArrangeOverride(Size finalSize) - { - - double lastChildWidth = Math.Max(0, this.LastChildWidth); - double indent = this.LevelIndent * this.Level; - double availableWidth = Math.Max(0, finalSize.Width - lastChildWidth - indent); - double left = indent; - int childrenCount = InternalChildren.Count; - int lastIndex = childrenCount - 1; - - for (int i = 0; i < childrenCount; i++) - { - - UIElement child = InternalChildren[i]; - double desiredWidth = child.DesiredSize.Width; - if (i == lastIndex) - { - child.Arrange(new Rect(Math.Max(0, finalSize.Width - lastChildWidth), 0, lastChildWidth, finalSize.Height)); - } - else - { - child.Arrange(new Rect(left, 0, Math.Min(desiredWidth, availableWidth), finalSize.Height)); - } - - left += desiredWidth; - availableWidth -= desiredWidth; - availableWidth = Math.Max(0, availableWidth); - } - - return finalSize; - } - - // Custom renders compartments and dividers - protected override void OnRender(DrawingContext dc) - { - - Size renderSize = this.RenderSize; - Brush outlineBrush = this.OutlineBrush; - double outlineThickness = this.OutlineThickness; - double halfThickness = outlineThickness / 2.0; - double dividerRight = Math.Max(0, this.LastChildWidth); - double dividerLeft = renderSize.Width - dividerRight - outlineThickness; - - Brush selectionBrush = this.SelectionBrush; - - if (selectionBrush != null) - { - bool ignoreFirstChildBackground = this.IgnoreFirstChildBackground; - double firstChildWidth = 0; - - if (ignoreFirstChildBackground && this.Children.Count > 0) - { - firstChildWidth = this.Children[0].RenderSize.Width; - } - - dc.DrawRectangle(selectionBrush, null, new Rect( - firstChildWidth, - 0, - Math.Max(dividerLeft - firstChildWidth, 0), - renderSize.Height)); - } - - base.OnRender(dc); - - // Use Guidelines to avoid anti-aliasing (fuzzy border lines) - dc.PushGuidelineSet(new GuidelineSet( - // X coordinates for guidelines (vertical lines) - new double[] { 0, dividerLeft, dividerLeft + outlineThickness, renderSize.Width - outlineThickness, renderSize.Width }, - // Y coordinates for guidelines (horizontal lines) - new double[] { 0, renderSize.Height - outlineThickness, renderSize.Height })); - - Pen outlinePen = new Pen(outlineBrush, outlineThickness); - - // Bottom edge - dc.DrawLine( - outlinePen, - new Point(0, renderSize.Height - halfThickness), - new Point(renderSize.Width, renderSize.Height - halfThickness)); - - // Top edge - dc.DrawLine( - outlinePen, - new Point(0, 0 - halfThickness), - new Point(renderSize.Width, 0 - halfThickness)); - - // Right edge - dc.DrawLine( - outlinePen, - new Point(renderSize.Width - halfThickness, 0), - new Point(renderSize.Width - halfThickness, renderSize.Height)); - - // Divider - dc.DrawLine( - outlinePen, - new Point(dividerLeft + halfThickness, 0), - new Point(dividerLeft + halfThickness, renderSize.Height)); - - dc.Pop(); - } - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertySelectionMode.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertySelectionMode.cs deleted file mode 100644 index 36b96a16597..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertySelectionMode.cs +++ /dev/null @@ -1,19 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System; - - // - // SelectionMode used for property selection. 'Default' means that with each object selection change, - // we try to figure out the default property to select and we select it. 'Sticky' means that the user - // has made some conscious decision as to what property should be selected and we try to preserve it - // across object selection changes. - // - internal enum PropertySelectionMode - { - Default, - Sticky - } -} diff --git a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyToolBar.cs b/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyToolBar.cs deleted file mode 100644 index 0cc9b272290..00000000000 --- a/mcs/class/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/Base/Core/Internal/PropertyEditing/PropertyToolBar.cs +++ /dev/null @@ -1,335 +0,0 @@ -//---------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------------- -namespace System.Activities.Presentation.Internal.PropertyEditing -{ - using System; - using System.ComponentModel; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Windows; - using System.Windows.Automation.Peers; - using System.Windows.Controls; - using System.Runtime; - - using System.Activities.Presentation.Internal.PropertyEditing.Automation; - using System.Activities.Presentation.Internal.PropertyEditing.State; - using System.Activities.Presentation.Internal.PropertyEditing.Views; - - // - // Container control that hosts both the property-search UI as well as the view-switching UI - // - internal sealed class PropertyToolBar : Control, INotifyPropertyChanged - { - - // - // Property representing the currently-selected IPropertyViewManager - // - public static DependencyProperty CurrentViewManagerProperty = DependencyProperty.Register( - "CurrentViewManager", - typeof(IPropertyViewManager), - typeof(PropertyToolBar), - new PropertyMetadata(null, OnCurrentViewManagerChanged)); - - // - // Property containing a link to the CategoryList control instance that this - // PropertyToolBar controls. We need this link to be able to change the appearance - // of each new generated CategoryContainer (whether it should show a header or not). - // That way CategoryList doesn't need to know anything about this class. - // - public static DependencyProperty CategoryListProperty = DependencyProperty.Register( - "CategoryList", - typeof(CategoryList), - typeof(PropertyToolBar), - new PropertyMetadata(null, OnCategoryListChanged)); - - private string _persistenceId; - private bool _persistViewManagerChanges = true; - - public PropertyToolBar() - { - this.Loaded += new RoutedEventHandler(OnLoaded); - this.Unloaded += new RoutedEventHandler(OnUnloaded); - } - - // - // Event we fire when the CurrentViewManager changes - // - public event EventHandler CurrentViewManagerChanged; - - public event PropertyChangedEventHandler PropertyChanged; - - // - // Gets or set the currently selected IPropertyViewManager - // - public IPropertyViewManager CurrentViewManager - { - get { return (IPropertyViewManager)this.GetValue(CurrentViewManagerProperty); } - set { this.SetValue(CurrentViewManagerProperty, value); } - } - - // - // Gets or set the value of the CategoryListProperty - // - public CategoryList CategoryList - { - get { return (CategoryList)this.GetValue(CategoryListProperty); } - set { this.SetValue(CategoryListProperty, value); } - } - - // - // Gets or sets a string ID that we use to differentiate between the states of different - // PropertyToolBar instances. Currently, we only care about two different PropertyToolBar - // buckets - (1) the PTBs we use in the main PI and (2) the PTBs we use in collection editors. - // - public string PersistenceId - { - get { - return _persistenceId; - } - set { - if (_persistenceId != value) - { - _persistenceId = value; - - if (this.CurrentViewManager == null) - { - bool oldPersistViewManagerChanges = _persistViewManagerChanges; - try - { - _persistViewManagerChanges = false; - this.CurrentViewManager = PropertyViewManagerStateContainer.Instance.GetPropertyViewManager(_persistenceId); - } - finally - { - _persistViewManagerChanges = oldPersistViewManagerChanges; - } - } - - OnPropertyChanged("PersistenceId"); - } - } - } - - // - // Convenience accessor for the UI data binding - // - public bool IsCategoryViewSelected - { - get { - if (this.CurrentViewManager != null) - { - return this.CurrentViewManager == ByCategoryViewManager.Instance; - } - - return false; - } - set { - // No need to fire PropertyChanged events here - changing CurrentViewManager - // will fire those events as a side-effect - // - if (this.CurrentViewManager == ByCategoryViewManager.Instance ^ value) - { - if (value) - { - this.CurrentViewManager = ByCategoryViewManager.Instance; - } - else - { - this.CurrentViewManager = AlphabeticalViewManager.Instance; - } - } - } - } - - // - // Convenience accessor for the UI data binding - // - public bool IsAlphaViewSelected - { - get { - if (this.CurrentViewManager != null) - { - return this.CurrentViewManager == AlphabeticalViewManager.Instance; - } - - return false; - } - set { - // No need to fire PropertyChanged events here - changing CurrentViewManager - // will fire those events as a side-effect - // - if (this.CurrentViewManager == AlphabeticalViewManager.Instance ^ value) - { - if (value) - { - this.CurrentViewManager = AlphabeticalViewManager.Instance; - } - else - { - this.CurrentViewManager = ByCategoryViewManager.Instance; - } - } - } - } - - // AutomationPeer Stuff - - internal RadioButton ByCategoryViewButton - { get { return VisualTreeUtils.GetNamedChild(this, "PART_ByCategoryViewButton"); } } - internal RadioButton AlphaViewButton - { get { return VisualTreeUtils.GetNamedChild(this, "PART_AlphaViewButton"); } } - internal TextBlock SearchLabel - { get { return VisualTreeUtils.GetNamedChild(this, "PART_SearchLabel"); } } - internal TextBox SearchTextBox - { get { return VisualTreeUtils.GetNamedChild(this, "PART_SearchTextBox"); } } - internal Button SearchClearButton - { get { return VisualTreeUtils.GetNamedChild