/// <summary> /// This method performs initializations for this object. /// </summary> public void Init() { // Create a new instance of a 'LayoutManager' object. this.LayoutManager = new LayoutManager(); // wire up the check changed listeners this.PromptForDeleteControl.CheckChangedListener = this; this.DisableHoveringControl.CheckChangedListener = this; // Always open Maximized this.WindowState = FormWindowState.Maximized; // add any initialization code here this.XmlFile = Path.Combine(Environment.CurrentDirectory, "NoteBoard.xml"); this.SettingsFile = Path.Combine(Environment.CurrentDirectory, "Setting.xml"); // If the file exists if (File.Exists(XmlFile)) { // set the xmlText string xmlText = File.ReadAllText(XmlFile); // If the xmlText string exists if (TextHelper.Exists(xmlText)) { // create a notes parser NotesParser parser = new NotesParser(); // load the notes this.Notes = parser.LoadNotes(xmlText); } } // If the file exists if (File.Exists(SettingsFile)) { // set the xmlText string xmlText = File.ReadAllText(SettingsFile); // If the xmlText string exists if (TextHelper.Exists(xmlText)) { // create a notes parser SettingsParser parser = new SettingsParser(); // load the Settings Settings = parser.ParseSetting(xmlText); } } // if the Settings does not exist if (!HasSettings) { // Create a new settings object this.Settings = new Setting(); } // Set the value of Prompt for Delete this.PromptForDeleteControl.Checked = Settings.PromptForDelete; this.DisableHoveringControl.Checked = Settings.DisableHoverControl; // If the Notes object does not exist if (!this.HasNotes) { // Create a new collection of 'Note' objects. this.Notes = new List <Note>(); } // Display the Notes this.DisplayNotes(); // enable the conntrols UIControl(); }