Ejemplo n.º 1
0
        private void ReceiverOnMessageReceived(
            object sender, MessageReceivedEventArgs e)
        {
            var o = MessageParser.Parse(e.Message);

            if (o == null)
            {
                ParsingFailed?.Invoke(
                    this,
                    new ParsingFailedEventArgs(e.ContactId, e.Message));
                return;
            }

            var item = new ReminderItem(o.Date, o.Message, e.ContactId, ReminderItemStatus.Awaiting);

            try
            {
                _storage.Add(item);

                AddingSucceeded?.Invoke(
                    this,
                    new AddingSucceededEventArgs(new AddReminderModel(item)));
            }
            catch (Exception exception)
            {
                AddingFailed?.Invoke(
                    this,
                    new AddingFailedEventArgs(new AddReminderModel(item), exception));
            }
        }
Ejemplo n.º 2
0
 public void OnAddingFailed(object sender, AddingFailedEventArgs e)
 {
     AddingFailed?.Invoke(sender, e);
 }