static void Main() { // enable XP theme support Application.EnableVisualStyles(); Application.DoEvents(); const string MUTEX = CoreConst.c_MUTEX_App; bool createdNew = false; Mutex mutex = new Mutex(true, MUTEX, out createdNew); if (!createdNew) { MessageBox.Show(ResString.GetEnumDisplayName(typeof(UIError), UIError.OnlyOneProgram)); mutex.Close(); return; } #if EpsonLcd int lcid = PubFunc.GetLanguage(); if (lcid == -1) { // 未连接usb线,无法获取软件语言,启动终止. MessageBox.Show(ResString.GetResString("NoFoundUSBReturn"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #else AllParam cur = new AllParam(); int lcid = cur.GetLanguage(); #endif Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo(lcid); #if true PrinterWrite mainWin = new PrinterWrite(); if (mainWin.Start()) { Application.Run(mainWin); } #else FormHeadBoard hb = new FormHeadBoard(); Application.Run(hb); #endif mutex.Close(); }
static void Main() { // enable XP theme support Application.EnableVisualStyles(); Application.DoEvents(); //Application.Run(new AboutForm()); //Application.Run(new CaliWizard()); //Application.Run(new Updater()); //Application.Run(new PasswordForm()); //Application.Run(new CleanForm()); //SetLanguage(); //Chinese XP system if (((System.Globalization.CultureInfo.InstalledUICulture.LCID & 0xff) == 04) && System.Environment.OSVersion.Version.Major == 5 && System.Environment.OSVersion.Version.Minor == 1) { string filename = System.Environment.SystemDirectory + Path.DirectorySeparatorChar + "conime.exe"; if (File.Exists(filename)) { System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo(); Info.FileName = filename; System.Diagnostics.Process Proc; try { Proc = System.Diagnostics.Process.Start(Info); } catch (System.ComponentModel.Win32Exception e) { return; } //等待3秒钟 //Proc.WaitForExit(3000); } } AllParam cur = new AllParam(); int lcid = cur.GetLanguage(); //string name = "en-US"; //name = "zh-chs"; //name = "zh-cht"; const string MUTEX = CoreConst.c_MUTEX_App; bool createdNew = false; Mutex mutex = new Mutex(true, MUTEX, out createdNew); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo(lcid); if (!createdNew) { MessageBox.Show(ResString.GetEnumDisplayName(typeof(UIError), UIError.OnlyOneProgram)); mutex.Close(); return; } try { MainForm mainWin = new MainForm(); Application.AddMessageFilter(mainWin); if (mainWin.Start()) { Application.Run(mainWin); } mutex.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
static void Main(string[] args) { #if EpsonLcd bool showUI = true; try { if (args != null && args.Length > 0) { showUI = bool.Parse(args[0]); } } catch { // showUI = false; } #endif // enable XP theme support Application.EnableVisualStyles(); Application.DoEvents(); //SetLanguage(); //Chinese XP system if (((System.Globalization.CultureInfo.InstalledUICulture.LCID & 0xff) == 04) && System.Environment.OSVersion.Version.Major == 5 && System.Environment.OSVersion.Version.Minor == 1) { string filename = System.Environment.SystemDirectory + Path.DirectorySeparatorChar + "conime.exe"; if (File.Exists(filename)) { System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo(); Info.FileName = filename; System.Diagnostics.Process Proc; try { Proc = System.Diagnostics.Process.Start(Info); } catch //(System.ComponentModel.Win32Exception e) { return; } //等待3秒钟 //Proc.WaitForExit(3000); } } const string MUTEX = CoreConst.c_MUTEX_App; bool createdNew = false; Mutex mutex = new Mutex(true, MUTEX, out createdNew); if (!createdNew) { #if EpsonLcd Process process = RuningInstance(); MyData data = ProcessMessaging.GetShareMem(); //您new一个也行 data.InfoCode = showUI?1:0; //消息码 data.ProcessID = process.Id; //接收进程ID ProcessMessaging.SetShareMem(data); Thread.Sleep(100); return; #else MessageBox.Show(ResString.GetEnumDisplayName(typeof(UIError), UIError.OnlyOneProgram)); mutex.Close(); return; #endif } #if EpsonLcd int lcid = PubFunc.GetLanguage(); if (lcid == -1) { // 未连接usb线,无法获取软件语言,启动终止. MessageBox.Show(ResString.GetResString("NoFoundUSBReturn"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #else AllParam cur = new AllParam(); int lcid = cur.GetLanguage(); #endif Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo(lcid); bool splashEnable = PubFunc.GetEnableSplash(); if (splashEnable) { Splasher.ShowSplash(1000); } string skinName = cur.GetSkinName(); #if EpsonLcd MainForm mainWin = new MainForm(showUI); #else MainForm mainWin = new MainForm(true, skinName); #endif Application.AddMessageFilter(mainWin); if (mainWin.Start()) { Application.Run(mainWin); } mutex.Close(); }
static void Main() { double d0 = System.Environment.TickCount; LogWriter.WriteLog(new string[] { "BYHXPrinterManager Main() Start at:" + d0.ToString() }, true); // enable XP theme support Application.EnableVisualStyles(); Application.DoEvents(); //SetLanguage(); //Chinese XP system if (((System.Globalization.CultureInfo.InstalledUICulture.LCID & 0xff) == 04) && System.Environment.OSVersion.Version.Major == 5 && System.Environment.OSVersion.Version.Minor == 1) { string filename = System.Environment.SystemDirectory + Path.DirectorySeparatorChar + "conime.exe"; if (File.Exists(filename)) { System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo(); Info.FileName = filename; System.Diagnostics.Process Proc; try { Proc = System.Diagnostics.Process.Start(Info); } catch //(System.ComponentModel.Win32Exception e) { return; } } } try { //if (!PubFunc.IsFactoryUser()) // Splasher.ShowSplash(1000); AllParam cur = new AllParam(); int lcid = cur.GetLanguage(); const string MUTEX = CoreConst.c_MUTEX_App; bool createdNew = false; Mutex mutex = new Mutex(true, MUTEX, out createdNew); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo(lcid); if (!createdNew) { MessageBox.Show(ResString.GetEnumDisplayName(typeof(UIError), UIError.OnlyOneProgram)); mutex.Close(); return; } double d1 = System.Environment.TickCount; LogWriter.WriteLog(new string[] { "new MainForm()之前耗时:" + (d1 - d0).ToString() + "毫秒" }, true); MainForm mainWin = new MainForm(); double d2 = System.Environment.TickCount; LogWriter.WriteLog(new string[] { "new MainForm()耗时:" + (d2 - d1).ToString() + "毫秒" }, true); //Application.AddMessageFilter(mainWin); if (mainWin.Start()) { double d3 = System.Environment.TickCount; LogWriter.WriteLog(new string[] { "mainWin.Start()耗时:" + (d3 - d2).ToString() + "毫秒" }, true); LogWriter.WriteLog(new string[] { "Application.Run(mainWin) at:" + d0.ToString() }, true); Application.Run(mainWin); } mutex.Close(); } catch (Exception e) { MessageBox.Show(e.Message); } }