1#if !XAMARIN && !WINDOWS_UWP
10using System.Windows.Input;
11using System.ComponentModel;
30 get {
return _provider; }
40 CommandBinding binding;
42 binding =
new CommandBinding(ApplicationCommands.Save, SaveCommand, CanExecuteSave);
45 binding =
new CommandBinding(ApplicationCommands.Undo, UndoCommand, CanExecuteUndo);
48 binding =
new CommandBinding(ApplicationCommands.New, NewCommand, CanExecuteNew);
51 binding =
new CommandBinding(ApplicationCommands.Delete, RemoveCommand, CanExecuteRemove);
55 private static void CanExecuteSave(
object target, CanExecuteRoutedEventArgs e)
59 if (ctl !=
null && ctl.Provider !=
null)
71 e.CanExecute = result;
74 private static void SaveCommand(
object target, ExecutedRoutedEventArgs e)
77 if (ctl !=
null && ctl.Provider !=
null)
81 private static void CanExecuteUndo(
object target, CanExecuteRoutedEventArgs e)
85 if (ctl !=
null && ctl.Provider !=
null)
87 if (ctl.Provider.Data !=
null)
100 e.CanExecute = result;
103 private static void UndoCommand(
object target, ExecutedRoutedEventArgs e)
106 if (ctl !=
null && ctl.Provider !=
null)
110 private static void CanExecuteNew(
object target, CanExecuteRoutedEventArgs e)
114 if (ctl !=
null && ctl.Provider !=
null)
116 if (ctl.Provider.Data !=
null)
118 IBindingList list = ctl.Provider.Data as IBindingList;
121 result = list.AllowNew;
127 e.CanExecute = result;
130 private static void NewCommand(
object target, ExecutedRoutedEventArgs e)
133 if (ctl !=
null && ctl.Provider !=
null)
137 private static void CanExecuteRemove(
object target, CanExecuteRoutedEventArgs e)
141 if (ctl !=
null && ctl.Provider !=
null)
143 if (ctl.Provider.Data !=
null)
148 list = bb.
Parent as IBindingList;
150 list = ctl.Provider.Data as IBindingList;
153 result = list.AllowRemove;
159 e.CanExecute = result;
162 private static void RemoveCommand(
object target, ExecutedRoutedEventArgs e)
165 if (ctl !=
null && ctl.Provider !=
null)
This is the non-generic base class from which most business objects will be derived.
Core.IParent Parent
Provide access to the parent reference for use in child object code.
Tracks the business rules for a business object.
static bool HasPermission(ApplicationContext applicationContext, AuthorizationActions action, Type objectType)
Checks per-type authorization rules.
ApplicationContextManager for WPF applications
static ApplicationContext GetApplicationContext()
Gets the current ApplicationContext.
Implements support for RoutedCommands that can be executed by the CslaDataProvider control.
Wraps and creates a CSLA .NET-style object that you can use as a binding source.
object AddNew()
Adds a new item to the object if the object implements IBindingList and AllowNew is true.
void Cancel()
Cancels changes to the business object, returning it to its previous state.
void RemoveItem(object sender, ExecuteEventArgs e)
Removes an item from the list if the object implements IBindingList and AllowRemove is true.
void Save()
Accepts changes to the business object, and commits them by calling the object's Save() method.
Arguments passed to a method invoked by the Execute trigger action.
Defines the common methods required by all editable CSLA single objects.
Defines the common methods required by all editable CSLA collection objects.
bool IsSavable
Returns true if this object is both dirty and valid.
bool IsDirty
Returns true if this object's data, or any of its fields or child objects data, has been changed.