示例#1
0
        private void SaveStreamToIsolatedStorage(string title, Stream stream)
        {
            IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication();

            if (!isolatedStorageFile.DirectoryExists(MainViewModel.DecksFolder))
            {
                isolatedStorageFile.CreateDirectory(MainViewModel.DecksFolder);
            }

            IsolatedStorageFileName = Path.Combine(MainViewModel.DecksFolder, title + MainViewModel.ZippedDeckExtension);
            IsolatedStorageFileStream isolatedStorageFileStream = isolatedStorageFile.CreateFile(IsolatedStorageFileName);

            Utils.CopyStream(stream, isolatedStorageFileStream);

            isolatedStorageFileStream.Close();

            ImageItem newImageItem = new ImageItem(title + MainViewModel.ZippedDeckExtension);

            if (!Images.Contains(newImageItem))
            {
                Images.Add(newImageItem);
            }
        }
        private void SaveStreamToIsolatedStorage(string title, Stream stream)
        {
            IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication();

            if (!isolatedStorageFile.DirectoryExists(MainViewModel.DecksFolder))
            {
                isolatedStorageFile.CreateDirectory(MainViewModel.DecksFolder);
            }

            IsolatedStorageFileName = Path.Combine(MainViewModel.DecksFolder, title + MainViewModel.ZippedDeckExtension);
            IsolatedStorageFileStream isolatedStorageFileStream = isolatedStorageFile.CreateFile(IsolatedStorageFileName);

            Utils.CopyStream(stream, isolatedStorageFileStream);

            isolatedStorageFileStream.Close();

            ImageItem newImageItem = new ImageItem(title + MainViewModel.ZippedDeckExtension);
            if (!Images.Contains(newImageItem))
            {
                Images.Add(newImageItem);
            }
        }