Пример #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     using (SettingDialog form = new SettingDialog())
     {
         // DentalDialog form1 = new DentalDialog(item.Text, ItemID);
         DialogResult dr = form.ShowDialog();
         if (dr == DialogResult.OK)
         {
             LoadSettings();
         }
     }
 }
Пример #2
0
        private void LoadSettings()
        {
            //try
            //{
            XDocument xmlDoc  = XDocument.Load(Connection.XMLFile());
            var       servers = from person in xmlDoc.Descendants("Server")
                                select new
            {
                Name = person.Element("Name").Value,
                Type = person.Element("Type").Value
            };

            foreach (var server in servers)
            {
                Helper.ServerName = server.Name;
                Helper.Type       = server.Type;
                if (Helper.Type == "")
                {
                    using (SettingDialog form = new SettingDialog())
                    {
                        DialogResult dr = form.ShowDialog();
                        if (dr == DialogResult.OK)
                        {
                            LoadSettings();
                        }
                    }
                    return;
                }
                if (Helper.Type.Contains("Lite"))
                {
                    Global.LoadData(start, end);
                    autocomplete();
                    return;
                }
                if (Helper.Type.Contains("Enterprise"))
                {
                    if (IPAddressCheck(server.Name) != "")
                    {
                        Helper.ServerIP = IPAddressCheck(Helper.ServerName);
                        lblStatus.Text += IPAddressCheck(Helper.ServerName);
                        // IP = IPAddressCheck(Helper.serverName);
                        if (TestServerConnection())
                        {
                            lblStatus.Text      = lblStatus.Text + " Server connected   you can continue to login";
                            lblStatus.ForeColor = Color.Green;
                            Global.LoadData(start, end);
                            autocomplete();
                        }
                        else
                        {
                            using (SettingDialog form = new SettingDialog())
                            {
                                DialogResult dr = form.ShowDialog();
                                if (dr == DialogResult.OK)
                                {
                                    LoadSettings();
                                }
                            }

                            lblStatus.Text      = ("You are not able to connect to the server contact the administrator for further assistance");
                            lblStatus.ForeColor = Color.Red;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please start the server");
                        return;
                    }
                }
            }
            // MessageBox.Show(Helper.serverIP);


            //}
            //catch
            //{
            //    using (SettingDialog form = new SettingDialog())
            //    {

            //        DialogResult dr = form.ShowDialog();
            //        if (dr == DialogResult.OK)
            //        {
            //            LoadSettings();
            //        }
            //    }
            //}
        }