public async Task <bool> Start(CitySeeContext context) { foreach (PluginInfo pi in PluginList) { if (pi.InitFail) { continue; } try { var r = await pi.Instance.Start(context); pi.SetStartFail(r.Code != "0"); pi.SetMessage(r.Message); if (r.IsSuccess()) { pi.SetRunning(true); } } catch (Exception e) { pi.SetStartFail(true); pi.SetMessage(e.Message); } } return(true); }
public Task <ResponseMessage> Init(CitySeeContext context) { context.Services.AddDbContext <BuildingCommentDbContext>(options => { options.UseMySql(context.ConnectionString); }, ServiceLifetime.Scoped); context.Services.AddScoped <CommentManager>(); context.Services.AddScoped <ICommentStore, CommentStore>(); context.Services.AddScoped <Store.IGiveLikeStore, GiveLikeStore>(); context.Services.AddScoped <CommentReplyManager>(); context.Services.AddScoped <ICommentReplyStore, CommentReplyStore>(); context.Services.AddScoped <BuildingManager>(); context.Services.AddScoped <IBuildingStore, BuildingStore>(); return(Task.FromResult(new ResponseMessage())); }
public async Task <object> GetConfig(CitySeeContext context) { var r = await CitySeeContext.Current.PluginConfigStorage.GetConfig <TConfig>(this.PluginID); TConfig c = null; if (r.Code == "0") { c = r.Extension; } if (c == null) { c = GetDefaultConfig(context); } return(c); }
public async Task <bool> Init(CitySeeContext context) { foreach (PluginInfo pi in PluginList) { try { var r = await pi.Instance.Init(context); pi.SetInitFail(r.Code != "0"); pi.SetMessage(r.Message); } catch (Exception e) { pi.SetInitFail(true); pi.SetMessage(e.Message); } } return(true); }
public Task <ResponseMessage> Start(CitySeeContext context) { return(Task.FromResult(new ResponseMessage())); }
public Task OnMainConfigChanged(CitySeeContext context, CitySeeConfig newConfig) { return(Task.CompletedTask); }
object IPluginConfig.GetDefaultConfig(CitySeeContext context) { return(GetDefaultConfig(context)); }
Task <ResponseMessage> IPluginConfig.ConfigChanged(CitySeeContext context, object newConfig) { return(ConfigChanged(context, newConfig as TConfig)); }
protected abstract TConfig GetDefaultConfig(CitySeeContext context);
protected virtual Task <ResponseMessage> ConfigChanged(CitySeeContext context, TConfig newConfig) { return(Task.FromResult(new ResponseMessage())); }
public Task <ResponseMessage> Start(CitySeeContext context) { throw new NotImplementedException(); }
public Task OnMainConfigChanged(CitySeeContext context, CitySeeConfig newConfig) { throw new NotImplementedException(); }
public virtual Task <ResponseMessage> Init(CitySeeContext context) { return(Task.FromResult(new ResponseMessage())); }