当前位置: 首页>>代码示例>>C#>>正文


C# IsolatedStorageFileStream.BeginRead方法代码示例

本文整理汇总了C#中System.IO.IsolatedStorage.IsolatedStorageFileStream.BeginRead方法的典型用法代码示例。如果您正苦于以下问题:C# IsolatedStorageFileStream.BeginRead方法的具体用法?C# IsolatedStorageFileStream.BeginRead怎么用?C# IsolatedStorageFileStream.BeginRead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.IsolatedStorage.IsolatedStorageFileStream的用法示例。


在下文中一共展示了IsolatedStorageFileStream.BeginRead方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AsyncEndRead_Disposed

		public void AsyncEndRead_Disposed ()
		{
			IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication ();
			using (IsolatedStorageFileStream fs = new IsolatedStorageFileStream ("moon", FileMode.Create, isf)) {
				byte [] data = new byte [2];
				KeyValuePair<IsolatedStorageFile, IsolatedStorageFileStream> kvp = new KeyValuePair<IsolatedStorageFile, IsolatedStorageFileStream> (isf, fs);
				IAsyncResult result = fs.BeginRead (data, 0, 2, new AsyncCallback (EndReadDisposed), kvp);
				result.AsyncWaitHandle.WaitOne ();
			}
		}
开发者ID:dfr0,项目名称:moon,代码行数:10,代码来源:IsolatedStorageFileStreamTest.cs

示例2: AsyncRead

		public void AsyncRead ()
		{
			IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication ();
			using (IsolatedStorageFileStream fs = new IsolatedStorageFileStream ("moon", FileMode.Create, isf)) {
				byte [] data = new byte [2];
				IAsyncResult result = fs.BeginRead (data, 0, 2, new AsyncCallback (EndRead), fs);
				result.AsyncWaitHandle.WaitOne ();

				isf.Remove (); // this removed everything
				Assert.Throws (delegate { fs.BeginRead (data, 0, 2, new AsyncCallback (EndRead), fs); }, typeof (IsolatedStorageException), "Remove/Write"); // Fails in Silverlight 3
				isf.Dispose ();
				Assert.Throws (delegate { fs.BeginRead (data, 0, 2, new AsyncCallback (EndRead), fs); }, typeof (ObjectDisposedException), "Dispose/Write");
			}
			isf = IsolatedStorageFile.GetUserStoreForApplication ();
			Assert.AreEqual (0, isf.GetFileNames ().Length, "Empty");
		}
开发者ID:dfr0,项目名称:moon,代码行数:16,代码来源:IsolatedStorageFileStreamTest.cs

示例3: AsyncEndRead_Removed

		public void AsyncEndRead_Removed ()
		{
			IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication ();
			using (IsolatedStorageFileStream fs = new IsolatedStorageFileStream ("moon", FileMode.Create, isf)) {
				byte [] data = new byte [2];
				KeyValuePair<IsolatedStorageFile, IsolatedStorageFileStream> kvp = new KeyValuePair<IsolatedStorageFile, IsolatedStorageFileStream> (isf, fs);
				IAsyncResult result = fs.BeginRead (data, 0, 2, new AsyncCallback (EndReadRemoved), kvp);
				result.AsyncWaitHandle.WaitOne ();
			}
			isf = IsolatedStorageFile.GetUserStoreForApplication ();
			Assert.AreEqual (0, isf.GetFileNames ().Length, "Empty");
		}
开发者ID:dfr0,项目名称:moon,代码行数:12,代码来源:IsolatedStorageFileStreamTest.cs

示例4: AsyncRead

		public void AsyncRead ()
		{
			IsolatedStorageFileStream isfs = new IsolatedStorageFileStream ("cas-AsyncRead", FileMode.Create);
			message = "AsyncRead";
			reset.Reset ();
			IAsyncResult r = isfs.BeginRead (new byte[0], 0, 0, new AsyncCallback (ReadCallback), isfs);
			Assert.IsNotNull (r, "IAsyncResult");
			if (!reset.WaitOne (timeout, true))
				Assert.Ignore ("Timeout");
			Assert.IsNull (message, message);
			isfs.Close ();
		}
开发者ID:Profit0004,项目名称:mono,代码行数:12,代码来源:IsolatedStorageFileStreamCas.cs


注:本文中的System.IO.IsolatedStorage.IsolatedStorageFileStream.BeginRead方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。