Beispiel #1
0
        //对话框载入
        private void OrderMainForm_Load(object sender, EventArgs e)
        {
            connectionIP = IOUtil.get_config_by_key(ConfigKeys.KEY_CONNECTION_IP);
            if (connectionIP == "")
            {
                PCListForm pCListForm = new PCListForm();
                if (pCListForm.ShowDialog() != DialogResult.OK)
                {
                    this.Close();
                    return;
                }
                connectionIP = pCListForm.ip;
                IOUtil.set_config_by_key(ConfigKeys.KEY_CONNECTION_IP, connectionIP);
            }

            db = new BathDBDataContext(connectionString);

            if (!db.DatabaseExists())
            {
                BathClass.printErrorMsg("连接IP不对或者网络不通,请重试!");
                connectionIP = "";
                IOUtil.set_config_by_key(ConfigKeys.KEY_CONNECTION_IP, connectionIP);
                this.Close();
                return;
            }
        }
Beispiel #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            connectionIP = IOUtil.get_config_by_key(ConfigKeys.KEY_CONNECTION_IP);
            if (connectionIP == "")
            {
                connectionIP = ".";
                IOUtil.set_config_by_key(ConfigKeys.KEY_CONNECTION_IP, ".");
            }
            var db = new BathDBDataContext(connectionString);
            if (!db.DatabaseExists())
            {
                MessageBox.Show("连接IP不对或者网络不通,请重试!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                return;
            }

            CheckDetect.Checked = (IOUtil.get_config_by_key(ConfigKeys.KEY_CHECK_DETECT) == "Y");
            CheckServer.Checked = (IOUtil.get_config_by_key(ConfigKeys.KEY_CHECK_SERVER) == "Y");
            CheckAuto.Checked = (IOUtil.get_config_by_key(ConfigKeys.KEY_CHECK_AUTO) == "Y");

            GroupDetect.Enabled = CheckDetect.Checked;
            TextTimeLimit.Text = IOUtil.get_config_by_key(ConfigKeys.KEY_TIME_LIMIT);
            TextMoneyLimit.Text = IOUtil.get_config_by_key(ConfigKeys.KEY_MONEY_LIMIT);

            CheckSMS.Checked = (IOUtil.get_config_by_key(ConfigKeys.KEY_SMS_OPERATION) == "Y");
            cmbComPort.Enabled = CheckSMS.Checked;
            if (cmbComPort.Enabled)
            {
                cmbComPort.Text = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSPORT);
            }
            txtBoxBaudRate.Enabled = CheckSMS.Checked;
            if (txtBoxBaudRate.Enabled)
            {
                txtBoxBaudRate.Text = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSBAUD);
            }

            //cmbComPort.Items.AddRange(System.IO.Ports.SerialPort.GetPortNames());

            m_thread_clearMemory = new Thread(new ThreadStart(clear_Memory));
            m_thread_clearMemory.IsBackground = true;
            m_thread_clearMemory.Start();

            //this.WindowState = FormWindowState.Minimized;
        }
Beispiel #3
0
        private void form_load_func()
        {
            //while (true)
            //{
            //}
            work_progress = "正在获取软件版本号...";
            productName = "";
            int cur_version = get_current_version(ref productName);
            //if (productName == "收银" || productName == "前台")
            //    register.Visible = true;
            //else
            //    register.Visible = false;

            work_progress = "正在检测网络连接...";
            db = new BathDBDataContext(connectionString);
            if (!db.DatabaseExists())
            {
                BathClass.printErrorMsg("连接IP不对或者网络不通,请重试!");
                this.Close();
                return;
                //PCListForm pCListForm = new PCListForm();
                //if (pCListForm.ShowDialog() != DialogResult.OK)
                //{
                //    //_logIn_progress_form.Close();
                //    this.Close();
                //    return;
                //}

                //connectionIP = pCListForm.ip;
                //BathClass.set_config_by_key("connectionIP", connectionIP);
                //db = new BathDBDataContext(connectionString);
                //if (!db.DatabaseExists())
                //{
                //    BathClass.printErrorMsg("连接IP不对或者网络不通,请重试!");
                //    //_logIn_progress_form.Close();
                //    this.Close();
                //    return;
                //}
            }

            work_progress = "正在检测软件版注册序列号...";
            //if (productName == "收银" || productName == "前台")
            //{
                if (!RegisterForm.registered())
                    hasRegistered = false;

                if (hasRegistered)
                    register.Visible = false;
                else if (!hasRegistered && !checkTrialTimes())
                    okBtn.Enabled = false;
            //}

            work_progress = "正在读取软件用户名...";
            read_users();
            id.Items.AddRange(idList.ToArray());
            if (id.Items.Count != 0)
                id.Text = id.Items[0].ToString();

            current_box = id;
            current_box.Focus();

            work_progress = "正在从服务器获取最新软件版本号...";
            BathClass.download_file(connectionIP, "version.ini", productName + "/version.ini");
            int new_version = read_version();
            if (new_version > cur_version)
            {
                //_logIn_progress_form.Close();
                start_updtate();
                this.Close();
                return;
            }
            updateSystemTime();
            //_logIn_progress_form.Close();
        }
Beispiel #4
0
        //对话框载入
        private void LogIn_Load(object sender, EventArgs e)
        {
            connectionIP = BathClass.get_config_by_key("connectionIP");
            if (connectionIP == "")
            {
                PCListForm pCListForm = new PCListForm();
                if (pCListForm.ShowDialog() != DialogResult.OK)
                {
                    this.Close();
                    return;
                }
                connectionIP = pCListForm.ip;
                BathClass.set_config_by_key("connectionIP", connectionIP);
            }

            db = new BathDBDataContext(connectionString);

            if (!db.DatabaseExists())
            {
                BathClass.printErrorMsg("连接IP不对或者网络不通,请重试!");
                connectionIP = "";
                BathClass.set_config_by_key("connectionIP", connectionIP);
                this.Close();
                return;
            }
            if (!RegisterForm.registered())
                hasRegistered = false;

            if (hasRegistered)
                register.Visible = false;
            else if (!hasRegistered && !checkTrialTimes())
                okBtn.Enabled = false;

            read_users();
            id.Items.AddRange(idList.ToArray());
            if (id.Items.Count != 0)
                id.Text = id.Items[0].ToString();
        }
Beispiel #5
0
        //对话框载入
        private void OrderMainForm_Load(object sender, EventArgs e)
        {
            read_connection_IP();
            if (connectionIP == "")
            {
                PCListForm pCListForm = new PCListForm();
                if (pCListForm.ShowDialog() != DialogResult.OK)
                {
                    this.Close();
                    return;
                }
                connectionIP = pCListForm.ip;
                write_connection_IP();
            }

            var db = new BathDBDataContext(connectionString);

            if (!db.DatabaseExists())
            {
                BathClass.printErrorMsg("连接IP不对或者网络不通,请重试!");
                PCListForm pCListForm = new PCListForm();
                if (pCListForm.ShowDialog() != DialogResult.OK)
                {
                    this.Close();
                    return;
                }
            }
        }