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

            var data = translator.TranslateEvent(eventEntry);

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

            var data = translator.TranslateEvent(eventEntry);

            WriteToFile(data);
        }
Esempio n. 5
0
        public void Add(IEventEntry item)
        {
            if (!IsAddingPossible())
            {
                return;
            }

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

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

                eventEntry.SetPayloadString(payload);
            }
            return(eventEntry);
        }
Esempio n. 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);
     }
 }
Esempio n. 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);
     }
 }
Esempio n. 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);
        }
Esempio n. 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));
 }
Esempio n. 13
0
 protected override void WriteEvent(IEventEntry transactionEntry)
 {
     System.Threading.Thread.Sleep(500);
 }
Esempio n. 14
0
 public void AddEventEntry(IEventEntry entry)
 {
 }
Esempio n. 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")));
 }