Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / InfoCardListRequest.cs / 1 / InfoCardListRequest.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.InfoCards { using System; using System.Collections.Generic; using System.IO; class InfoCardListRequest : UIAgentRequest { InfoCardPolicy m_policy; IListm_allCards; public InfoCardListRequest( IntPtr rpcHandle, Stream inArgs, Stream outArgs, ClientUIRequest parent ) : base( rpcHandle, inArgs, outArgs, parent ) { } protected override void OnInitializeAsSystem() { base.OnInitializeAsSystem(); m_policy = GetPolicy(); } protected override void OnMarshalInArgs() { // // Nothing to marshall // } protected override void OnProcess() { // // Get the full list of all infocards. // IList rows = ( IList ) GetAllCards(); if ( null != rows && 0 != rows.Count ) { IList cards = new List ( rows.Count ); for ( int i = 0; i < rows.Count; i++ ) { byte[ ] rawForm = rows[ i ].GetDataField(); try { using ( MemoryStream stream = new MemoryStream( rawForm ) ) { cards.Add( new InfoCard( stream ) ); } } finally { Array.Clear( rawForm, 0, rawForm.Length ); } } m_allCards = cards; } } protected override void OnMarshalOutArgs() { Stream stream = OutArgs; BinaryWriter writer = new BinaryWriter( stream ); if ( null != m_allCards && 0 != m_allCards.Count ) { StoreConnection connection = StoreConnection.GetConnection(); try { // // write thte count of the array. // writer.Write( m_allCards.Count ); for ( int i = 0; i < m_allCards.Count; i++ ) { // // Flush the writer to ensure that all data // is committed to the base stream before // we pass the base stream into the card. // writer.Flush(); m_allCards[ i ].AgentSerialize( stream, ( ParentRequest is GetTokenRequest ), m_policy, connection, new System.Globalization.CultureInfo( ParentRequest.UserLanguage ) ); } writer.Flush(); } finally { if ( null != m_allCards ) { foreach ( InfoCard icard in m_allCards ) { icard.ClearSensitiveData(); } } connection.Close(); } } else { // // write the count of the array as 0. // writer.Write( 0 ); } } IList GetAllCards() { StoreConnection connection = StoreConnection.GetConnection(); try { return ( IList ) connection.Query( QueryDetails.FullRow, connection.LocalDataSource, new QueryParameter( SecondaryIndexDefinition.ObjectTypeIndex, (Int32) StorableObjectType.InfoCard ) ); } finally { connection.Close(); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConfigXmlCDataSection.cs
- HtmlSelectionListAdapter.cs
- FormattedTextSymbols.cs
- PrimitiveCodeDomSerializer.cs
- AsyncOperation.cs
- SecurityElement.cs
- RelationshipDetailsCollection.cs
- IUnknownConstantAttribute.cs
- FileLoadException.cs
- TabItem.cs
- Rule.cs
- Avt.cs
- PolicyLevel.cs
- MetaForeignKeyColumn.cs
- ContainerUtilities.cs
- MessageSecurityOverMsmqElement.cs
- InvalidOleVariantTypeException.cs
- TextDocumentView.cs
- TTSEngineProxy.cs
- FixedTextContainer.cs
- SettingsBase.cs
- Constant.cs
- RuntimeArgumentHandle.cs
- IPHostEntry.cs
- WebPartTransformerCollection.cs
- SafeCertificateContext.cs
- EmbeddedMailObject.cs
- Function.cs
- SEHException.cs
- TextAnchor.cs
- XPathNodePointer.cs
- MonikerProxyAttribute.cs
- ClientEventManager.cs
- Int64AnimationUsingKeyFrames.cs
- JoinSymbol.cs
- FormsAuthenticationTicket.cs
- CommandEventArgs.cs
- NavigationPropertyAccessor.cs
- XamlSerializer.cs
- TextEditorLists.cs
- SafeEventLogReadHandle.cs
- LayoutEvent.cs
- TableProviderWrapper.cs
- ExtensibleClassFactory.cs
- XmlStringTable.cs
- ProcessThreadCollection.cs
- DependentList.cs
- ValidationRule.cs
- HttpHandlerActionCollection.cs
- String.cs
- WindowsMenu.cs
- DefaultTextStore.cs
- ConnectionManagementElementCollection.cs
- __ComObject.cs
- SRDisplayNameAttribute.cs
- WebResourceAttribute.cs
- ComAdminInterfaces.cs
- XmlMtomWriter.cs
- SelectionManager.cs
- OptimalBreakSession.cs
- ObjectHandle.cs
- UnsafeNativeMethods.cs
- _ConnectStream.cs
- BinarySecretKeyIdentifierClause.cs
- DBBindings.cs
- ListenerAdapter.cs
- DivideByZeroException.cs
- XmlDataDocument.cs
- FieldNameLookup.cs
- DoubleAnimationUsingPath.cs
- PenLineJoinValidation.cs
- Viewport2DVisual3D.cs
- ProfileGroupSettingsCollection.cs
- DoubleMinMaxAggregationOperator.cs
- diagnosticsswitches.cs
- HotSpot.cs
- IBuiltInEvidence.cs
- GridViewRowPresenter.cs
- HashRepartitionEnumerator.cs
- DrawingContext.cs
- NetCodeGroup.cs
- TextDecorationCollectionConverter.cs
- RawStylusSystemGestureInputReport.cs
- Int32CollectionValueSerializer.cs
- DataGridViewRowStateChangedEventArgs.cs
- AuthenticationSection.cs
- Button.cs
- ProcessModelInfo.cs
- ServicePointManagerElement.cs
- DataRowComparer.cs
- IsolatedStoragePermission.cs
- ExpressionNode.cs
- ProfessionalColors.cs
- AutomationPeer.cs
- PaintValueEventArgs.cs
- XmlQueryRuntime.cs
- ipaddressinformationcollection.cs
- XpsSerializerFactory.cs
- FlowDocumentFormatter.cs
- Base64Encoder.cs