/// <summary> /// Engine entry.... all begins from here /// </summary> public static AppEngine New(GameObject gameObjectToAttach, IAppEntry entry, IList <IModuleInitable> modules) { Debuger.Assert(gameObjectToAttach != null && modules != null); AppEngine appEngine = gameObjectToAttach.AddComponent <AppEngine>(); appEngine._isNewByStatic = true; appEngine.GameModules = modules; appEngine.AppEntry = entry; return(appEngine); }
public void Run(IAppEntry entry, Form form = null) { var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); var setter = config.AppSettings.Settings["ShowTip"]; bool showTip; if (setter != null && bool.TryParse(setter.Value, out showTip) && showTip) { _notify.ShowBalloonTip(3000, _notify.Text, string.Format("{0}已启动,单击托盘图标可以最小化!", _notify.Text), ToolTipIcon.Info); setter.Value = bool.FalseString; config.Save(); } DisableCloseButton(); SetConsoleCtrlHandler(_handler = new HandlerRoutine(eventType => { Visible = false; _notify.Visible = false; Closing = true; if (form != null) { form.Close(); } _notify.Dispose(); Environment.Exit(0); return(false); }), true); _tokenSource = new CancellationTokenSource(); TaskHelper.Factory.StartNew(() => { entry.DoEntry(null); _handler(CtrlTypes.CTRL_CLOSE_EVENT); }, _tokenSource.Token).ObservedException(); if (form == null) { Application.Run(); } else { Application.EnableVisualStyles(); Application.Run(form); } }
internal PluginAppEntry(Plugin plugin, IAppEntry entry) { Plugin = plugin; Entry = entry; Attribute = entry.GetType().GetAppEntryAttribute(); }
/// <summary> /// Engine entry.... all begins from here /// </summary> public static AppEngine New(GameObject gameObjectToAttach, IAppEntry entry, IList<IModuleInitable> modules) { Debuger.Assert(gameObjectToAttach != null && modules != null); AppEngine appEngine = gameObjectToAttach.AddComponent<AppEngine>(); appEngine._isNewByStatic = true; appEngine.GameModules = modules; appEngine.AppEntry = entry; return appEngine; }