Ejemplo n.º 1
0
        /// <summary>
        /// Fires the ChangesApplied event.  If an original object IDescriptor has been set,
        /// then this directly handles the update.
        /// </summary>
        protected virtual void OnChangesApplied()
        {
            if (OriginalObject != null)
            {
                OriginalObject.CopyProperties(PropertyGrid.SelectedObject);
            }

            if (ChangesApplied != null)
            {
                ChangesApplied(this, new EventArgs());
            }
        }
Ejemplo n.º 2
0
        private void mementoPatternBtn_Click(object sender, RoutedEventArgs e)
        {
            OriginalObject original = new OriginalObject("Testing", "Memento Pattern");

            statusBarTB.Text = original.String1 + ", " + original.String2 + " | ";

            original.String1 = "Try change";
            original.String2 = "original object";

            statusBarTB.Text += original.String1 + ", " + original.String2 + " | ";

            original.Revert();

            statusBarTB.Text += original.String1 + ", " + original.String2 + " ";
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Fires the ChangesApplied event. If an original object IDescriptor has been set,
        /// then this directly handles the update.
        /// </summary>
        protected virtual void OnChangesApplied()
        {
            OriginalObject?.CopyProperties(PropertyGrid.SelectedObject);

            ChangesApplied?.Invoke(this, EventArgs.Empty);
        }
Ejemplo n.º 4
0
 public ModelBase()
 {
     OriginalObject = (T)Activator.CreateInstance <T>();
     ModifiedObject = OriginalObject.Clone();
 }