static public void Save(Configuration config) { IsolatedStorageFile isoFile; isoFile = IsolatedStorageFile.GetUserStoreForAssembly(); try { using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream("WordPad", FileMode.OpenOrCreate, FileAccess.Write, isoFile)) { BinaryFormatter formatter; formatter = new BinaryFormatter(); formatter.Serialize(isoStream, config); } } catch { MessageBox.Show("Could not save configuration", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
static public void Store(WordPad wordpad) { Configuration config; config = new Configuration(); config.Location = wordpad.Location; config.Size = wordpad.Size; config.MRU = wordpad.MRU; if (wordpad.formatting.Visible) { config.FormatBar = true; } else { config.FormatBar = true; } if (wordpad.buttons.Visible) { config.ShortcutBar = true; } else { config.ShortcutBar = true; } Configuration.Save(config); }