public ConstantsForm() { InitializeComponent(); this.data = ConstantsHolder.Singleton; this.propertyGrid.SelectedObject = this.data; }
/// <summary> /// Opens the instance stored in the saveFile /// </summary> /// <returns>red class instance</returns> private static ConstantsHolder OpenXml() { StreamReader R = null; try { XmlSerializer S = new XmlSerializer(typeof(ConstantsHolder)); R = new StreamReader(saveFile); ConstantsHolder ch = (ConstantsHolder)S.Deserialize(R); R.Close(); return(ch); } catch//(Exception ex) { if (R != null) { R.Close(); } Console.WriteLine("unable to load"); //System.Windows.Forms.MessageBox.Show(ex.ToString()); return(null); } }
/// <summary> /// To create the first xml /// </summary> public static void Main() { ConstantsHolder ch = new ConstantsHolder(); ch.SaveXml(); }