Example #1
0
        public ScriptCodeForm(MainForm mainform)
        {
            this.m_mainform = mainform;
            g_lua.RegisterFunction("lt2ArrayList", this, typeof(ScriptCodeForm).GetMethod("lt2ArrayList"));
            g_lua.RegisterFunction("lt2ArrayList_parms", this, typeof(ScriptCodeForm).GetMethod("lt2ArrayList_parms"));
            g_lua.RegisterFunction("lt_GetType", this, typeof(ScriptCodeForm).GetMethod("lt_GetType"));
            g_lua.RegisterFunction("SaveScriptIntoDatabase", this, typeof(ScriptCodeForm).GetMethod("SaveScriptIntoDatabase"));

            string strInitFileName = Path.Combine(Application.StartupPath, @"Plugins\LuaEditor\scriptcode.lua");
            if (!File.Exists(strInitFileName))
            {
                MessageBox.Show("找不到" + strInitFileName, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            g_lua.DoFile(strInitFileName);
        }
Example #2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (ConfigurationManager.AppSettings["remoting"] == "true")
            {
                EnableRemoting = true;
              
                
            }

            if (args.Length < 1)
            {
                MessageBox.Show(string.Format("启动失败,请使用 UpdatePrograme.exe 启动本程序。"), "错误",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


#if (!_DEBUG)
            if (ProgramAlreadyRunning() && args[0] != "-Debug")
            {
                MessageBox.Show("此工具不能双开。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
#endif

            //add by cuiwei 07.8.21
            EV ev = new EV();
            ev.evPath(Path.GetDirectoryName(Application.ExecutablePath));            
            //add end
            
            // ftp init
            m_ftp = new FTPclient(m_ftp_hostName, m_ftp_user, m_ftp_psw);
            //m_ftp.Upload("c:/path.txt", m_ftp_basedir + "xxxx");

            // 数据库选择
            if (!m_bSkillBranch)
            {
                if (forPublic)
                {
                    m_bLoadBackupDB = false;
                }
                else
                {
                    //DialogResult dr = MessageBox.Show("要读Head策划库,点<是>;\r\n要读分支库(1-0-8-1380,2009.03.25),点<否>。", "选择策划库", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    //if (dr == DialogResult.Yes)
                    //    m_bLoadBackupDB = false;
                    //else
                    //    m_bLoadBackupDB = true;

                    DialogResult dr = MessageBox.Show("要读Head策划库,点<是>;\r\n要退出程序,点<否>。", "是否继续", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr == DialogResult.Yes)
                        m_bLoadBackupDB = false;
                    else
                        return;
                }
            }
            
            TimeLog log = null;
            
            do
            {
                try
                {
                    if (!InitSettings())
                        return;

                    if (m_bRestart)
                    {
                        m_bRestart = false;
                    }
                    m_MainForm = new MainForm();
                    
                    try
                    {
                        log = new TimeLog();
                        ClearRecordLocks(MainForm.conn);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }

                    if (RightsSettings.AllowSave)
                        log.Log(TimeLog.enumLogType.ltstart, "主窗口", "应用程序启动", "主版本=" + Helper.GetVersionInfo());
                    else
                        log.Log(TimeLog.enumLogType.ltstart, "主窗口", "应用程序启动", "主版本=" + Helper.GetVersionInfo() + " [只读版本]");

                    m_MainForm.Text += "(" + Helper.GetVersionInfo() + ")";

                    Application.Run(m_MainForm);

                    m_rightmgr.Uninit();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("{0}", ex.Message), "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                finally
                {
                    if (log != null)
                    {
                        log.Log(TimeLog.enumLogType.ltend, null, null, null);
                        log.Clear();
                    }
                }
            }
            while(m_bRestart); // 检查是否需要重新启动主窗口

            if (EnableRemoting)
            {
                DataTableServerProxy.DisconnectServer();
            }
        }