Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / RetriableClipboard.cs / 1305376 / RetriableClipboard.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Presentation { using System.Threading; using System.Windows; using System.Windows.Media.Imaging; using System.Runtime.InteropServices; using System.Runtime; using System.Diagnostics; // The clipboard may be accessed by other processes. // RetriableClipboard retries several times before giving up. static class RetriableClipboard { const int retryCount = 10; const int sleepTime = 50; internal static IDataObject GetDataObject() { for (int i = 0; i < retryCount; i++) { try { return Clipboard.GetDataObject(); } catch (Exception err) { Trace.WriteLine(err.ToString()); if (Fx.IsFatal(err)) { throw; } Thread.Sleep(sleepTime); } } return null; } internal static void SetDataObject(object data, bool copy) { for (int i = 0; i < retryCount; i++) { try { Clipboard.SetDataObject(data, copy); return; } catch (Exception err) { Trace.WriteLine(err.ToString()); if (Fx.IsFatal(err)) { throw; } Thread.Sleep(sleepTime); } } } internal static void SetImage(BitmapSource image) { for (int i = 0; i < retryCount; i++) { try { Clipboard.SetImage(image); return; } catch (Exception err) { Trace.WriteLine(err.ToString()); if (Fx.IsFatal(err)) { throw; } Thread.Sleep(sleepTime); } } } } } // 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
- ConfigPathUtility.cs
- ModuleBuilderData.cs
- DecimalFormatter.cs
- __FastResourceComparer.cs
- GridViewUpdateEventArgs.cs
- Executor.cs
- ResponseStream.cs
- DecoratedNameAttribute.cs
- DataPagerCommandEventArgs.cs
- AppSettingsReader.cs
- ConstructorArgumentAttribute.cs
- QueryParameter.cs
- SrgsDocumentParser.cs
- QualificationDataItem.cs
- ObjectDataSourceSelectingEventArgs.cs
- CatalogUtil.cs
- SourceFileBuildProvider.cs
- ListenDesigner.cs
- WindowProviderWrapper.cs
- SmtpNetworkElement.cs
- MemberCollection.cs
- XmlBindingWorker.cs
- ConfigXmlSignificantWhitespace.cs
- CodeIterationStatement.cs
- PathFigureCollectionConverter.cs
- MetadataItemCollectionFactory.cs
- HttpListenerException.cs
- OrderByBuilder.cs
- HttpHandlerAction.cs
- SecurityKeyType.cs
- SoapAttributeAttribute.cs
- CompleteWizardStep.cs
- CommandDevice.cs
- HyperLinkColumn.cs
- ChangeTracker.cs
- StreamWriter.cs
- HelpInfo.cs
- MethodImplAttribute.cs
- Directory.cs
- ConstraintStruct.cs
- Model3D.cs
- FunctionDetailsReader.cs
- SlipBehavior.cs
- HttpPostedFile.cs
- IfJoinedCondition.cs
- XPathDocumentIterator.cs
- ChtmlTextWriter.cs
- ThumbButtonInfo.cs
- CryptoHelper.cs
- GridViewUpdatedEventArgs.cs
- TreePrinter.cs
- SqlCharStream.cs
- Brush.cs
- Symbol.cs
- OutputCacheSection.cs
- COM2IPerPropertyBrowsingHandler.cs
- OdbcError.cs
- DBSchemaRow.cs
- RootBrowserWindowAutomationPeer.cs
- ModifyActivitiesPropertyDescriptor.cs
- HiddenFieldPageStatePersister.cs
- ExpandSegment.cs
- FileUtil.cs
- ListMarkerSourceInfo.cs
- ExtendedPropertyCollection.cs
- ContainerTracking.cs
- SiteMapNodeItem.cs
- storagemappingitemcollection.viewdictionary.cs
- SocketException.cs
- XPathBuilder.cs
- AssemblyInfo.cs
- IdentityNotMappedException.cs
- Base64WriteStateInfo.cs
- CalendarKeyboardHelper.cs
- CodeCastExpression.cs
- PolygonHotSpot.cs
- ZoomPercentageConverter.cs
- NetworkInformationPermission.cs
- WebBrowserPermission.cs
- Maps.cs
- DataListItem.cs
- ReferencedAssembly.cs
- ResourceExpression.cs
- HtmlInputReset.cs
- _LoggingObject.cs
- PeerTransportListenAddressConverter.cs
- DetailsViewCommandEventArgs.cs
- SafeNativeMethods.cs
- LogExtentCollection.cs
- XmlILModule.cs
- FilterElement.cs
- ClassValidator.cs
- RotateTransform.cs
- GuidConverter.cs
- LinqDataSource.cs
- FontStretchConverter.cs
- HuffCodec.cs
- ToolStripContentPanel.cs
- UdpSocket.cs
- DataRecordObjectView.cs