示例#1
0
        static public void printenglisghchar(string ch, System.Drawing.Printing.PrintPageEventArgs e, float x, float y)
        {
            float cInter = 5F;   //中文间距
            float eInter = 2.6F; //英文数字间距

            Brush ptBrush  = Brushes.Black;
            Font  ptFontCn = new Font("TEC", 18.5F, System.Drawing.FontStyle.Regular);
            Font  ptFontEn = null;

            if (EagleAPI2.ExistFont("MingLiU"))
            {
                ptFontEn = new Font("MingLiU", 11.0F, System.Drawing.FontStyle.Regular);
            }
            else if (EagleAPI2.ExistFont("楷体_GB2312"))
            {
                ptFontEn = new Font("楷体_GB2312", 12.0F, System.Drawing.FontStyle.Regular);
            }
            else if (EagleAPI2.ExistFont("Courier New"))
            {
                ptFontEn = new Font("Courier New", 12.0F, System.Drawing.FontStyle.Regular);
            }
            else if (EagleAPI2.ExistFont("Courier"))
            {
                ptFontEn = new Font("Courier", 12.0F, System.Drawing.FontStyle.Regular);
            }
            else
            {
                ptFontEn = new Font("System", 12.0F, System.Drawing.FontStyle.Regular);
            }
            Font ptFontNo = null;

            if (EagleAPI2.ExistFont("MingLiU"))
            {
                ptFontNo = new Font("MingLiU", 11.0F, System.Drawing.FontStyle.Regular);
            }

            ptFontEn = new Font("TEC", 18.0F, System.Drawing.FontStyle.Regular);
            ptFontNo = new Font("TEC", 18.0F, System.Drawing.FontStyle.Regular);
            string lkxm = ch;

            for (int i = 0; i < lkxm.Length; i++)
            {
                if (lkxm[i] == '-')
                {
                    e.Graphics.DrawString(lkxm[i].ToString(), ptFontCn, ptBrush, x + eInter * i - 0.3F, y - 1F);
                }
                else if (lkxm[i] > '9')
                {
                    e.Graphics.DrawString(lkxm[i].ToString(), ptFontEn, ptBrush, x + eInter * i, y - 1F);//-1F为TEC字体
                }
                else
                {
                    e.Graphics.DrawString(lkxm[i].ToString(), ptFontNo, ptBrush, x + eInter * i, y - 1F);//-1F为TEC字体
                }
            }
        }
示例#2
0
        static void Main()
        {
            EagleString.EagleFileIO.LogWrite("Starting Mainform...");

            if (!mutex.WaitOne(5000, false)) //等待5秒, 如果有相同实例运行则给用户提示
            {
                EagleString.EagleFileIO.LogWrite("已存在 Mainform 的运行实例.");
                return;
            }
            try
            {
                AutoUpdate();
                try
                {
                    Properties.Settings.Default.Reload();
                }
                catch { }
                DateTime ProgressStartTime = DateTime.Now;//用于杀死当前进程的判断 
                //EagleString.EagleFileIO.CreateShortCut20();
                //EagleString.EagleFileIO.BackupOptionsXml();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                GlobalVar.printProgram = false;//版本控制(true:打印与false:订票版本)

                GlobalVar.serverAddr = GlobalVar.ServerAddr.NA;
                BookTicket.bIbe      = false;

                //try
                //{
                //    if (EagleAPI2.ValidateFiles())//修复丢失文件
                //        return;
                //}
                //catch (Exception ex)
                //{
                //    EagleString.EagleFileIO.LogWrite("ValidateFiles : " + ex.Message);
                //}

                XMLConfig.XMLSettingsGlobal xmlConfig = new XMLSettingsGlobal().Read("XMLConfigGlobal.xml") as XMLSettingsGlobal;
                XMLConfigUser user = new XMLConfigUser().Read() as XMLConfigUser;
                GlobalVar.WebServer = xmlConfig.LoginWebService;
                GlobalVar.WebUrl    = xmlConfig.Website;
                string[] credential = xmlConfig.LoginCredential.Split(',');
                if (credential.Length > 1)
                {
                    GlobalVar.loginName                = credential[0];
                    GlobalVar.loginPassword            = credential[1];
                    Options.GlobalVar.B2bLoginName     = credential[0];
                    Options.GlobalVar.B2bLoginPassword = credential[1];
                }
                //EagleString.ServerCenterB2B sc = new EagleString.ServerCenterB2B();
                ////sc.ServerAddressB2B((EagleString.ServerAddr)byte.Parse(root),
                ////                    EagleString.LineProvider.DianXin,
                ////                    0,
                ////                    ref GlobalVar.WebServer,
                ////                    ref GlobalVar.WebUrl);

                Options.GlobalVar.IALoginUrl        = xmlConfig.Website;
                Options.GlobalVar.IALoginUrl1       = xmlConfig.Website1;
                Options.GlobalVar.IALoginUrl2       = xmlConfig.Website2;
                Options.GlobalVar.B2bWebServiceURL  = xmlConfig.LoginWebService;
                Options.GlobalVar.B2bWebServiceURL1 = xmlConfig.LoginWebService1;
                Options.GlobalVar.B2bWebServiceURL2 = xmlConfig.LoginWebService2;
                Options.GlobalVar.RemotingUrl       = xmlConfig.RemotingUrl;
                Options.GlobalVar.IAWebServiceURL   = xmlConfig.IAWebServiceURL;
                Options.GlobalVar.IAWebServiceURL1  = xmlConfig.IAWebServiceURL1;
                Options.GlobalVar.IAWebServiceURL2  = xmlConfig.IAWebServiceURL2;
                Options.GlobalVar.QueryType         = xmlConfig.QueryType;

                //兼容性代码,用于参数复制,记得删除
                if (user.IACode == "1")
                {
                    user.IACode      = xmlConfig.IACode;
                    user.SelectedISP = xmlConfig.SelectedISP;
                    user.Save();
                }

                Options.GlobalVar.IACode      = user.IACode;
                Options.GlobalVar.SelectedISP = user.SelectedISP;

                LogonForm logon = new LogonForm();
                if (logon.ShowDialog() == DialogResult.OK)
                {
                    SplashScreen.Splasher.Status = "正在启动…";
                    try { SplashScreen.Splasher.Banner = Image.FromFile("login.jpg"); }
                    catch { }
                    SplashScreen.Splasher.Show(typeof(SplashScreen.frmSplash));

                    frmMain mainForm = new frmMain();
                    Application.Run(mainForm);
                    GlobalVar.commServer.Close();
                    EagleAPI2.DeleteSubmittedPnr();
                }
                else
                {
                    try
                    {
                        GlobalAPI.Hosts.setDefault();
                    }
                    catch { }
                    return;
                }


                GlobalVar.mylis.AbortWork();
                LogoutForm lf = new LogoutForm();


                lf.ShowDialog();
                try
                {
                    GlobalAPI.Hosts.setDefault();
                }

                catch { }
                EagleString.BaseFunc.KillProcess("iprinter", ProgressStartTime);
                if (GlobalVar.gbIsRestartEagle)
                {
                    PrintTicket.RunProgram(Application.StartupPath + "\\iprinter.exe", "");
                }
            }
            finally
            {
                mutex.ReleaseMutex();
            }
        }
示例#3
0
        public static void printchinesechar(string ch, System.Drawing.Printing.PrintPageEventArgs e, float x, float y)
        {
            float cInter   = 5F;
            float eInter   = 2.6F;
            Brush ptBrush  = Brushes.Black;
            Font  ptFontCn = new Font("TEC", 18.5F, System.Drawing.FontStyle.Regular);
            Font  ptFontEn = null;

            if (EagleAPI2.ExistFont("MingLiU"))
            {
                ptFontEn = new Font("MingLiU", 11.0F, System.Drawing.FontStyle.Regular);
            }
            else if (EagleAPI2.ExistFont("楷体_GB2312"))
            {
                ptFontEn = new Font("楷体_GB2312", 12.0F, System.Drawing.FontStyle.Regular);
            }
            else if (EagleAPI2.ExistFont("Courier New"))
            {
                ptFontEn = new Font("Courier New", 12.0F, System.Drawing.FontStyle.Regular);
            }
            else if (EagleAPI2.ExistFont("Courier"))
            {
                ptFontEn = new Font("Courier", 12.0F, System.Drawing.FontStyle.Regular);
            }
            else
            {
                ptFontEn = new Font("System", 12.0F, System.Drawing.FontStyle.Regular);
            }
            Font ptFontNo = null;

            if (EagleAPI2.ExistFont("MingLiU"))
            {
                ptFontNo = new Font("MingLiU", 11.0F, System.Drawing.FontStyle.Regular);
            }

            ptFontEn = new Font("TEC", 18.0F, System.Drawing.FontStyle.Regular);
            ptFontNo = new Font("TEC", 18.0F, System.Drawing.FontStyle.Regular);

            if (ch.CompareTo("zzzzzzzzzzzzzzz") > 0)
            {
                string lkxm = ch;
                float  xpos = x;
                for (int i = 0; i < lkxm.Length; i++)
                {
                    if (lkxm[i] > 'z')
                    {
                        e.Graphics.DrawString(lkxm[i].ToString(), ptFontCn, ptBrush, xpos, y);//Z文
                        xpos += cInter;
                    }
                    else
                    {
                        e.Graphics.DrawString(lkxm[i].ToString(), ptFontEn, ptBrush, xpos, y + 2.5F - 1F);//E文  -1F为TEC字体
                        xpos += eInter;
                    }
                }
            }
            else
            {
                e.Graphics.DrawString(ch, ptFontEn, ptBrush, x, y);
            }
        }