private void Initialize() { this.AspyTag1 = 600110; this.AspyName = "VC_SolveContainer"; // Sizing Class this._sizeSolve = new SizeSolve(this); this._sizeClass = this._sizeSolve; this._vcMainContainer = this._sizeClass.VcMainContainer; this._containerType = G__ContainerType.SolveButton; // UI // Always fire UIApply in ViewWillAppear this._applyUIWhere = G__ApplyUI.ViewWillAppear; }
// This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Falling rock style! #region Setup // Setup services and globals for iOS // Create iOSCore globals this._iOSGlobals = new AspyRoad.iOSCore.AspyGlobals(); // Create our appwide user setup settings //this._numeracyUIManager = new NumeracyUIManager(this.iOSGlobals); // Create shared globals this._sharedGlobals = new NathansWay.Numeracy.Shared.SharedGlobal(); // Create our application settings. These are settings that are global to Numbers Application only. this._numberAppSettings = new NathansWay.Numeracy.Shared.NWNumberAppSettings(); // Load our storyboard and setup our UIWindow and first view controller _storyBoard = UIStoryboard.FromName("NathansWay.Numeracy", null); iOSCoreServiceContainer.Register <UIStoryboard> (_storyBoard); // Number factory relies on Storyboard so load it first this._NumletFactory = new Lazy <UINumberFactory>(() => new UINumberFactory()); // Set SharedGlobals for the Shared lib // This must be done for each device being built this._sharedGlobals.GS__RootAppPath = Environment.CurrentDirectory; // Db Name this._sharedGlobals.GS__DatabaseName = "Nathansway.db3"; // Documents folder this._sharedGlobals.GS__DocumentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Library folder this._sharedGlobals.GS__FolderNameLibrary = Path.Combine(this._sharedGlobals.GS__DocumentsPath, "../Library/"); // Full db path this._sharedGlobals.GS__FullDbPath = Path.Combine(this._sharedGlobals.GS__DocumentsPath, this._sharedGlobals.GS__DatabaseName); // Copy the database if needed // For building we ALWAYS copy the db as we need to capture build changes. //this.CopyDb(); this.ExplcitCopyDb(); // Apply user based app settings // Depending on student, teahcer etc some of these will change at log in, but we will set defaults here. // TODO : These will need to be loaded from a database as they will be different for each student // But not all need to be saved? this._numberAppSettings.GA__NumberEditMode = G__NumberEditMode.EditNumPad; //this._numberAppSettings.GA__NumberEditMode = G__NumberEditMode.EditScroll; //this._numberAppSettings.GA__NumberEditMode = G__NumberEditMode.EditUpDown; this._numberAppSettings.GA__NumberDisplaySize = G__DisplaySizeLevels.Level5; this._numberAppSettings.GA__NumberLabelDisplaySize = G__DisplaySizeLevels.Level3; this._numberAppSettings.GA__MoveToNextNumber = true; this._numberAppSettings.GA__ShowAnswerNumlet = true; this._numberAppSettings.GA__SingleDigitErrorUIDisplay = false; this._numberAppSettings.GA__PersistUICorrectStateOnMove = true; this._numberAppSettings.GA__PersistUIInCorrectStateOnMove = true; this._numberAppSettings.GA__ToStringReturnsCurrentValue = false; this._numberAppSettings.GA__FreeFromModeActive = false; this._numberAppSettings.GA__DecimalPrecission = 2; // Set AspyiOSCore global variables here.... this._iOSGlobals.G__ViewAutoResize = UIViewAutoresizing.None; this._iOSGlobals.G__InitializeAllViewOrientation = true; this._iOSGlobals.G__ViewOrientation = G__Orientation.Landscape; this._iOSGlobals.G__ShouldAutorotate = false; this._iOSGlobals.G__SegueingAnimationDuration = 0.8; this._iOSGlobals.G__PrefersStatusBarHidden = true; // Orientation handlers two types depending on iOS version // iOS 6 and above >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> this._iOSGlobals.G__6_SupportedOrientationMasks = UIInterfaceOrientationMask.Landscape; // You can use bitwise operators on these // NOTE : I couldnt get the bitwise versions to compare, not sure why, so I assume that Lanscapeleft and right are the same // Doesnt really matter as its only for iOS5. // in the autorotate function for iOS5 // Eg = UIInterfaceOrientation.LandscapeRight | UIInterfaceOrientation.LandscapeLeft // iOS 5 and below >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> this._iOSGlobals.G__5_SupportedOrientation = UIInterfaceOrientation.LandscapeLeft; // Register any Shared services needed SharedServiceContainer.Register <ISharedGlobal>(this._sharedGlobals); // Set Sqlite db Platform this._iOSSQLitePLatform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); // Set up a database context this._DbContext = new NumeracyDB(this._iOSSQLitePLatform, this._sharedGlobals.GS__FullDbPath); // Platform lib needed by the constructor for SQLite Shared SharedServiceContainer.Register <ISQLitePlatform>(this._iOSSQLitePLatform); // Register the database connection SharedServiceContainer.Register <INWDatabaseContext>(this._DbContext); // Register any iOS services needed iOSCoreServiceContainer.Register <IAspyGlobals> (this._iOSGlobals); // Register our Numberappwide setings SharedServiceContainer.Register <IAppSettings> (this._numberAppSettings); // Application Services, Factories // Dimensions Class this._numberDimensions = new iOSNumberDimensions(G__DisplaySizeLevels.Level5, this._iOSGlobals); iOSCoreServiceContainer.Register <iOSNumberDimensions> (this._numberDimensions); // Build a ToolBoxFactory this._toolBuilder = new Lazy <ToolFactory> (() => new ToolFactory()); iOSCoreServiceContainer.Register <ToolFactory> (this._toolBuilder.Value); // Build a NumletFactory // Numlets are the most basic workspace, the contain any expression // A workspace is made up of one to [n] numlets iOSCoreServiceContainer.Register <UINumberFactory> (this._NumletFactory.Value); #endregion #region Setup UI // TODO : Remove and insert this into .ctor code for lesson UI startup // // Start a toolfactory // ITool hammer; // hammer = ToolBuilder.CreateNewTool(E__ToolBoxToolz.Hammerz); // // AspyViewController _vcHammer = hammer.MainGame.Services.GetService<AspyViewController>(); // // // Temp workspace setup code. Mormally this will be behind a menu button. // vcWorkSpace _workspace = new vcWorkSpace(); // //vcMainGame _maingame = new vcMainGame(); // vcMainWorkSpace _mainworkspace = new vcMainWorkSpace(); // // ViewContainerController = new AspyViewController(); // ViewContainerController.AddAndDisplayController(_vcHammer); // ViewContainerController.AddAndDisplayController(_mainworkspace); // //ViewContainerController.View.AddSubview(_mainworkspace.ChildViewControllers[0].View); // // window.RootViewController = ViewContainerController; // //window.RootViewController = _mainworkspace; //Setup UIManager this.SetUpUI(); // Setup the window _window = new AspyWindow(UIScreen.MainScreen.Bounds); // _window = new iOSGameWindow(UIScreen.MainScreen.Bounds); // Register our window iOSCoreServiceContainer.Register <AspyWindow> (_window); // Setup view controllers //_mainNavigator = storyboard.InstantiateInitialViewController() as UINavigationController; //_mainController = storyboard.InstantiateViewController("vcMainContainer") as vcMainContainer; _mainContainer = new vcMainContainer(); // Use storyboard ids to create VCs //_menuStart = new vcMenuStart(); //_menuStart = storyboard.InstantiateViewController("vcMenuStart") as vcMenuStart; //_menuStart = storyboard.InstantiateViewController("vcLessonMenu") as vcLessonMenu; //Add our navigation object to the service library iOSCoreServiceContainer.Register <vcMainContainer> (_mainContainer); // The drawing factory needs to know of MainController hence its position here...after maincontainers creation this._drawingFunctions = new DrawingFactory(); iOSCoreServiceContainer.Register <DrawingFactory>(_drawingFunctions); //window.MakeKeyAndVisible(); _window.RootViewController = _mainContainer; //window.RootViewController = _menuStart; _window.MakeKeyAndVisible(); //_mainController.AddAndDisplayController(_menuStart); //window.MakeKeyAndVisible(); #endregion return(true); }