Skip to end of metadata
Go to start of metadata

In the previous sections, you’ve learnt the fundamental of Crosslight architecture. In this section, you will learn the best practices to partition a Crosslight solution in both Windows and Mac development environment. Layering a Crosslight solution properly is often the key to building highly scalable and maintainable cross-platform mobile apps.

A Crosslight solution is typically a Visual Studio 2012 solution which is fully compatible with Xamarin Studio in both Windows and Mac. This allows a team of developers to work with a single Crosslight solution in their own operating system and development environment preferences – whether using Xamarin Studio on a Mac, or using Visual Studio 2012 on Windows. However, for the sake of simplicity, most of the guidance in this documentation will use Visual Studio 2012 on Windows.

On this page:

Xamarin iOS and Xamarin Android are required to support the iOS and Android mobile apps development in Visual Studio. For more information, see Supported Development Environment.

Core (PCL) Project

The Crosslight Core project typically contains shareable application code such as shown in the illustration below

  • Binding Providers
    Classes that represent reusable binding definition that can be imported to the view context.
  • Models
    Classes that represent the domain models used in the application.
  • View Models
    Contains the ViewModel classes that encapsulates user interaction logic and application data flow which will be used as the binding source in MVVM-enabled application.
  • Model Services
    Classes that represent the services specifically for domain model management such as repositories, data access layer and business logic layer.
  • Converters
    Classes that represent the IValueConverter Interface implementation that can be consumed in the data binding process.
  • Infrastructure
    Typically contains AppService.cs that represents the application service and Container.cs that serves as the IoC container for the application-scope usage.

Project Settings and References

The Core project should be of Portable Class Library type that targets Profile158 at the most minimum. The profile subset typically targets .NET Framework 4.5, Silverlight 5, Windows Phone 8, .NET for Windows Store App, Xamarin.iOS and Xamarin.Android. In addition, the project should have a reference to the Intersoft.Crosslight assembly.

Crosslight iOS Project

Crosslight for iOS project typically contains the following components:

  • Infrastructure
    Contains at least an AppInitializer.cs file which implement custom application logic that will be executed when the iOS app starts.
  • Resources
    Contains application resources such as images, sounds and other files required in the iOS app.
  • ViewControllers
    Contains the view controllers that are responsible to display a view in iOS apps. The view controllers are typically classes that derive from Crosslight controllers which are associated to a view model type.
  • Views
    Contains the iOS interface definitions – typically files with xib extension.
  • AppDelegate.cs
    The class that represents the iOS application delegate which is responsible to launch the user interface of the app, listening or responding to events in iOS app. Crosslight iOS app must have the application delegate class derived from Intersoft.Crosslight.iOS.UIApplicationDelegate.
  • Main.cs
    The main entry point of the iOS app.
  • Info.plist
    Contains the information and properties related to the iOS app

Crosslight.iOS Project References

The Crosslight iOS project should have the following references:

                  Project reference to the Core project

                  Intersoft.Crosslight assembly

                  Intersoft.Crosslight.iOS assembly

                  Monotouch assembly

Crosslight Android Project

Crosslight for Android project typically contains the following components:

  • Infrastructure
    Contains at least an AppInitializer.cs file which implement custom application logic that will be executed when the Android app starts.
  • Activities
    Contains the activities and fragment classes that are responsible to display a view in Android apps. The activities and fragment classes are typically classes that derive from Crosslight activities which are associated to a view model type.
  • Assets
    Contains application-specific assets that are not categorized as common resources such as text files and fonts. Asset files will be deployed along with the Android package and will be accessible at runtime.
  • Resources
    Contains application resources such as images, sounds, layout definitions, and other files required in the Android app. 
  • LaunchActivity.cs
    Represents the activity used to launch the Android app which commonly shows a splash screen while the application is initializing. Crosslight Android app must have the launch activity class derived from Intersoft.Crosslight.Android.StartActivity

Crosslight.Android Project References

The Crosslight Android project should have the following references:

                  Project reference to the Core project

                  Intersoft.Crosslight assembly

                  Intersoft.Crosslight.Android assembly

                  Mono.Android assembly

                  Mono.Android.Support.v4 assembly

Crosslight Windows Phone Project

Crosslight for WinPhone project typically contains the following components:

  • Infrastructure
    Contains at least an AppInitializer.cs file which implement custom application logic that will be executed when the WinPhone app starts.
  • Assets
    Contains application-specific assets such as images, sounds and other files.
  • Resources
    Contains the resource files that represent localized strings.
  • Views
    Contains XAML files that represent the view to be presented in the application.
  • App.xaml
    Represents the WinPhone app – typically contains application resources. 
  • MainPage.xaml
    Represents the main view to be presented when the WinPhone app starts.

Crosslight.WinPhone Project References

The Crosslight Windows Phone project should have the following references:

                  Project reference to the Core project

                  Intersoft.Crosslight assembly

                  Intersoft.Crosslight.WinPhone assembly

Crosslight WinRT Project

Crosslight for WinRT project typically contains the following components:

  • Infrastructure
    Contains at least an AppInitializer.cs file which implement custom application logic that will be executed when the WinRT app starts.
  • Assets
    Contains application-specific assets such as images, sounds and other files.
  • Resources
    Contains the resource files that represent localized strings.
  • Views
    Contains XAML files that represent the view to be presented in the application.
  • Common
    Contains classes that are commonly used in WinRT apps.
  • App.xaml
    Represents the WinRT app – typically contains application resources.
  • Package.appxmanifest
    Contains information and settings related to the WinRT application deployment.

Crosslight.WinRT Project References

The Crosslight for Windows RT project should have the following references:

                  Project reference to the Core project

                  Intersoft.Crosslight assembly

                  Intersoft.Crosslight.WinRT assembly