예제 #1
0
 public void AddEventEntry(IEventEntry entry)
 {
     if (_CanAddEntry(entry))
     {
         Registry.Add(entry.EventTag, entry.Broadcaster);
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
        protected override void WriteEvent(IEventEntry eventEntry)
        {
            var translator = GetTranslator();

            var data = translator.TranslateEvent(eventEntry);

            WriteToEventViewer(GetSource(), data, EventLogEntryType.Information);
        }
예제 #4
0
        protected override void WriteEvent(IEventEntry eventEntry)
        {
            var translator = GetTranslator();

            var data = translator.TranslateEvent(eventEntry);

            WriteToFile(data);
        }
예제 #5
0
        public void Add(IEventEntry item)
        {
            if (!IsAddingPossible())
            {
                return;
            }

            _safeQueue.SafeAccess(collection => collection.Add(item));
        }
예제 #6
0
 bool _CanAddEntry(IEventEntry entry)
 {
     return(
         entry != null &&
         !entry.IsEmpty &&
         !entry.EventTag.IsEmpty &&
         !HasEventTag(entry.EventTag.Name)
         );
 }
예제 #7
0
        public IEventEntry FormatEvent(IEventEntry eventEntry)
        {
            var payload = eventEntry.Payload;

            if (!string.IsNullOrWhiteSpace(payload))
            {
                payload = payload.Compress();

                eventEntry.SetPayloadString(payload);
            }
            return(eventEntry);
        }
예제 #8
0
 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);
     }
 }
예제 #9
0
 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);
     }
 }
예제 #10
0
        /// <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);
        }
예제 #11
0
        /// <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));
 }
예제 #13
0
 protected override void WriteEvent(IEventEntry transactionEntry)
 {
     System.Threading.Thread.Sleep(500);
 }
예제 #14
0
 public void AddEventEntry(IEventEntry entry)
 {
 }
예제 #15
0
 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")));
 }