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.Shared/ViewModel.cs
Go to the documentation of this file.
1#if !XAMARIN && !NETFX_CORE
2//-----------------------------------------------------------------------
3// <copyright file="ViewModel.cs" company="Marimer LLC">
4// Copyright (c) Marimer LLC. All rights reserved.
5// Website: https://cslanet.com
6// </copyright>
7// <summary>Base class used to create ViewModel objects,</summary>
8//-----------------------------------------------------------------------
9using System;
10using System.ComponentModel;
11using System.Collections.Generic;
12using System.Linq;
13using System.Text;
14using System.Windows;
15
16#if ANDROID
17namespace Csla.Axml
18#elif IOS
19namespace Csla.Iosui
20#else
21namespace Csla.Xaml
22#endif
23{
30 public abstract class ViewModel<T> : ViewModelBase<T>
31 {
36 [Obsolete("Use SaveAsync", true)]
37 public virtual void Save(object sender, ExecuteEventArgs e)
38 {
39 SaveAsync().RunSynchronously();
40 }
41
46 public virtual async void SaveAsync(object sender, ExecuteEventArgs e)
47 {
48 await SaveAsync();
49 }
50
55 public virtual void Cancel(object sender, ExecuteEventArgs e)
56 {
57 DoCancel();
58 }
59
64 public virtual void AddNew(object sender, ExecuteEventArgs e)
65 {
66#if ANDROID || IOS
67 BeginAddNew();
68#else
69 DoAddNew();
70#endif
71 }
72
77 public virtual void Remove(object sender, ExecuteEventArgs e)
78 {
79 DoRemove(e.MethodParameter);
80 }
81
86 public virtual void Delete(object sender, ExecuteEventArgs e)
87 {
88 DoDelete();
89 }
90 }
91}
92#endif
Arguments passed to a method invoked by the Execute trigger action.
Base class used to create ViewModel objects that implement their own commands/verbs/actions.
Base class used to create ViewModel objects, with pre-existing verbs for use by InvokeMethod or Invok...
virtual void Remove(object sender, ExecuteEventArgs e)
Removes an item from the Model (if it is a collection).
virtual void Save(object sender, ExecuteEventArgs e)
Saves the Model, first committing changes if ManagedObjectLifetime is true.
virtual void Delete(object sender, ExecuteEventArgs e)
Marks the Model for deletion (if it is an editable root object).
virtual async void SaveAsync(object sender, ExecuteEventArgs e)
Saves the Model, first committing changes if ManagedObjectLifetime is true.
virtual void AddNew(object sender, ExecuteEventArgs e)
Adds a new item to the Model (if it is a collection).
virtual void Cancel(object sender, ExecuteEventArgs e)
Cancels changes made to the model if ManagedObjectLifetime is true.