Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / Model / ModelService.cs / 1305376 / ModelService.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Activities.Presentation.Services { using System; using System.Collections.Generic; using System.Activities.Presentation.Model; ////// The ModelService class is the main entry point the designer /// uses to obtain the model. The service actually has a split /// between public and protected methods you must implement. /// The public methods are (obviously) callable by anyone. /// The protected methods are invoked by the model. /// public abstract class ModelService { ////// Constructs a new ModelService. /// protected ModelService() { } ////// The root of the object hierarchy. For purely linear stores /// this will be the first object in the store. For stores that /// represent a tree of objects this returns the topmost node of /// the tree. /// public abstract ModelItem Root { get; } ////// This event is raised when something in the model has changed. /// The event args in the event can be used to find what has changed. /// public abstract event EventHandlerModelChanged; /// /// Creates a ModelItem for a given type. This method is called by /// ModelFactory when the user wishes to create a new item. /// /// /// The type of item to create. /// /// /// Creation options. You can specify if you would like to initialize /// default values for an item. /// /// /// An array of arguments to the constructor of the item. /// ///The newly created model item. ///if itemType is null protected abstract ModelItem CreateItem(Type itemType, CreateOptions options, params object[] arguments); ////// Takes an existing instance and creates a model item that is a deep clone /// of the instance. /// /// /// The item to wrap. /// ///A newly created model item that is a clone of the existing item. ///if item is null protected abstract ModelItem CreateItem(object item); ////// Create a new model item that represents a the value of a static member of a the given class. /// For example, to add a reference to Brushes.Red to the model call this methods with /// typeof(Brushes) and the string "Red". This will be serialized into XAML as /// {x:Static Brushes.Red}. /// /// /// The type that contains the static member being referenced. /// /// /// The name of the static member being referenced. /// protected abstract ModelItem CreateStaticMemberItem(Type type, string memberName); ////// Finds matching model items given a starting point to look. All /// walks are recursive. /// /// /// The model item to start the search. Items above this item /// will be ignored. This item, and any item below it in the /// hierarchy, will be included in the search. If this value is /// null, the root is used. /// /// /// The type of the object to find. This will enumerate all items /// within the given parent scope that are of the requested type. /// ////// An enumeration of model items matching the query. /// ///if type is null public abstract IEnumerableFind(ModelItem startingItem, Type type); /// /// Finds matching model items given a starting point to look. All /// walks are recursive. /// /// /// The model item to start the search. Items above this item /// will be ignored. This item, and any item below it in the /// hierarchy, will be included in the search. If this value is /// null, the root is used. /// /// /// A predicate that allows more complex type matching to be used. /// For example, the predicate could return true for both /// FrameworkElement and FrameworkContentElement. /// ////// An enumeration of model items matching the query. /// ///if match is null public abstract IEnumerableFind(ModelItem startingItem, Predicate match); /// /// Locates the model item in the given scope with the given name. Returns null if /// the model item could not be located. /// /// /// An optional scope to provide. If not provided, the root element will /// be used as a scope. If provided, the nearest INameScope in the hierarchy /// will be used to locate the item. /// /// /// The name to locate. /// ////// A model item whose name matches that provided, or null if no match was /// found. /// ///If name is null. public ModelItem FromName(ModelItem scope, string name) { return FromName(scope, name, StringComparison.Ordinal); } ////// Locates the model item in the given scope with the given name. Returns null if /// the model item could not be located. /// /// /// An optional scope to provide. If not provided, the root element will /// be used as a scope. If provided, the nearest INameScope in the hierarchy /// will be used to locate the item. /// /// /// The name to locate. /// /// /// Determines how the name should be compared. The default is to compare against /// ordinal. /// ////// A model item whose name matches that provided, or null if no match was /// found. /// ///If name is null. public abstract ModelItem FromName(ModelItem scope, string name, StringComparison comparison); ////// Creates a ModelItem for a given type. This method is called by /// ModelFactory when the user wishes to create a new item. /// internal ModelItem InvokeCreateItem(Type itemType, CreateOptions options, params object[] arguments) { return CreateItem(itemType, options, arguments); } ////// Creates a member item that refers to a static member of the given type. /// internal ModelItem InvokeCreateStaticMemberItem(Type type, string memberName) { return CreateStaticMemberItem(type, memberName); } ////// Takes an existing instance and wraps it in a ModelItem. The set /// properties on the instance are promoted to the model item. /// internal ModelItem InvokeCreateItem(object item) { return CreateItem(item); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Activities.Presentation.Services { using System; using System.Collections.Generic; using System.Activities.Presentation.Model; ////// The ModelService class is the main entry point the designer /// uses to obtain the model. The service actually has a split /// between public and protected methods you must implement. /// The public methods are (obviously) callable by anyone. /// The protected methods are invoked by the model. /// public abstract class ModelService { ////// Constructs a new ModelService. /// protected ModelService() { } ////// The root of the object hierarchy. For purely linear stores /// this will be the first object in the store. For stores that /// represent a tree of objects this returns the topmost node of /// the tree. /// public abstract ModelItem Root { get; } ////// This event is raised when something in the model has changed. /// The event args in the event can be used to find what has changed. /// public abstract event EventHandlerModelChanged; /// /// Creates a ModelItem for a given type. This method is called by /// ModelFactory when the user wishes to create a new item. /// /// /// The type of item to create. /// /// /// Creation options. You can specify if you would like to initialize /// default values for an item. /// /// /// An array of arguments to the constructor of the item. /// ///The newly created model item. ///if itemType is null protected abstract ModelItem CreateItem(Type itemType, CreateOptions options, params object[] arguments); ////// Takes an existing instance and creates a model item that is a deep clone /// of the instance. /// /// /// The item to wrap. /// ///A newly created model item that is a clone of the existing item. ///if item is null protected abstract ModelItem CreateItem(object item); ////// Create a new model item that represents a the value of a static member of a the given class. /// For example, to add a reference to Brushes.Red to the model call this methods with /// typeof(Brushes) and the string "Red". This will be serialized into XAML as /// {x:Static Brushes.Red}. /// /// /// The type that contains the static member being referenced. /// /// /// The name of the static member being referenced. /// protected abstract ModelItem CreateStaticMemberItem(Type type, string memberName); ////// Finds matching model items given a starting point to look. All /// walks are recursive. /// /// /// The model item to start the search. Items above this item /// will be ignored. This item, and any item below it in the /// hierarchy, will be included in the search. If this value is /// null, the root is used. /// /// /// The type of the object to find. This will enumerate all items /// within the given parent scope that are of the requested type. /// ////// An enumeration of model items matching the query. /// ///if type is null public abstract IEnumerableFind(ModelItem startingItem, Type type); /// /// Finds matching model items given a starting point to look. All /// walks are recursive. /// /// /// The model item to start the search. Items above this item /// will be ignored. This item, and any item below it in the /// hierarchy, will be included in the search. If this value is /// null, the root is used. /// /// /// A predicate that allows more complex type matching to be used. /// For example, the predicate could return true for both /// FrameworkElement and FrameworkContentElement. /// ////// An enumeration of model items matching the query. /// ///if match is null public abstract IEnumerableFind(ModelItem startingItem, Predicate match); /// /// Locates the model item in the given scope with the given name. Returns null if /// the model item could not be located. /// /// /// An optional scope to provide. If not provided, the root element will /// be used as a scope. If provided, the nearest INameScope in the hierarchy /// will be used to locate the item. /// /// /// The name to locate. /// ////// A model item whose name matches that provided, or null if no match was /// found. /// ///If name is null. public ModelItem FromName(ModelItem scope, string name) { return FromName(scope, name, StringComparison.Ordinal); } ////// Locates the model item in the given scope with the given name. Returns null if /// the model item could not be located. /// /// /// An optional scope to provide. If not provided, the root element will /// be used as a scope. If provided, the nearest INameScope in the hierarchy /// will be used to locate the item. /// /// /// The name to locate. /// /// /// Determines how the name should be compared. The default is to compare against /// ordinal. /// ////// A model item whose name matches that provided, or null if no match was /// found. /// ///If name is null. public abstract ModelItem FromName(ModelItem scope, string name, StringComparison comparison); ////// Creates a ModelItem for a given type. This method is called by /// ModelFactory when the user wishes to create a new item. /// internal ModelItem InvokeCreateItem(Type itemType, CreateOptions options, params object[] arguments) { return CreateItem(itemType, options, arguments); } ////// Creates a member item that refers to a static member of the given type. /// internal ModelItem InvokeCreateStaticMemberItem(Type type, string memberName) { return CreateStaticMemberItem(type, memberName); } ////// Takes an existing instance and wraps it in a ModelItem. The set /// properties on the instance are promoted to the model item. /// internal ModelItem InvokeCreateItem(object item) { return CreateItem(item); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- VarInfo.cs
- ReferenceEqualityComparer.cs
- XmlAttributeHolder.cs
- PropertyInfoSet.cs
- ScriptModule.cs
- StandardOleMarshalObject.cs
- SQLMoney.cs
- DelegatingConfigHost.cs
- TraceSection.cs
- BindUriHelper.cs
- NumericExpr.cs
- ReferenceConverter.cs
- PopOutPanel.cs
- MetadataHelper.cs
- VisualBasicSettingsConverter.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- RuleProcessor.cs
- LogLogRecord.cs
- AppSettingsExpressionBuilder.cs
- WindowsIdentity.cs
- MailWebEventProvider.cs
- ConsoleTraceListener.cs
- SBCSCodePageEncoding.cs
- EventRoute.cs
- FilteredXmlReader.cs
- DataGridViewColumn.cs
- ReadOnlyPropertyMetadata.cs
- StorageComplexPropertyMapping.cs
- XmlDeclaration.cs
- CredentialManagerDialog.cs
- CacheForPrimitiveTypes.cs
- AttributeCollection.cs
- ServicePointManager.cs
- ModelService.cs
- UInt16.cs
- XmlSerializableReader.cs
- QilLoop.cs
- DataGridTextBox.cs
- OleStrCAMarshaler.cs
- TemplateXamlTreeBuilder.cs
- Vector.cs
- ControlSerializer.cs
- EntryIndex.cs
- ToolStrip.cs
- ToolStripGripRenderEventArgs.cs
- IsolatedStorageException.cs
- InputEventArgs.cs
- GlobalEventManager.cs
- CachedFontFace.cs
- DataKey.cs
- CodeComment.cs
- XmlTextAttribute.cs
- TypeBuilder.cs
- WebConvert.cs
- MatrixKeyFrameCollection.cs
- OneOfScalarConst.cs
- RewritingSimplifier.cs
- IProvider.cs
- WorkflowInstanceProxy.cs
- ByeOperationAsyncResult.cs
- TextTreeTextBlock.cs
- PolyQuadraticBezierSegment.cs
- ScriptControl.cs
- FolderLevelBuildProviderCollection.cs
- DefaultProxySection.cs
- TabItemAutomationPeer.cs
- BindingEntityInfo.cs
- OracleException.cs
- SortedList.cs
- DescendantBaseQuery.cs
- ApplicationFileParser.cs
- ToolStripGrip.cs
- ReflectionServiceProvider.cs
- DateTimePicker.cs
- DataGridViewRow.cs
- CompilerScopeManager.cs
- DataObject.cs
- ContractSearchPattern.cs
- EditorBrowsableAttribute.cs
- OperandQuery.cs
- AuthenticationModuleElementCollection.cs
- ConnectionOrientedTransportChannelListener.cs
- ExpressionPrinter.cs
- WindowsFormsSectionHandler.cs
- GradientSpreadMethodValidation.cs
- MemberInfoSerializationHolder.cs
- DynamicActivityProperty.cs
- StructuralObject.cs
- MethodBody.cs
- GridViewRowPresenterBase.cs
- TypeListConverter.cs
- UpdateCompiler.cs
- ACE.cs
- TextEndOfParagraph.cs
- ObjectCloneHelper.cs
- Stylus.cs
- ByValueEqualityComparer.cs
- MetaTableHelper.cs
- Repeater.cs
- DoubleLink.cs