public void Save(bool releaseLock) { if (this.m_WebServiceAccount.EnableSaveSettings) { YellowstonePathology.YpiConnect.Contract.Identity.SavedSettings savedSettings = new SavedSettings(this.m_WebServiceAccount); SavedSettings.Write(savedSettings); } }
public WebServiceAccount(SavedSettings savedSettings) { this.m_UserName = savedSettings.UserName; this.m_Password = savedSettings.Password; this.m_LocalFileDownloadDirectory = savedSettings.LocalFileDownloadDirectory; this.m_LocalFileUploadDirectory = savedSettings.LocalFileUploadDirectory; this.m_IsKnown = false; this.m_EnableApplicationTimeout = false; this.m_ApplicationTimeoutMinutes = 0; }
private static void CreateLocalFolders(SavedSettings savedSettings) { if (!string.IsNullOrEmpty(savedSettings.LocalFileDownloadDirectory)) { if (!System.IO.Directory.Exists(savedSettings.LocalFileDownloadDirectory)) { System.IO.Directory.CreateDirectory(savedSettings.LocalFileDownloadDirectory); } } }
public static void Write(SavedSettings savedSettings) { IsolatedStorageFile isf = System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null); System.IO.Stream writer = new IsolatedStorageFileStream(SavedSettings.FileName, System.IO.FileMode.Create, isf); System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); formatter.Serialize(writer, savedSettings); writer.Close(); CreateLocalFolders(savedSettings); }
public static SavedSettings Read() { SavedSettings savedSettings = null; try { IsolatedStorageFile isf = System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null); System.IO.Stream reader = new IsolatedStorageFileStream(SavedSettings.FileName, System.IO.FileMode.Open, isf); System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); savedSettings = (SavedSettings)formatter.Deserialize(reader); reader.Close(); CreateLocalFolders(savedSettings); } catch (System.IO.FileNotFoundException) { savedSettings = new SavedSettings(); } return savedSettings; }
public static void ReadSavedSettings() { YellowstonePathology.YpiConnect.Contract.Identity.SavedSettings savedSettings = SavedSettings.Read(); m_Instance = new ApplicationIdentity(); m_Instance.WebServiceAccount = new WebServiceAccount(savedSettings); }