Example #1
0
        private void frm_Login_Load(object sender, EventArgs e)
        {
            //Read the connection string from the registry S118
            string      registryConnectionString = "";
            RegistryKey ConnectionString         = Registry.CurrentUser.CreateSubKey("SOFTWARE\\AutomationConnection");

            registryConnectionString = ConnectionString.GetValue("ConnectionForAutomation").ToString();

            try
            {
                if (registryConnectionString == "")
                {
                    MessageBox.Show("The connection to the server is not established, please check the connection parameters with the server.");
                    frm_setServerParameters frm_ssparam = new frm_setServerParameters();
                    frm_ssparam.ShowDialog();

                    btn_enter.Enabled = false;
                }
                else
                {
                    PublicVariable.MainConnectionString = CryptionAlgorithm.DecryptTextUsingUTF8(registryConnectionString);
                }
            }
            catch
            {
                btn_enter.Enabled = false;
                MessageBox.Show("No connection to the server");
            }



            // show date
            System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar();
            PublicVariable.TodayDate = string.Format("{0:yyyy/MM/dd}", Convert.ToDateTime((pc.GetYear(DateTime.Now) + "/" + pc.GetMonth(DateTime.Now) + "/" + pc.GetDayOfMonth(DateTime.Now))));
            lbl_date.Text            = PublicVariable.TodayDate;

            // show ip
            string      computerName = System.Environment.MachineName;
            string      IP           = "";
            IPHostEntry ipe          = Dns.GetHostByName(computerName);

            IPAddress[] IpAddress = ipe.AddressList;
            lbl_IP.Text = IpAddress[0].ToString();

            //show time
            timer1_Tick(sender, e);
        }
Example #2
0
        private void lbl_setServerParameter_Click(object sender, EventArgs e)
        {
            frm_setServerParameters frm_ssparam = new frm_setServerParameters();

            frm_ssparam.ShowDialog();
        }