static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.ApplicationExit += Application_ApplicationExit; AppLog = new Ultra.Log.ApplicationLog(); __start: string con = string.Empty; BaseSurface vw; vw = Lanucher.Start("Ultra.Login.LoginView");//.ShowDialog(); con = Lanucher.ConnectonString; if (!CanConnDb(con)) { MsgBox.ShowMessage("无法连接至服务器", "无法连接至服务器!"); } using (var db = new Database()) { var dte = db.ExecuteScalar <DateTime>("select getdate()"); TimeSync.Default.StartSync(dte); } var dt = vw.ShowDialog(); if (dt == DialogResult.OK)//登录成功 { if (null == args || args.Length < 1) { vw = Lanucher.Start("Ultra.Login.MainView"); } else { vw = Lanucher.Start(args[0]); } } else if (dt == DialogResult.Cancel)//退出 { return; } dt = vw.ShowDialog(); if (dt == DialogResult.No) { Lanucher.Clean("OfficeSkins.Register()"); goto __start; } }
static void Main() { AppLog = new Ultra.Log.ApplicationLog(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); var tskid = Clear(); if (tskid > 0) { GetTaskStatus(tskid); } else { AppLog.DebugException(new Exception("Clear Task Fail.")); } }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.ApplicationExit += Application_ApplicationExit; AppLog = new Ultra.Log.ApplicationLog(); __start: string con = string.Empty; BaseSurface vw; vw = Lanucher.Start("Ultra.Login.LoginView");//.ShowDialog(); con = Lanucher.ConnectonString; if (!CanConnDb(con)) { MsgBox.ShowMessage("无法连接至服务器", "无法连接至服务器!"); } using (var db = new Database()) { var dte = db.ExecuteScalar<DateTime>("select getdate()"); TimeSync.Default.StartSync(dte); } var dt = vw.ShowDialog(); if (dt == DialogResult.OK)//登录成功 { if (null == args || args.Length < 1) vw = Lanucher.Start("Ultra.Login.MainView"); else vw = Lanucher.Start(args[0]); } else if (dt == DialogResult.Cancel)//退出 { return; } dt = vw.ShowDialog(); if (dt == DialogResult.No) { Lanucher.Clean("OfficeSkins.Register()"); goto __start; } }
static void Main() { AppLog = new Ultra.Log.ApplicationLog(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += Application_ThreadException; var config = new HttpSelfHostConfiguration("http://localhost:30000"); config.MessageHandlers.Add(new FileHandler()); config.MaxReceivedMessageSize = 2147483647;//允许接收的文件大小 //TokenInspector tokenInspector = new TokenInspector() { // InnerHandler = // new System.Web.Http.Dispatcher.HttpControllerDispatcher(config) //}; config.Routes.MapHttpRoute( "Default", "api/{controller}/{id}", new { id = RouteParameter.Optional } //, constraints: null //, handler: null ); try { using (HttpSelfHostServer server = new HttpSelfHostServer(config)) { server.OpenAsync().Wait(); AppLog.DebugException(new Exception("PortNumber:30000")); var t = new Thread(() => { while (true) { Thread.Sleep(30 * 60 * 1000); GC.Collect(); } }); t.IsBackground = true; t.SetApartmentState(ApartmentState.STA); t.Start(); t.Join(); } } catch (Exception ex) { AppLog.DebugException(ex); } }
static void Main() { AppLog = new Ultra.Log.ApplicationLog(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); int sec = 0; bool trc; string filepath; var conn = Init(out sec, out trc, out filepath); RunToDb r = new RunToDb(conn, AppLog, filepath, sec); r.Trace = trc; r.StartSync(); AppLog.DebugException(new Exception("Sync Start")); var t = new Thread(() => { while (true) { GC.Collect(); Thread.Sleep(5000); } }); t.IsBackground = true; t.Start(); t.Join(); }
public Service1() { InitializeComponent(); AppLog = new Log.ApplicationLog(); }
static void Main(string[] args) { AppLog = new Ultra.Log.ApplicationLog(); try { var dsk = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); var lnk = Path.Combine(dsk, "客易工厂系统.lnk"); var hdsk = Path.Combine(dsk, "Ultra.WLSys.ERP.exe.lnk"); if (File.Exists(hdsk)) File.Delete(hdsk); hdsk = Path.Combine(dsk, "客易工厂系统.exe.lnk"); if (File.Exists(hdsk)) File.Delete(hdsk); using (ShellLink shortcut = new ShellLink()) { shortcut.Target = Application.ExecutablePath; shortcut.WorkingDirectory = Path.GetDirectoryName(Application.ExecutablePath); shortcut.Description = "客易工厂系统"; shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal; shortcut.Save(lnk); } var p = Process.Start(new ProcessStartInfo { FileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SvcUpdate.exe"),//+ " cli", Arguments = "cli" }); } catch { } finally { } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); __start: string con = string.Empty; Ultra.Web.Core.Configuration.OptionConfig cfg = null; BaseSurface vw; //if (null == args || args.Length < 1) { cfg = Lanucher.OptCfg; //--登录前加载特定模块,以进行登录前的一些数据处理或更新操作 string upd_dll = "Ultra.BLgn.dll"; var dllp = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, upd_dll); if (File.Exists(dllp)) { try { var asm = System.Reflection.Assembly.LoadFrom(dllp); var tp = asm.GetType("Ultra.BLgn.Update"); if (null != tp) { var mi = tp.GetMethod("Run", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static); if (null != mi) { //Thread t = new Thread(() => //{ try { mi.Invoke(null, new object[] { cfg }); } catch { } //}); //t.IsBackground = true; //t.SetApartmentState(ApartmentState.STA); //t.Start(); } } } catch { } } Lanucher.ReLoadConfig(); #if DEBUG //var rw = cfg.Get<string>("RDSWEB"); //if (string.IsNullOrEmpty(rw)) //{ // cfg.Set<string>("RDSWEB", "http://121.196.129.96/ext/dfghjkl/"); //} //rw = cfg.Get<string>("RDSWEB"); //Lanucher.Cache.Put<string>("Ultra.SYS.RDS", rw); #endif if (Lanucher.IsNeedUsrCfg) { var cfgvw = Lanucher.Start("Ultra.FAS.Login.ConfigView"); if (cfgvw.ShowDialog() != DialogResult.OK) { MsgBox.ShowErrMsg("配置错误!应用程序即将退出"); return; } } //Ultra.Surface.Lanuch.Lanucher.Start("FAS.FinView.FinRptView").ShowDialog(); return; vw = Lanucher.Start("Ultra.FAS.Login.LoginView");//.ShowDialog(); con = vw.ConnString; } var dt = vw.ShowDialog(); if (dt == DialogResult.OK)//登录成功 { if (null == args || args.Length < 1) { vw = Lanucher.Start("Ultra.FAS.Login.MainView"); } else vw = Lanucher.Start(args[0]); } else if (dt == DialogResult.Cancel)//退出 { return; } dt = vw.ShowDialog(); if (dt == DialogResult.No) { Lanucher.Clean("OfficeSkins.Register()"); goto __start; } }