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.
ActivityBase.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ActivityBase.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>CSLA helper to be used in place of the normal Xamarin Android activity that contains a reference to a CSLA ViewModel and a BindingManager</summary>
7//-----------------------------------------------------------------------
8
9using Android.App;
10using Android.OS;
11using Csla.Axml.Binding;
14
15namespace Csla.Axml
16{
22 public abstract class ActivityBase<T, Z> : Activity where T : ViewModel<Z>
23 {
27 protected T viewModel = null;
28
32 protected BindingManager Bindings = null;
33
38 protected override void OnCreate(Bundle bundle)
39 {
40 base.OnCreate(bundle);
41 Bindings = new BindingManager(this);
42 }
43
48 protected byte[] SerilizeModelForParameter()
49 {
50 return this.SerilizeModelForParameter(this.viewModel.Model);
51 }
52
58 protected byte[] SerilizeModelForParameter(object model)
59 {
60 return SerializationFormatterFactory.GetFormatter().Serialize(model);
61 }
62
68 protected object DeserializeFromParameter(byte[] parameter)
69 {
70 return SerializationFormatterFactory.GetFormatter().Deserialize(parameter);
71 }
72 }
73}
CSLA helper to be used in place of the normal Xamarin Android activity that contains a reference to a...
Definition: ActivityBase.cs:23
byte[] SerilizeModelForParameter()
Serializes the ViewModel's model property using the SerializationFormatterFactory....
Definition: ActivityBase.cs:48
object DeserializeFromParameter(byte[] parameter)
Takes a byte array and uses the MobileFormatter to reconstitute it into a model reference.
Definition: ActivityBase.cs:68
BindingManager Bindings
The BindingManager for this Activity.
Definition: ActivityBase.cs:32
T viewModel
A reference to the view model.
Definition: ActivityBase.cs:27
byte[] SerilizeModelForParameter(object model)
Serialized the provided model using the SerializationFormatterFactory.GetFormatter().
Definition: ActivityBase.cs:58
override void OnCreate(Bundle bundle)
Event that occurs when the activity is created.
Definition: ActivityBase.cs:38
Provides the ability to bing properties on Axml controls to properties on CSLA objects.