CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
ViewControllerBase.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 Csla.Iosui.Binding;
12#if __UNIFIED__
13using UIKit;
14#else
15using MonoTouch.UIKit;
16#endif
17
18namespace Csla.Iosui
19{
25 public abstract class ViewControllerBase<T, Z> : UIViewController where T : ViewModel<Z>
26 {
27 private ApplicationContext ApplicationContext { get; set; }
28
33 protected ViewControllerBase(ApplicationContext applicationContext)
34 {
35 ApplicationContext = applicationContext;
36 }
37
41 protected T viewModel = null;
42
46 protected BindingManager Bindings = null;
47
52 protected byte[] SerilizeModelForParameter()
53 {
54 return this.SerilizeModelForParameter(this.viewModel.Model);
55 }
56
62 protected byte[] SerilizeModelForParameter(object model)
63 {
64 return SerializationFormatterFactory.GetFormatter(ApplicationContext).Serialize(model);
65 }
66
72 protected object DeserializeFromParameter(byte[] parameter)
73 {
74 return SerializationFormatterFactory.GetFormatter(ApplicationContext).Deserialize(parameter);
75 }
76 }
77}
Provides consistent context information between the client and server DataPortal objects.
Provides the ability to bing properties on iOS UI controls to properties on CSLA objects.
CSLA helper to be used in place of the normal Xamarin Android activity that contains a reference to a...
byte[] SerilizeModelForParameter()
Serializes the ViewModel's model property using the SerializationFormatterFactory....
object DeserializeFromParameter(byte[] parameter)
Takes a byte array and uses the MobileFormatter to reconstitute it into a model reference.
ViewControllerBase(ApplicationContext applicationContext)
Creates an instance of the type.
byte[] SerilizeModelForParameter(object model)
Serialized the provided model using the SerializationFormatterFactory.GetFormatter().
BindingManager Bindings
The BindingManager for this Activity.
T viewModel
A reference to the view model.