예제 #1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="frmmneu"></param>
        public frmLogin(ref frmMenu frmMainMenu)
        {
            Stopwatch s = new Stopwatch();
            Program.logFlagStart(log, s, "1.Login InitializeComponent:");

            InitializeComponent();

            //============================/
            //========画面控件绑定=========/
            //============================/


            //============================/
            //========画面对象初始化=======/
            //============================/
            m_frmMainMenu = frmMainMenu;

            this.m_dicConds["UserID"] = "true";
            this.m_dicConds["UserName"] = "******";

            this.m_strDeliveryDBName = Common._sysrun.DataBaseName;

            //设定验证条件
            SetValidCondition();

            Program.logFlagEnd(log, s, "1.Login InitializeComponent:");

        }
예제 #2
0
파일: Program.cs 프로젝트: xlgwr/producting
        static void Main()
        {
            Stopwatch s = new Stopwatch();
            logFlagStart(log, s, "Main:主程序。");

            int processCount = 0;
            Process[] pa = Process.GetProcesses();//获取当前进程数组。

            foreach (Process PTest in pa)
            {
                if (PTest.ProcessName == Process.GetCurrentProcess().ProcessName)
                {
                    processCount += 1;
                }
            }

            if (processCount > 1)
            {

                //如果程序已经运行,则给出提示。并退出本进程。

                DialogResult dr;
                dr = DevExpress.XtraEditors.XtraMessageBox.Show(Process.GetCurrentProcess().ProcessName + "程序已经在运行!", "退出程序", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return; //Exit;

            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);


            Encrypt.Common.IV_64 = "RIFIDApp";
            Encrypt.Common.KEY_64 = "RIFIDApp";

            //读取系统配置信息(初始化运行 frmSetting 需注释)
            Common.GetIniData();

            //皮肤设定

            DevExpress.Skins.SkinManager.EnableMdiFormSkins();
            Application.SetCompatibleTextRenderingDefault(false);
            DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.Skins.FormSkins).Assembly);
            DevExpress.UserSkins.BonusSkins.Register();
            DevExpress.Skins.SkinManager.EnableFormSkins();
            Application.EnableVisualStyles();

            DevExpress.XtraGrid.Localization.GridResLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraGridCHS();
            DevExpress.XtraEditors.Controls.Localizer.Active = new Dxper.LocalizationCHS.Win.XtraEditorsCHS();
            DevExpress.XtraCharts.Localization.ChartResLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraChartsCHS();
            DevExpress.XtraLayout.Localization.LayoutLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraLayoutCHS();
            DevExpress.XtraPrinting.Localization.PreviewLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraPrintingCHS();
            DevExpress.XtraTreeList.Localization.TreeListResLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraTreeListCHS();
            //DevExpress.Office.Localization.OfficeResLocalizer.Active = new Dxper.LocalizationCHS.Win.OfficeCHS();
            //DevExpress.XtraSpreadsheet.Localization.XtraSpreadsheetLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraSpreadsheetCHS();

            //本地化控件
            //DevExpress.XtraBars.Localization.BarLocalizer.Active = new Dxper.LocalizationCHS.Win..DevExpressXtraBarsLocalizationCHS();
            //DevExpress.XtraLayout.Localization.LayoutLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraLayoutLocalizationCHS();
            //DevExpress.XtraEditors.Controls.Localizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraEditorsLocalizationCHS();
            //DevExpress.XtraGrid.Localization.GridLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraGridLocalizationCHS();
            //DevExpress.XtraNavBar.NavBarLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraNavBarLocalizationCHS();
            //DevExpress.XtraPrinting.Localization.PreviewLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraPrintingLocalizationCHS();
            //DevExpress.XtraTreeList.Localization.TreeListLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraTreeListLocalizationCHS();

            DevExpress.Skins.SkinManager.EnableFormSkins();
            DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(DevExpress.Skins.SkinManager.Default.Skins[Convert.ToInt32(Common._sysrun.FormSkin)].SkinName);
            Common._sysrun.EditColumnBackColor = System.Drawing.Color.Orange;

            EnumDefine.VersionNos = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            EnumDefine.StartupPath = Application.StartupPath;

            //==================================================/
            //================获取共通多语言信息=================/
            //==================================================/

            //如果不需要使用皮肤
            //DevExpress.LookAndFeel.UserLookAndFeel.Default.SetFlatStyle();

            //初始化参数
            //1.如果要运行frmSetting,则只需要以下二句,注意要将Common类的subGetIniData方法中的写上即可
            //2.将frmSetting窗体中的frmSetting_Load()这一句加上 this._sysrun = new SysRun();;
            //Common._rwconfig = new RWConfig(Common.GetSolutionPath(Application.StartupPath) + @"Language\chinese.ini");
            //Application.Run(new frmSetting());


            /*

            try
            {

                EnumDefine.VersionNos = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

                //=============版本更新确认======================
                //string mainAppExe = Application.StartupPath + "\\AutoUpdate_App.exe";
                string localXmlFile = Application.StartupPath + "\\UpdateList.xml";

                //从本地读取更新配置文件信息
                XmlFiles updaterXmlFiles = new XmlFiles(localXmlFile);

                string tempUpdatePath = Environment.GetEnvironmentVariable("Temp") + "\\" + "_" + updaterXmlFiles.FindNode("//Application").Attributes["applicationId"].Value + "_" + "y" + "_" + "x" + "_" + "m" + "_" + "\\";
                string UpdaterUrl = updaterXmlFiles.GetNodeValue("//Url") + "UpdateList.xml";

                //返回下载更新文件的临时目录
                DownAutoUpdateFile(tempUpdatePath, UpdaterUrl);

                string serverXmlFile = tempUpdatePath + "\\UpdateList.xml";

                if (System.IO.File.Exists(serverXmlFile))
                {

                    updaterXmlFiles = new XmlFiles(serverXmlFile);

                    XmlNodeList newNodeList = updaterXmlFiles.GetNodeList("AutoUpdater/Application/Version");

                    ////删除以前下载的临时文件
                    if (System.IO.Directory.Exists(serverXmlFile))
                    {
                        System.IO.Directory.Delete(serverXmlFile, true);
                    }

                    updaterXmlFiles = null;

                    if (newNodeList != null && newNodeList.Count > 0)
                    {
                        string newVer = newNodeList.Item(0).Value;

                        if (!newVer.Equals(EnumDefine.VersionNos))
                        {

                            if (XtraMsgBox.Show("检测到该软件有更新版本,确定要更新吗?", Common._SysName,
                                MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                            {

                                Application.Exit();

                                XtraMsgBox.Show("请点击“成型机生产管理系统”获取最新版本!", Common._SysName,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                                return;
                            }
                        }
                    }

                }

            }
            catch (Exception)
            {

            }

            //*/
            logFlagEnd(log, s, "Main:主程序。");
            try
            {
                logFlagStart(log, s, "Main:主程序-->初始化 总时间。");
                SysParam.m_daoCommon = new daoCommon();


                frmMenu frmmenu = new frmMenu();

                frmLogin frmLog = new frmLogin(ref frmmenu);

                logFlagEnd(log, s, "Main:主程序-->初始化 总时间。");


                frmLog.ShowDialog();
                if (frmLog.DialogResult == DialogResult.OK)
                {
                    frmLog.Dispose();
                    frmLog = null;

                    //frmmenu.ShowDialog();
                    GC.Collect();

                    //if (UHFReader.UHFReader.GetInstance().isComOpen)
                    //{
                    //    UHFReader.UHFReader.GetInstance().SetClosePort();
                    //}

                    Application.Exit();
                }
                else
                {
                    frmLog.Dispose();
                    frmLog = null;
                    GC.Collect();

                    //if (UHFReader.UHFReader.GetInstance().isComOpen)
                    //{
                    //    UHFReader.UHFReader.GetInstance().SetClosePort ();
                    //}

                    Application.Exit();
                }


            }
            catch (Exception)
            {


            }
        }
예제 #3
0
파일: frmMenu.cs 프로젝트: xlgwr/producting
        /// <summary>
        /// 从系统中注销
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barLogOnSys_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                Common._authorid = null;
                Common._authornm = null;

                Common._personid = null;
                Common._personname = null;
                Common._personpswd = null;

                Common._myTeamName = "";
                Common._orgTeamName = "";
                Common._JobForId = "";
                Common._JobForName = "";
                Common._LineId = "";
                Common._LineName = "";
                Common._ProjectId = "";
                Common._ProjectName = "";
                Common._TeamId = "";
                Common._TeamName = "";


                this.Dispose();

                frmMenu frmmenu = new frmMenu();
                frmLogin frmLog = new frmLogin(ref frmmenu);
                frmLog.ShowDialog();

                if (frmLog.DialogResult == DialogResult.OK)
                {
                    frmLog.Dispose();
                    frmLog = null;

                    frmmenu.ShowDialog();
                    GC.Collect();

                    Application.Exit();
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                XtraMsgBox.Show("", "", MessageBoxButtons.OK, MessageBoxIcon.Error, ex, this.GetType());
            }

        }