public void AddEventEntry(IEventEntry entry) { if (_CanAddEntry(entry)) { Registry.Add(entry.EventTag, entry.Broadcaster); } }
private IEventEntry[] GetAndRemoveItems(List <IEventEntry> collection, int countFromBegining) { IEventEntry[] items = new IEventEntry[countFromBegining]; collection.CopyTo(0, items, 0, countFromBegining); collection.RemoveRange(0, countFromBegining); return(items); }
protected override void WriteEvent(IEventEntry eventEntry) { var translator = GetTranslator(); var data = translator.TranslateEvent(eventEntry); WriteToEventViewer(GetSource(), data, EventLogEntryType.Information); }
protected override void WriteEvent(IEventEntry eventEntry) { var translator = GetTranslator(); var data = translator.TranslateEvent(eventEntry); WriteToFile(data); }
public void Add(IEventEntry item) { if (!IsAddingPossible()) { return; } _safeQueue.SafeAccess(collection => collection.Add(item)); }
bool _CanAddEntry(IEventEntry entry) { return( entry != null && !entry.IsEmpty && !entry.EventTag.IsEmpty && !HasEventTag(entry.EventTag.Name) ); }
public IEventEntry FormatEvent(IEventEntry eventEntry) { var payload = eventEntry.Payload; if (!string.IsNullOrWhiteSpace(payload)) { payload = payload.Compress(); eventEntry.SetPayloadString(payload); } return(eventEntry); }
protected override void WriteEvent(IEventEntry transactionEntry) { if (transactionEntry != null) { if (transactionEntry.Id == Guid.Empty) { transactionEntry.Id = Guid.NewGuid(); } var str = Newtonsoft.Json.JsonConvert.SerializeObject(transactionEntry); PushData(str); } }
public async Task LogEventAsync(string message, IEventEntry eventEntry) { try { EventLogEntry entry = new EventLogEntry { Message = message, EventEntry = eventEntry }; SetLogEntryCommonProperties(entry); var document = _bsonDocumentBuilderService.BuildEventLogEntry(entry); await _dataAccessService.SaveAsync(document, _databaseName, _loggerName); } catch (Exception e) { throw new FailedToLogException("Failed to log : " + e.Message, e); } }
/// <summary> /// Initialises a new instance of the <see cref="DataEntryViewModel"/> class. /// </summary> /// <param name="model"> /// The associated model object. /// </param> /// <param name="getBeastie"> /// The function used to return a specific beastie from the data model. /// </param> public DataEntryViewModel( IEventEntry model, Func <string, Beastie> getBeastie) { bool isSeen = true; this.dataEntryModel = model; this.getBeastie = getBeastie; this.observations = model.Observations; this.beastieEntryViewModel = new BeastieEntryViewModel( this.observations.SetBeastie, isSeen); this.detailsViewModel = new EventDetailsEntryViewModel( this.observations, isSeen, this.beastieEntryViewModel.SetIsSeen); this.CurrentWorkspace = this.detailsViewModel; this.PopulatePageSelector(DataEntryViewModel.EventDetails); List <string> beastiePages = model.GetDataEntryPageNames(); foreach (string pageName in beastiePages) { this.PopulatePageSelector(pageName); } this.SaveCommand = new CommonCommand( this.Save); this.LoadCommand = new CommonCommand( this.Load); this.NewPage(DataEntryViewModel.EventDetails); }
/// <summary> /// Initialises a new instance of the <see cref="BodyViewModel"/> class. /// </summary> /// <param name="dataEntryModel"> /// The model object associated with the data entry process. /// </param> /// <param name="dataModel"> /// The model object containing data set. /// </param> /// <param name="fileFactory">beastie file factory</param> /// <param name="logger">the logger</param> public BodyViewModel( IEventEntry dataEntryModel, IDataManager dataModel, IBeastieDataFileFactory fileFactory, IAsLogger logger) { this.configurationViewModel = new ConfigurationViewModel( dataModel, fileFactory); this.consistencyViewModel = new ConsistencyViewModel(); this.reportsViewModel = new ReportsViewModel( dataModel, logger); this.dataEntryViewModel = new DataEntryViewModel( dataEntryModel, dataModel.FindBeastie); this.currentView = this.dataEntryViewModel; Messenger.Default.Register <MainViewMessage>(this, this.ChangeView); }
public string TranslateEvent(IEventEntry entry) { return(DumpObject(entry)); }
protected override void WriteEvent(IEventEntry transactionEntry) { System.Threading.Thread.Sleep(500); }
public void AddEventEntry(IEventEntry entry) { }
protected abstract void WriteEvent(IEventEntry transactionEntry);
protected override void WriteEvent(IEventEntry transactionEntry) { throw new Exception("I have failed event log.", new Exception("This is a test.", new Exception("inner most exception message"))); }