public Form1() { InitializeComponent(); _settings = new rdp_settings(); if (!loadSettings()) updateForm(); }
public static rdp_settings loadSettings(string sXmlFile) { //bool bRet = false; //var fields = typeof(rdp_settings).GetFields(); //foreach (var f in fields) // System.Diagnostics.Debug.WriteLine(f.Name +": "+ f.GetValue(this)); rdp_settings sett = null; try { using (StreamReader sr = new StreamReader(sXmlFile)) { string line = ""; line = sr.ReadToEnd(); sett = (rdp_settings)myxml.DeserializeFromXmlString(line, typeof(rdp_settings)); } } catch (Exception e) { System.Diagnostics.Debug.WriteLine("The xml file could not be read:"); System.Diagnostics.Debug.WriteLine(e.Message); } return(sett); }
public Form1() { InitializeComponent(); _settings = new rdp_settings(); if (!loadSettings()) { updateForm(); } }
private void mnuLoad_Click(object sender, EventArgs e) { string sXmlFile = ""; Lime49.OpenFileDialog ofd = new Lime49.OpenFileDialog(); ofd.Filter = "xml";// "applications|*.exe|all files|*.*"; if (ofd.ShowDialog() == DialogResult.OK) { sXmlFile = ofd.SelectedFile; if (System.IO.File.Exists(sXmlFile)) { rdp_settings rdpsett = rdp_settings.loadSettings(sXmlFile); if (rdpsett != null) { _settings = rdpsett; updateForm(); } } } ofd.Dispose(); }
bool loadSettings() { bool bRet = false; string AppPath; AppPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); if (!AppPath.EndsWith(@"\")) { AppPath += @"\"; } string sXmlFile = AppPath + "settings.xml"; if (System.IO.File.Exists(sXmlFile)) { rdp_settings rdpsett = rdp_settings.loadSettings(sXmlFile); if (rdpsett != null) { _settings = rdpsett; updateForm(); bRet = true; } } return(bRet); }
bool loadSettings() { bool bRet = false; string AppPath; AppPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); if (!AppPath.EndsWith(@"\")) AppPath += @"\"; string sXmlFile = AppPath + "settings.xml"; if (System.IO.File.Exists(sXmlFile)) { rdp_settings rdpsett = rdp_settings.loadSettings(sXmlFile); if (rdpsett != null) { _settings = rdpsett; updateForm(); bRet = true; } } return bRet; }