Exemple #1
0
 /// <summary>
 /// Saves the MachineStoreForAssembly dictionary in a machine-scoped isolated storage corresponding to the Perspective.Core assembly identity.
 /// </summary>
 public static void SaveMachineStoreForAssembly()
 {
     IsolatedStorageHelper.Save(_machineStoreForAssembly,
                                IsolatedStorageScope.Assembly |
                                IsolatedStorageScope.Machine,
                                _perspectiveFilename);
 }
Exemple #2
0
 /// <summary>
 /// Save a dictionary into an isolated storage corresponding to the kind of application (installed or ClickOnce deployed).
 /// </summary>
 /// <param name="sd">The dictionary to save.</param>
 /// <param name="fileName">The file name.</param>
 public static void Save(StorableDictionary sd, string fileName)
 {
     if (ApplicationDeployment.IsNetworkDeployed)
     {
         IsolatedStorageHelper.SaveToUserStoreForApplication(
             sd,
             fileName);
     }
     else
     {
         IsolatedStorageHelper.SaveToUserStoreForDomain(
             sd,
             fileName);
     }
 }
Exemple #3
0
 /// <summary>
 /// Fills a dictionary with the values stored in an isolated storage corresponding to the kind of application (installed or ClickOnce deployed).
 /// </summary>
 /// <param name="dictionary">The dictionary to fill.</param>
 /// <param name="fileName">The file name.</param>
 public static void Load(IDictionary dictionary, string fileName)
 {
     if (ApplicationDeployment.IsNetworkDeployed)
     {
         IsolatedStorageHelper.LoadFromUserStoreForApplication(
             dictionary,
             fileName);
     }
     else
     {
         IsolatedStorageHelper.LoadFromUserStoreForDomain(
             dictionary,
             fileName);
     }
 }
 /// <summary>
 /// Saves the Settings dictionary in an isolated storage corresponding to the Perspective.Core assembly.
 /// </summary>
 public static void SaveSettings()
 {
     if (ApplicationDeployment.IsNetworkDeployed)
     {
         IsolatedStorageHelper.SaveToUserStoreForApplication(
             _settings,
             _perspectiveFilename);
     }
     else
     {
         IsolatedStorageHelper.SaveForDomain(_settings,
                                             IsolatedStorageScope.Assembly |
                                             IsolatedStorageScope.Machine,
                                             _perspectiveFilename);
     }
 }
        /// <summary>
        /// Copies a file asynchronously to the user-scoped isolated storage for the application.
        /// </summary>
        /// <param name="sourceUri">The Uri of the source file.</param>
        /// <param name="fileName">The path of the destination file.</param>
        public static void CopyFileToUserStoreForApplicationAsync(Uri sourceUri, string fileName)
        {
            //using (var store = IsolatedStorageFile.GetUserStoreForApplication())
            //{
            //    CopyFileToUserStore(store, sourceUri, fileName);
            //}
            WebClient webClient = new WebClient();

            webClient.OpenReadCompleted +=
                (sender, e) =>
            {
                Stream stream = e.Result;
                try
                {
                    IsolatedStorageHelper.CopyFileToUserStoreForApplication(stream, fileName);
                }
                finally
                {
                    stream.Close();
                }
            };
            webClient.OpenReadAsync(sourceUri);
        }