public IActionResult Delete(int id) { PublicEvent thisEvent = dbContext.Events.FirstOrDefault(e => e.EventId == id); dbContext.Events.Remove(thisEvent); dbContext.SaveChanges(); return(RedirectToAction("Dashboard")); }
public void InvokeAllEvents() { PublicEvent?.Invoke(); PrivateEvent?.Invoke(); InternalEvent?.Invoke(); ProtectedEvent?.Invoke(); ProtectedInternalEvent?.Invoke(); }
internal Executions() { syncRoot = new object(); runningExecutions = new List<ExecutionInfo>(MaxExecutions); executionStarted = new PublicEvent<ExecutionsChangedEventHandler, ExecutionsChangedEventArgs>(); executionFinished = new PublicEvent<ExecutionsChangedEventHandler, ExecutionsChangedEventArgs>(); }
internal Executions() { syncRoot = new object(); runningExecutions = new List <ExecutionInfo>(MaxExecutions); executionStarted = new PublicEvent <ExecutionsChangedEventHandler, ExecutionsChangedEventArgs>(); executionFinished = new PublicEvent <ExecutionsChangedEventHandler, ExecutionsChangedEventArgs>(); }
public async Task UpdatePublicEvent(PublicEvent publicEvent) { if (publicEvent != null) { _context.PublicEvents.Update(publicEvent); await _context.SaveChangesAsync(); } }
public IActionResult Details(int id) { PublicEvent thisEvent = dbContext.Events .Include(e => e.Creator) .Include(e => e.Participants) .ThenInclude(p => p.Attending) .FirstOrDefault(e => e.EventId == id); return(View(thisEvent)); }
internal WurmConfigs( [NotNull] IWurmConfigDirectories wurmConfigDirectories, [NotNull] IWurmApiLogger logger, [NotNull] IPublicEventInvoker publicEventInvoker, [NotNull] IInternalEventAggregator eventAggregator, [NotNull] TaskManager taskManager) { if (wurmConfigDirectories == null) { throw new ArgumentNullException(nameof(wurmConfigDirectories)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (publicEventInvoker == null) { throw new ArgumentNullException(nameof(publicEventInvoker)); } if (eventAggregator == null) { throw new ArgumentNullException(nameof(eventAggregator)); } if (taskManager == null) { throw new ArgumentNullException(nameof(taskManager)); } this.wurmConfigDirectories = wurmConfigDirectories; this.logger = logger; this.publicEventInvoker = publicEventInvoker; this.eventAggregator = eventAggregator; this.taskManager = taskManager; onAvailableConfigsChanged = publicEventInvoker.Create( () => AvailableConfigsChanged.SafeInvoke(this, EventArgs.Empty), WurmApiTuningParams.PublicEventMarshallerDelay); onAnyConfigChanged = publicEventInvoker.Create( () => AnyConfigChanged.SafeInvoke(this, EventArgs.Empty), WurmApiTuningParams.PublicEventMarshallerDelay); try { Refresh(); } catch (Exception exception) { logger.Log(LogLevel.Error, "Error at initial configs update", this, exception); } taskHandle = new TaskHandle(Refresh, "WurmConfigs update"); taskManager.Add(taskHandle); eventAggregator.Subscribe(this); taskHandle.Trigger(); }
public async Task <Guid> PostAsync([FromBody] PublicEvent savableEvent) { var user = await _userManager.GetUserAsync(HttpContext.User); savableEvent.CreatedAt = DateTime.UtcNow; savableEvent.Creator = user; _context.PublicEvents.Add(savableEvent); await _context.SaveChangesAsync(); return(savableEvent.Id); }
internal WurmConfig(string gameSettingsFullPath, [NotNull] IPublicEventInvoker publicEventMarshaller, [NotNull] TaskManager taskManager, IWurmApiLogger logger) { if (gameSettingsFullPath == null) { throw new ArgumentNullException(nameof(gameSettingsFullPath)); } if (taskManager == null) { throw new ArgumentNullException(nameof(taskManager)); } gameSettingsFileInfo = new FileInfo(gameSettingsFullPath); if (gameSettingsFileInfo.Directory == null) { throw new WurmApiException("gameSettingsFileInfo.Directory is null, provided file raw path: " + gameSettingsFullPath); } Name = gameSettingsFileInfo.Directory.Name; this.taskManager = taskManager; onConfigChanged = publicEventMarshaller.Create(() => ConfigChanged.SafeInvoke(this, EventArgs.Empty), WurmApiTuningParams.PublicEventMarshallerDelay); configReader = new ConfigReader(this); try { Refresh(); } catch (Exception exception) { logger.Log(LogLevel.Error, "Error at initial config update: " + Name, this, exception); } configFileWatcher = new FileSystemWatcher(gameSettingsFileInfo.Directory.FullName) { Filter = gameSettingsFileInfo.Name, NotifyFilter = NotifyFilters.Size | NotifyFilters.LastWrite }; configFileWatcher.Changed += ConfigFileWatcherOnChanged; configFileWatcher.Created += ConfigFileWatcherOnChanged; configFileWatcher.Deleted += ConfigFileWatcherOnChanged; configFileWatcher.Renamed += ConfigFileWatcherOnChanged; configFileWatcher.EnableRaisingEvents = true; taskHandle = new TaskHandle(Refresh, "WurmConfig update: " + Name); taskManager.Add(taskHandle); taskHandle.Trigger(); }
public WurmCharacterSkills([NotNull] IWurmCharacter character, [NotNull] IPublicEventInvoker publicEventInvoker, [NotNull] IWurmLogsMonitorInternal logsMonitor, [NotNull] IWurmLogsHistory logsHistory, [NotNull] IWurmApiLogger logger, IWurmPaths wurmPaths, [NotNull] IInternalEventAggregator internalEventAggregator) { if (character == null) { throw new ArgumentNullException(nameof(character)); } if (publicEventInvoker == null) { throw new ArgumentNullException(nameof(publicEventInvoker)); } if (logsMonitor == null) { throw new ArgumentNullException(nameof(logsMonitor)); } if (logsHistory == null) { throw new ArgumentNullException(nameof(logsHistory)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (internalEventAggregator == null) { throw new ArgumentNullException(nameof(internalEventAggregator)); } this.character = character; this.publicEventInvoker = publicEventInvoker; this.logsMonitor = logsMonitor; this.logsHistory = logsHistory; this.logger = logger; skillsMap = new SkillsMap(); skillDumps = new SkillDumpsManager(character, wurmPaths, logger); UpdateCurrentServer(); onSkillsChanged = publicEventInvoker.Create( InvokeOnSkillsChanged, WurmApiTuningParams.PublicEventMarshallerDelay); internalEventAggregator.Subscribe(this); logsMonitor.SubscribeInternal(character.Name, LogType.Skills, EventHandler); }
public IActionResult Edit(int id) { if (HttpContext.Session.GetString("User") == null) { return(RedirectToAction("Index")); } else { PublicEvent thisEvent = dbContext.Events .Include(e => e.Creator) .Include(e => e.Participants) .ThenInclude(p => p.Attending) .FirstOrDefault(e => e.EventId == id); return(View(thisEvent)); } }
public async Task <ActionResult> Put(Guid id, [FromBody] PublicEvent incomingChange) { var existingPublicEvent = await _context.PublicEvents.FirstOrDefaultAsync(x => x.Id == id); if (existingPublicEvent == null) { return(NotFound()); } _context.Entry(existingPublicEvent).State = EntityState.Detached; existingPublicEvent = _mapper.Map(incomingChange, existingPublicEvent); _context.PublicEvents.Update(existingPublicEvent); await _context.SaveChangesAsync(); return(NoContent()); }
public IActionResult Update(PublicEvent editEvent, int id) { if (ModelState.IsValid) { PublicEvent thisEvent = dbContext.Events.FirstOrDefault(e => e.EventId == id); thisEvent.Title = editEvent.Title; thisEvent.Time = editEvent.Time; thisEvent.Date = editEvent.Date; thisEvent.DurationInt = editEvent.DurationInt; thisEvent.DurationTime = editEvent.DurationTime; thisEvent.Description = editEvent.Description; thisEvent.UpdatedAt = DateTime.Now; thisEvent.UserId = (int)HttpContext.Session.GetInt32("UserId"); dbContext.Update(thisEvent); dbContext.SaveChanges(); return(RedirectToAction("Dashboard")); } else { return(View("Edit", id)); } }
public MessageReport Create(PublicEvent obj) { var re = new MessageReport(); re.Message = "Error"; re.isSuccess = false; try { _PublicEventRepository.Add(obj); Save(); re.Message = "Thêm mới thành công"; re.isSuccess = true; } catch (Exception ex) { re.Message = ex.Message; re.isSuccess = false; } return(re); }
public static PublicEventDTO Create(PublicEvent publicEvent) { return(Projection.Compile().Invoke(publicEvent)); }
public async Task AddPublicEvent(PublicEvent publicEvent) { _context.PublicEvents.Add(publicEvent); await _context.SaveChangesAsync(); }
public void OnPublicEvent(PublicEvent e) { PublicEventHandlerInvokeCount++; }
public void RaisePublicEvent() { PublicEvent.SafeInvoke(this, () => new ViewModelClosedEventArgs(new TestViewModel(), true)); }
public void InvokePublicEvent() { PublicEvent?.Invoke(this, new PublicEventArgs()); }
private static void AddTypeEvent( IHTMLDiv parent, CompilationEvent type, Action <string> UpdateLocation ) { var div = new IHTMLDiv().AttachTo(parent); div.style.marginTop = "0.1em"; div.style.fontFamily = ScriptCoreLib.JavaScript.DOM.IStyle.FontFamilyEnum.Verdana; div.style.whiteSpace = ScriptCoreLib.JavaScript.DOM.IStyle.WhiteSpaceEnum.nowrap; var i = new PublicEvent().AttachTo(div); i.style.verticalAlign = "middle"; i.style.marginRight = "0.5em"; var s = new IHTMLAnchor { innerText = type.Name }.AttachTo(div); s.href = "#"; s.style.textDecoration = "none"; s.style.color = JSColor.System.WindowText; Action onclick = delegate { }; s.onclick += e => { e.PreventDefault(); s.focus(); UpdateLocation(type.Name); onclick(); }; s.onfocus += delegate { s.style.backgroundColor = JSColor.System.Highlight; s.style.color = JSColor.System.HighlightText; }; s.onblur += delegate { s.style.backgroundColor = JSColor.None; s.style.color = JSColor.System.WindowText; }; onclick = delegate { var children = new IHTMLDiv().AttachTo(div); children.style.paddingLeft = "2em"; AddTypeMethod(children, type.GetAddMethod(), UpdateLocation); AddTypeMethod(children, type.GetRemoveMethod(), UpdateLocation); var NextClickHide = default(Action); var NextClickShow = default(Action); NextClickHide = delegate { children.Hide(); onclick = NextClickShow; }; NextClickShow = delegate { children.Show(); onclick = NextClickHide; }; onclick = NextClickHide; }; }
public void PublicEventHandler(PublicEvent e) { PublicEventHandlerInvokeCount++; }
private static void AddTypeEvent( IHTMLDiv parent, CompilationEvent type, Action<string> UpdateLocation ) { var div = new IHTMLDiv().AttachTo(parent); div.style.marginTop = "0.1em"; div.style.fontFamily = ScriptCoreLib.JavaScript.DOM.IStyle.FontFamilyEnum.Verdana; div.style.whiteSpace = ScriptCoreLib.JavaScript.DOM.IStyle.WhiteSpaceEnum.nowrap; var i = new PublicEvent().AttachTo(div); i.style.verticalAlign = "middle"; i.style.marginRight = "0.5em"; var s = new IHTMLAnchor { innerText = type.Name }.AttachTo(div); s.href = "#"; s.style.textDecoration = "none"; s.style.color = JSColor.System.WindowText; Action onclick = delegate { }; s.onclick += e => { e.PreventDefault(); s.focus(); UpdateLocation(type.Name); onclick(); }; s.onfocus += delegate { s.style.backgroundColor = JSColor.System.Highlight; s.style.color = JSColor.System.HighlightText; }; s.onblur += delegate { s.style.backgroundColor = JSColor.None; s.style.color = JSColor.System.WindowText; }; onclick = delegate { var children = new IHTMLDiv().AttachTo(div); children.style.paddingLeft = "2em"; AddTypeMethod(children, type.GetAddMethod(), UpdateLocation); AddTypeMethod(children, type.GetRemoveMethod(), UpdateLocation); var NextClickHide = default(Action); var NextClickShow = default(Action); NextClickHide = delegate { children.Hide(); onclick = NextClickShow; }; NextClickShow = delegate { children.Show(); onclick = NextClickHide; }; onclick = NextClickHide; }; }
private object ConvertPayload() { switch (Event) { case PingEvent.EventString: return(PingEvent.FromJson(PayloadText)); case CommitCommentEvent.EventString: return(CommitCommentEvent.FromJson(PayloadText)); case CreateEvent.EventString: return(CreateEvent.FromJson(PayloadText)); case DeleteEvent.EventString: return(DeleteEvent.FromJson(PayloadText)); case DeploymentEvent.EventString: return(DeploymentEvent.FromJson(PayloadText)); case DeploymentStatusEvent.EventString: return(DeploymentStatusEvent.FromJson(PayloadText)); case ForkEvent.EventString: return(ForkEvent.FromJson(PayloadText)); case GollumEvent.EventString: return(GollumEvent.FromJson(PayloadText)); case InstallationEvent.EventString: return(InstallationEvent.FromJson(PayloadText)); case InstallationRepositoriesEvent.EventString: return(InstallationRepositoriesEvent.FromJson(PayloadText)); case IssueCommentEvent.EventString: return(IssueCommentEvent.FromJson(PayloadText)); case IssuesEvent.EventString: return(IssuesEvent.FromJson(PayloadText)); case LabelEvent.EventString: return(LabelEvent.FromJson(PayloadText)); case MemberEvent.EventString: return(MemberEvent.FromJson(PayloadText)); case MembershipEvent.EventString: return(MembershipEvent.FromJson(PayloadText)); case MilestoneEvent.EventString: return(MilestoneEvent.FromJson(PayloadText)); case OrganizationEvent.EventString: return(OrganizationEvent.FromJson(PayloadText)); case OrgBlockEvent.EventString: return(OrgBlockEvent.FromJson(PayloadText)); case PageBuildEvent.EventString: return(PageBuildEvent.FromJson(PayloadText)); case ProjectCardEvent.EventString: return(ProjectCardEvent.FromJson(PayloadText)); case ProjectColumnEvent.EventString: return(ProjectColumnEvent.FromJson(PayloadText)); case ProjectEvent.EventString: return(ProjectEvent.FromJson(PayloadText)); case PublicEvent.EventString: return(PublicEvent.FromJson(PayloadText)); case PullRequestEvent.EventString: return(PullRequestEvent.FromJson(PayloadText)); case PullRequestReviewEvent.EventString: return(PullRequestReviewEvent.FromJson(PayloadText)); case PullRequestReviewCommentEvent.EventString: return(PullRequestReviewCommentEvent.FromJson(PayloadText)); case PushEvent.EventString: return(PushEvent.FromJson(PayloadText)); case ReleaseEvent.EventString: return(ReleaseEvent.FromJson(PayloadText)); case RepositoryEvent.EventString: return(RepositoryEvent.FromJson(PayloadText)); case StatusEvent.EventString: return(StatusEvent.FromJson(PayloadText)); case WatchEvent.EventString: return(WatchEvent.FromJson(PayloadText)); default: throw new NotImplementedException( $"Event Type: `{Event}` is not implemented. Want it added? Open an issue at https://github.com/promofaux/GithubWebhooks"); } }
public IViewComponentResult Invoke(PublicEvent evnt) { return(View(evnt)); }