Exemple #1
0
        public static int waitService_initfinish()
        {
            new ServiceController(EcoGlobalVar.gl_ServiceName);
            int    num = 0;
            string interProcessKeyValue = InterProcessShared <System.Collections.Generic.Dictionary <string, string> > .getInterProcessKeyValue("ServiceStatus");

            while (num < 60 && (interProcessKeyValue == null || (!interProcessKeyValue.Equals("ready") && !interProcessKeyValue.Equals("failed"))))
            {
                System.Threading.Thread.Sleep(1000);
                interProcessKeyValue = InterProcessShared <System.Collections.Generic.Dictionary <string, string> > .getInterProcessKeyValue("ServiceStatus");

                num++;
            }
            if (num >= 60)
            {
                return(-2);
            }
            if (interProcessKeyValue.Equals("failed"))
            {
                return(-3);
            }
            return(0);
        }
Exemple #2
0
        public static bool isService_initfinish()
        {
            string interProcessKeyValue = InterProcessShared <System.Collections.Generic.Dictionary <string, string> > .getInterProcessKeyValue("ServiceStatus");

            return(interProcessKeyValue != null && (interProcessKeyValue.Equals("ready") || interProcessKeyValue.Equals("failed")));
        }
Exemple #3
0
        private void butlogin_Click(object sender, System.EventArgs e)
        {
            this.m_forceClose = 0;
            try
            {
                if (this.tbuserId.Text == "")
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Login_needname, new string[0]));
                    this.tbuserId.Focus();
                }
                else
                {
                    if (this.tbpassword.Text == "")
                    {
                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Login_needpsw, new string[0]));
                        this.tbpassword.Focus();
                    }
                    else
                    {
                        string text = "Standalone";
                        string interProcessKeyValue = InterProcessShared <System.Collections.Generic.Dictionary <string, string> > .getInterProcessKeyValue("Listen_Port");

                        if (!string.IsNullOrEmpty(interProcessKeyValue) && System.Convert.ToInt32(interProcessKeyValue) != 0)
                        {
                            ValuePairs.setValuePair("ServicePort", interProcessKeyValue);
                        }
                        System.Version version  = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                        string         serialNo = ValuePairs.getSerialNo(false);
                        string         param    = string.Concat(new object[]
                        {
                            this.tbuserId.Text,
                            "\n",
                            this.tbpassword.Text,
                            "\n",
                            version,
                            "\n",
                            text,
                            "\nLocal\n",
                            serialNo
                        });
                        progressPopup progressPopup = new progressPopup("User Login", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_Login, new string[0]), Resources.login_background, new progressPopup.ProcessInThread(this.checkAuth), param, 0);
                        progressPopup.StartPosition = FormStartPosition.CenterScreen;
                        progressPopup.ShowDialog();
                        object return_V = progressPopup.Return_V;
                        int?   num      = return_V as int?;
                        if (num == -1)
                        {
                            EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvConnectFail, new string[0]));
                            this.m_forceClose = -1;
                            base.Close();
                        }
                        else
                        {
                            if (num == -2)
                            {
                                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Login_loginfail, new string[0]));
                            }
                            else
                            {
                                if (num == -3)
                                {
                                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Login_VerMismatch, new string[0]));
                                }
                                else
                                {
                                    if (num == -4)
                                    {
                                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_waitready, new string[0]));
                                    }
                                    else
                                    {
                                        this.m_userName = this.tbuserId.Text;
                                        this.m_psw      = this.tbpassword.Text;
                                        EcoLanguage.ChangeLang(this.cbolanguage.SelectedIndex);
                                        base.Close();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.m_forceClose = -1;
                base.Close();
            }
        }