示例#1
0
 public Form1()
 {
     InitializeComponent();
     _settings = new rdp_settings();
     if (!loadSettings())
         updateForm();
 }
示例#2
0
        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);
        }
示例#3
0
 public Form1()
 {
     InitializeComponent();
     _settings = new rdp_settings();
     if (!loadSettings())
     {
         updateForm();
     }
 }
示例#4
0
        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();
        }
示例#5
0
        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);
        }
示例#6
0
        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();
        }
示例#7
0
 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;
 }