C# viss kompilējas. Vai patterns pareizi uzrakstīts? using System.ComponentModel;
public class Zomg : INotifyPropertyChanged
{
public event EventHandler Gloop;
public event PropertyChangedEventHandler PropertyChanged;
protected void OnGloop(EventArgs e)
{
if (Gloop != null) Gloop(this, e);
}
protected void OnPropertyChanged(PropertyChangedEventArgs e)
{
if (PropertyChanged != null) PropertyChanged(this, e);
}
} C++/CLI nez kamdēļ kliedz, ka kaut kādas add un remove funkcijas nav implementētas PropertyChangedEventHandler eventam. Vai patterns pareizi uzrakstīts? using namespace System::ComponentModel;
publc ref class Zomg : public INotifyPropertyChanged
{
public:
event EventHandler^ Gloop;
virtual event PropertyChangedEventHandler^ PropertyChanged; // virtual keywordu vajadzēja!
protected:
virtual void OnGloop(EventArgs^ e)
{
Gloop(this, e);
}
virtual void OnPropertyChanged(PropertyChangedEventArgs^ e)
{
PropertyChanged(this, e);
}
};
|