private void Process(IObservableMessage1 <ToyOrder> order) { try { TToy toy = _toyFactory.Create(); order.Completed(); } catch (Exception e) { Logger.Warn(e); order.Failed(); } }
private void OnToyAddClick(object sender, EventArgs e) { if (SelectedCategory == null) { return; } Toy toy = ToyFactory.Create(SelectedCategory); int toyIndex = GetNextAvailableToyIndex(SelectedCategory); string toyName = $"{SelectedCategory}{toyIndex}"; toy.Id = toyIndex; toy.Name = toyName; Toys.Add(toy); }