예제 #1
0
파일: Program.cs 프로젝트: xuyanning/JQGis
        static void Main()
        {
            bool createNew;

            using (System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out createNew))
            {
                if (createNew)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    //GlobalSettings.gDataPath = System.Configuration.ConfigurationManager.AppSettings["DataPath"];
                    CGisDataSettings.initGisDataSettings();

                    Application.Run(new FullScreenForm());
                    //Application.Run(new TestForm());
                    //Application.Run(new GISForm());
                }
                else
                {
                    MessageBox.Show("应用程序已经运行一个实例了");
                    System.Threading.Thread.Sleep(1000);
                    System.Environment.Exit(1);
                }
            }
        }
예제 #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (textBoxX1.Text.Length == 0 || textBoxX2.Text.Length == 0)
            {
                btnOK.Enabled = false;
                return;
            }


            CGisDataSettings.gCurrentProject.projectUrl       = CGisDataSettings.gProjectList[comboBoxEx1.SelectedIndex].projectUrl;//ipAddressInput1.Value;
            CGisDataSettings.gCurrentProject.userName         = textBoxX1.Text.Trim();
            CGisDataSettings.gCurrentProject.userPSD          = textBoxX2.Text.Trim();
            CGisDataSettings.gCurrentProject.projectLocalPath = CGisDataSettings.gProjectList[comboBoxEx1.SelectedIndex].projectLocalPath;

            CServerWrapper.ConnectToServer(CGisDataSettings.gCurrentProject.projectUrl);

            //string url = "http://" + GlobalSettings.gProjectUrl + "/webservice/usrlogin.asmx";

            string resultStr = null;

            if (CServerWrapper.isConnected)
            {
                resultStr = CServerWrapper.webLogin(CGisDataSettings.gCurrentProject.userName, CGisDataSettings.gCurrentProject.userPSD);
            }

            //try
            //{
            //    WebServiceAgent ag = new WebServiceAgent(url);
            //    resultStr = (string)ag.Invoke("CheckUsrLogin", GlobalSettings.gUserName, GlobalSettings.gUserPWD);
            //}
            //catch (System.Exception ex)
            //{
            //    MessageBox.Show(ex.ToString().Split('\n')[0]);
            //}
            //finally
            //{
            if (resultStr == "µÇ¼³É¹¦")
            {
                CGisDataSettings.UpdateConfigInfo();
                this.DialogResult = DialogResult.OK;     // Setting the DialogResult, will close the dialog, and the ShowDialog call will return.
            }
            else if (resultStr != null)
            {
                MessageBox.Show("Wrong User Name or Password");
                Environment.Exit(-1);
                //this.DialogResult
            }
            else
            {
                MessageBox.Show("No response from remote server, using local database instead");
                this.DialogResult = DialogResult.OK;
            }
            this.btnOK.Enabled = true;
            //}
            //GlobalVar.useLocalDB = true;
            //this.DialogResult = DialogResult.OK;
        }
예제 #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            CGisDataSettings.gCurrentProject.projectUrl       = CGisDataSettings.gProjectList[comboBoxEx1.SelectedIndex].projectUrl;//ipAddressInput1.Value;
            CGisDataSettings.gCurrentProject.userName         = textBoxX1.Text.Trim();
            CGisDataSettings.gCurrentProject.userPSD          = textBoxX2.Text.Trim();
            CGisDataSettings.gCurrentProject.projectLocalPath = CGisDataSettings.gProjectList[comboBoxEx1.SelectedIndex].projectLocalPath;
            CServerWrapper.isConnected = !(checkBoxX1.CheckState == CheckState.Checked);
            if (CServerWrapper.isConnected)
            {
                CServerWrapper.isConnected = CServerWrapper.ConnectToServer(CGisDataSettings.gCurrentProject.projectUrl);
            }

            //string url = "http://" + GlobalSettings.gProjectUrl + "/webservice/usrlogin.asmx";

            string resultStr = null;

            if (CServerWrapper.isConnected)
            {
                resultStr = CServerWrapper.webLogin(CGisDataSettings.gCurrentProject.userName, CGisDataSettings.gCurrentProject.userPSD);
                if (resultStr == "登录成功")
                {
                    CGisDataSettings.UpdateConfigInfo();
                    this.DialogResult = DialogResult.OK; // Setting the DialogResult, will close the dialog, and the ShowDialog call will return.
                }
                else if (resultStr != null)
                {
                    MessageBox.Show("用户名或密码错误");
                    //Environment.Exit(-1);
                    //this.DialogResult
                }
            }
            else
            {
                MessageBox.Show("脱机状态使用本系统");
                CGisDataSettings.UpdateConfigInfo();
                this.DialogResult = DialogResult.OK;
            }
            //this.btnOK.Enabled = true;
            //}
            //GlobalVar.useLocalDB = true;
            //this.DialogResult = DialogResult.OK;
        }