Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions Product.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Events
{
Expand Down Expand Up @@ -32,11 +32,17 @@ public string Name
get { return name; }
set
{
ProductEventArgs args = new ProductEventArgs(name, value);
name = value;
/*
* TODO #4 Инициировать уведомление об
* изменении наименования
*/
if (NameChanged != null)
{
NameChanged(this, args);
}
/**/
}
}
/// <summary>
Expand All @@ -47,11 +53,17 @@ public decimal Price
get { return price; }
set
{
ProductEventArgs args = new ProductEventArgs(price, value);
price = value;
/*
* TODO #5 Инициировать уведомление об
* изменении стоимости
*/
if (NameChanged != null)
{
PriceChanged(this, args);
}
/**/
}
}

Expand All @@ -62,7 +74,9 @@ public decimal Price
/*
* TODO #3 Добавить определение событий
*/

public event EventHandler<ProductEventArgs> NameChanged;
public event EventHandler<ProductEventArgs> PriceChanged;
/**/
#endregion

public Product(string name, decimal price)
Expand Down