Click here to Skip to main content
15,888,802 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to use WeakEventManager with reflection Pin
Sascha Lefèvre24-Jan-16 1:42
professionalSascha Lefèvre24-Jan-16 1:42 
GeneralRe: How to use WeakEventManager with reflection Pin
Kenneth Haugland24-Jan-16 3:25
mvaKenneth Haugland24-Jan-16 3:25 
GeneralRe: How to use WeakEventManager with reflection Pin
Kornfeld Eliyahu Peter24-Jan-16 3:42
professionalKornfeld Eliyahu Peter24-Jan-16 3:42 
GeneralRe: How to use WeakEventManager with reflection Pin
Kenneth Haugland24-Jan-16 3:47
mvaKenneth Haugland24-Jan-16 3:47 
AnswerRe: How to use WeakEventManager with reflection Pin
Sascha Lefèvre24-Jan-16 2:37
professionalSascha Lefèvre24-Jan-16 2:37 
GeneralRe: How to use WeakEventManager with reflection Pin
Kenneth Haugland24-Jan-16 3:11
mvaKenneth Haugland24-Jan-16 3:11 
GeneralRe: How to use WeakEventManager with reflection Pin
Sascha Lefèvre24-Jan-16 4:33
professionalSascha Lefèvre24-Jan-16 4:33 
GeneralRe: How to use WeakEventManager with reflection Pin
Kenneth Haugland24-Jan-16 4:45
mvaKenneth Haugland24-Jan-16 4:45 
It's basically just a helper that saves me some typing:
C#
/// <summary>
 ///     Implementation of <see cref="INotifyPropertyChanged" />  and Frameworkelement to simplify base drawing classes.
 /// </summary>
 public abstract class NotifierBase : INotifyPropertyChanged
 {
     /// <summary>
     ///     Multicast event for property change notifications.
     /// </summary>
     public event PropertyChangedEventHandler PropertyChanged;

     /// <summary>
     ///     Checks if a property already matches a desired value.  Sets the property and
     ///     notifies listeners only when necessary.
     /// </summary>
     /// <typeparam name="T">Type of the property.</typeparam>
     /// <param name="storage">Reference to a property with both getter and setter.</param>
     /// <param name="value">Desired value for the property.</param>
     /// <param name="propertyName">
     ///     Name of the property used to notify listeners.  This
     ///     value is optional and can be provided automatically when invoked from compilers that
     ///     support CallerMemberName.
     /// </param>
     /// <returns>
     ///     True if the value was changed, false if the existing value matched the
     ///     desired value.
     /// </returns>
     protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
     {

         if (Equals(storage, value))
         {
             return false;
         }

         storage = value;
         this.OnPropertyChanged(propertyName);
         return true;
     }

     /// <summary>
     ///     Notifies listeners that a property value has changed.
     /// </summary>
     /// <param name="propertyName">
     ///     Name of the property used to notify listeners.  This
     ///     value is optional and can be provided automatically when invoked from compilers
     ///     that support <see cref="CallerMemberNameAttribute" />.
     /// </param>
     protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
     {
         this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
     }
 }

GeneralRe: How to use WeakEventManager with reflection Pin
Sascha Lefèvre24-Jan-16 6:14
professionalSascha Lefèvre24-Jan-16 6:14 
GeneralRe: How to use WeakEventManager with reflection Pin
Kenneth Haugland24-Jan-16 17:34
mvaKenneth Haugland24-Jan-16 17:34 
GeneralRe: How to use WeakEventManager with reflection Pin
Kenneth Haugland24-Jan-16 22:45
mvaKenneth Haugland24-Jan-16 22:45 
AnswerRe: How to use WeakEventManager with reflection Pin
Pete O'Hanlon24-Jan-16 7:03
mvePete O'Hanlon24-Jan-16 7:03 
GeneralRe: How to use WeakEventManager with reflection Pin
Kenneth Haugland24-Jan-16 17:38
mvaKenneth Haugland24-Jan-16 17:38 
GeneralRe: How to use WeakEventManager with reflection Pin
Pete O'Hanlon24-Jan-16 21:25
mvePete O'Hanlon24-Jan-16 21:25 
AnswerRe: How to use WeakEventManager with reflection Pin
Kenneth Haugland25-Jan-16 7:42
mvaKenneth Haugland25-Jan-16 7:42 
GeneralRe: How to use WeakEventManager with reflection Pin
Sascha Lefèvre25-Jan-16 10:28
professionalSascha Lefèvre25-Jan-16 10:28 
QuestionHow to generate Dynamic buttons in C# from Database Values? Pin
Member 1224271723-Jan-16 19:54
Member 1224271723-Jan-16 19:54 
AnswerRe: How to generate Dynamic buttons in C# from Database Values? Pin
Mycroft Holmes23-Jan-16 20:13
professionalMycroft Holmes23-Jan-16 20:13 
GeneralRe: How to generate Dynamic buttons in C# from Database Values? Pin
Member 1224271723-Jan-16 20:25
Member 1224271723-Jan-16 20:25 
GeneralRe: How to generate Dynamic buttons in C# from Database Values? Pin
Mycroft Holmes23-Jan-16 20:30
professionalMycroft Holmes23-Jan-16 20:30 
Questionhow to implement this code for multiple clients using c sharp Pin
Member 1061979722-Jan-16 22:32
Member 1061979722-Jan-16 22:32 
AnswerRe: how to implement this code for multiple clients using c sharp Pin
OriginalGriff22-Jan-16 23:01
mveOriginalGriff22-Jan-16 23:01 
QuestionRe: how to implement this code for multiple clients using c sharp Pin
Paul Conrad23-Jan-16 6:00
professionalPaul Conrad23-Jan-16 6:00 
GeneralRe: how to implement this code for multiple clients using c sharp Pin
PIEBALDconsult23-Jan-16 6:13
mvePIEBALDconsult23-Jan-16 6:13 
GeneralRe: how to implement this code for multiple clients using c sharp Pin
PIEBALDconsult23-Jan-16 6:16
mvePIEBALDconsult23-Jan-16 6:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.