CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
Csla.Xaml.CancellableViewModel< T > Class Template Reference

ViewModel without multithreading (concurrency) bugs. More...

Inheritance diagram for Csla.Xaml.CancellableViewModel< T >:
Csla.Xaml.ViewModel< T > Csla.Xaml.ViewModelBase< T > Csla.Xaml.IViewModel

Public Member Functions

virtual void CancelRefresh ()
 Cancel refresh operation. More...
 
- Public Member Functions inherited from Csla.Xaml.ViewModel< T >
virtual void Save (object sender, ExecuteEventArgs e)
 Saves the Model, first committing changes if ManagedObjectLifetime is true. More...
 
virtual async void SaveAsync (object sender, ExecuteEventArgs e)
 Saves the Model, first committing changes if ManagedObjectLifetime is true. More...
 
virtual void Cancel (object sender, ExecuteEventArgs e)
 Cancels changes made to the model if ManagedObjectLifetime is true. More...
 
virtual void AddNew (object sender, ExecuteEventArgs e)
 Adds a new item to the Model (if it is a collection). More...
 
virtual void Remove (object sender, ExecuteEventArgs e)
 Removes an item from the Model (if it is a collection). More...
 
virtual void Delete (object sender, ExecuteEventArgs e)
 Marks the Model for deletion (if it is an editable root object). More...
 
- Public Member Functions inherited from Csla.Xaml.ViewModelBase< T >
async Task< ViewModelBase< T > > InitAsync ()
 Method used to perform async initialization of the viewmodel. More...
 

Protected Member Functions

 CancellableViewModel ()
 
new void BeginRefresh (Action< EventHandler< DataPortalResult< T > > > factoryMethod)
 Creates or retrieves a new instance of the Model by invoking a static factory method. More...
 
override void BeginRefresh (string factoryMethod, params object[] factoryParameters)
 Creates or retrieves a new instance of the Model by invoking a static factory method. More...
 
- Protected Member Functions inherited from Csla.Xaml.ViewModelBase< T >
 ViewModelBase ()
 Create new instance of base class used to create ViewModel objects that implement their own commands/verbs/actions. More...
 
virtual async Task< T > DoInitAsync ()
 Override this method to implement async initialization of the model object. More...
 
virtual void OnError (Exception error)
 Raises ErrorOccurred event when an error occurs during processing. More...
 
virtual void DoRefresh (Func< T > factoryMethod)
 Creates or retrieves a new instance of the Model by invoking a static factory method. More...
 
virtual void DoRefresh (string factoryMethod, params object[] factoryParameters)
 Creates or retrieves a new instance of the Model by invoking a static factory method. More...
 
virtual void DoRefresh (string factoryMethod)
 Creates or retrieves a new instance of the Model by invoking a static factory method. More...
 
virtual void BeginRefresh (string factoryMethod)
 Creates or retrieves a new instance of the Model by invoking a static factory method. More...
 
virtual void OnRefreshing (T model)
 Method called after a refresh operation has completed and before the model is updated. More...
 
virtual void OnRefreshed ()
 Method called after a refresh operation has completed. More...
 
virtual T DoSave ()
 Saves the Model, first committing changes if ManagedObjectLifetime is true. More...
 
virtual void BeginSave ()
 Saves the Model, first committing changes if ManagedObjectLifetime is true. More...
 
virtual void OnSaving (T model)
 Method called after a save operation has completed and before Model is updated (when successful). More...
 
virtual void OnSaved ()
 Method called after a save operation has completed (whether successful or not). More...
 
virtual async Task< T > RefreshAsync< F > (Func< Task< T > > factory)
 Creates or retrieves a new instance of the Model by invoking an action. More...
 
virtual async Task< T > SaveAsync ()
 Saves the Model, first committing changes if ManagedObjectLifetime is true. More...
 
virtual void DoCancel ()
 Cancels changes made to the model if ManagedObjectLifetime is true. More...
 
virtual object DoAddNew ()
 Adds a new item to the Model (if it is a collection). More...
 
virtual void DoRemove (object item)
 Removes an item from the Model (if it is a collection). More...
 
virtual void DoDelete ()
 Marks the Model for deletion (if it is an editable root object). More...
 
virtual void OnModelChanged (T oldValue, T newValue)
 Invoked when the Model changes, allowing event handlers to be unhooked from the old object and hooked on the new object. More...
 
void UnhookChangedEvents (T model)
 Unhooks changed event handlers from the model. More...
 
virtual void OnSetProperties ()
 Override this method to hook into to logic of setting properties when model is changed or edited. More...
 
virtual void OnPropertyChanged (string propertyName)
 Raise the PropertyChanged event. More...
 

Properties

bool IsConcurentRefreshesAllowed [getset]
 Allows more than one refresh operations in one time. More...
 
- Properties inherited from Csla.Xaml.ViewModelBase< T >
Exception Error [getprotected set]
 Gets the Error object corresponding to the last asynchronous operation. More...
 
Model [getset]
 Gets or sets the Model object. More...
 
bool ManageObjectLifetime [getset]
 Gets or sets a value indicating whether the ViewManageObjectLifetime should automatically managed the lifetime of the ManageObjectLifetime. More...
 
bool IsBusy [getprotected set]
 Gets a value indicating whether this object is executing an asynchronous process. More...
 
virtual bool IsDirty [getprotected set]
 Gets a value indicating whether the Model has been changed. More...
 
virtual bool IsValid [getprotected set]
 Gets a value indicating whether the Model is currently valid (has no broken rules). More...
 
virtual bool CanSave [getprotected set]
 Gets a value indicating whether the Model can currently be saved. More...
 
virtual bool CanCancel [getprotected set]
 Gets a value indicating whether the Model can currently be canceled. More...
 
virtual bool CanCreate [getprotected set]
 Gets a value indicating whether an instance of the Model can currently be created. More...
 
virtual bool CanDelete [getprotected set]
 Gets a value indicating whether the Model can currently be deleted. More...
 
virtual bool CanFetch [getprotected set]
 Gets a value indicating whether an instance of the Model can currently be retrieved. More...
 
virtual bool CanRemove [getprotected set]
 Gets a value indicating whether the Model can currently be removed. More...
 
virtual bool CanAddNew [getprotected set]
 Gets a value indicating whether the Model can currently be added. More...
 
virtual bool CanCreateObject [getprotected set]
 Gets a value indicating whether the current user is authorized to create a Model. More...
 
virtual bool CanGetObject [getprotected set]
 Gets a value indicating whether the current user is authorized to retrieve a Model. More...
 
virtual bool CanEditObject [getprotected set]
 Gets a value indicating whether the current user is authorized to save (insert or update a Model. More...
 
virtual bool CanDeleteObject [getprotected set]
 Gets a value indicating whether the current user is authorized to delete a Model. More...
 
- Properties inherited from Csla.Xaml.IViewModel
object Model [getset]
 Gets or sets the Model property of the viewmodel object. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Csla.Xaml.ViewModelBase< T >
static readonly DependencyProperty ModelProperty
 Gets or sets the Model object. More...
 
static readonly DependencyProperty ManageObjectLifetimeProperty
 Gets or sets a value indicating whether the ViewModel should automatically managed the lifetime of the Model. More...
 
- Events inherited from Csla.Xaml.ViewModelBase< T >
EventHandler< ErrorEventArgsErrorOccurred
 Event raised when an error occurs during processing. More...
 
PropertyChangedEventHandler PropertyChanged
 Event raised when a property changes. More...
 

Detailed Description

ViewModel without multithreading (concurrency) bugs.

Template Parameters
T

Definition at line 21 of file CancellableViewModel.cs.

Constructor & Destructor Documentation

◆ CancellableViewModel()

Definition at line 28 of file CancellableViewModel.cs.

Member Function Documentation

◆ BeginRefresh() [1/2]

new void Csla.Xaml.CancellableViewModel< T >.BeginRefresh ( Action< EventHandler< DataPortalResult< T > > >  factoryMethod)
protectedvirtual

Creates or retrieves a new instance of the Model by invoking a static factory method.

Parameters
factoryMethodStatic factory method action.

BeginRefresh(BusinessList.BeginGetList)

BeginRefresh(handler => BusinessList.BeginGetList(handler))

BeginRefresh(handler => BusinessList.BeginGetList(id, handler))

Reimplemented from Csla.Xaml.ViewModelBase< T >.

Definition at line 48 of file CancellableViewModel.cs.

◆ BeginRefresh() [2/2]

override void Csla.Xaml.CancellableViewModel< T >.BeginRefresh ( string  factoryMethod,
params object[]  factoryParameters 
)
protectedvirtual

Creates or retrieves a new instance of the Model by invoking a static factory method.

Parameters
factoryMethodName of the static factory method.
factoryParametersFactory method parameters.

Reimplemented from Csla.Xaml.ViewModelBase< T >.

Definition at line 60 of file CancellableViewModel.cs.

◆ CancelRefresh()

virtual void Csla.Xaml.CancellableViewModel< T >.CancelRefresh ( )
virtual

Cancel refresh operation.

Definition at line 69 of file CancellableViewModel.cs.

Property Documentation

◆ IsConcurentRefreshesAllowed

bool Csla.Xaml.CancellableViewModel< T >.IsConcurentRefreshesAllowed
getset

Allows more than one refresh operations in one time.

Anyway, only the last refresh request will set the Model.

Definition at line 37 of file CancellableViewModel.cs.