public NWDbBase(ISQLitePlatform _SQLitePlatform, string _path) : base() { _sqliteplatform = _SQLitePlatform; _sharedglobal = SharedServiceContainer.Resolve <ISharedGlobal>(); _ConnectionString = new SQLiteConnectionString(_sharedglobal.GS__FullDbPath, false); Path = _path; }
public NWRepository() { _sharedGlobal = SharedServiceContainer.Resolve <ISharedGlobal> (); _db = SharedServiceContainer.Resolve <INWDatabaseContext> (); // Base orderby clause _predicateOrderBy = (i => i.SEQ); //Expression<Func<U,object>> _predicateOrderBy = (i => i.SEQ); }
// // 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 app, NSDictionary options) { // Setup services and globals for iOS // Create iOSCore globals this.iOSGlobals = new AspyRoad.iOSCore.AspyGlobals(); // Create our appwide user setup settings this._NumeracySettings = new NumeracySettings(); // Create shared globals this.SharedGlobals = new NathansWay.Shared.Global.SharedGlobal(); // Set Sqlite db Platform this._iOSSQLitePLatform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); // Set SharedGlobals for the Shared lib // This must be done for each device being built // 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); // Apply user based app settings // Depending on student, teahcer etc some of these will change on log in this._NumeracySettings.CurrentNumberEditMode = E__NumberComboEditMode.EditScroll; // 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.5; // 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 // Eg = UIInterfaceOrientation.LandscapeRight | UIInterfaceOrientation.LandscapeLeft // iOS 5 and below >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> this.iOSGlobals.G__5_SupportedOrientation = UIInterfaceOrientation.LandscapeRight | UIInterfaceOrientation.LandscapeLeft; // Register any Shared services needed SharedServiceContainer.Register <ISharedGlobal>(this.SharedGlobals); // Platform lib needed by the constructor for SQLite Shared SharedServiceContainer.Register <ISQLitePlatform>(this._iOSSQLitePLatform); // Register any iOS services needed iOSCoreServiceContainer.Register <IAspyGlobals> (this.iOSGlobals); // Register app/user settings iOSCoreServiceContainer.Register <NumeracySettings>(this._NumeracySettings); // Setup the window window = new AspyWindow(UIScreen.MainScreen.Bounds); // Using viewcontroller constructor to run the nib ViewContainerController = new AspyContainerController(); // Add our view variables iOSCoreServiceContainer.Register <AspyContainerController>(this.ViewContainerController); iOSCoreServiceContainer.Register <AspyWindow> (window); //_testDb = new NathansWayDbBase(); // ** Note how to retrieve from services. //this.iOSGlobals = ServiceContainer.Resolve<IAspyGlobals>(); #region Setup Storyboard //initialViewController = (AspyViewController)Storyboard.InstantiateInitialViewController (); //window.RootViewController = initialViewController; #endregion #region Setup Single View //mypad = new vcNumberPad(); float x = 100.0f; float y = 100.0f; for (int i = 0; i < 5; i++) { x = x + 60.0f; //y = y + 60.0f; RectangleF myRect; vcNumberCombo pad = new vcNumberCombo(); pad.AspyTag2 = i; myRect = new RectangleF(x, y, pad.View.Frame.Width, pad.View.Frame.Height); pad.View.Frame = myRect; ViewContainerController.AddAndDisplayController(pad); } //ContainerController.RemoveVCInstance((int)G__VCs.VC_CtrlNumberPad, 2); // Runtime method //var v = NSBundle.MainBundle.LoadNib ("vwNumberCombo", this, null); //viewController = Runtime.GetNSObject(v.ValueAt(0)) as vcNumberCombo; //swipeGesture = new NSAction(printeswipe); window.RootViewController = ViewContainerController; #endregion window.MakeKeyAndVisible(); window.Tag = 0; #region Gesture From Window // Get gesture from Sendevents - Window object //window.WireUpGestureToWindow(AspyUtilities.GestureTypes.UITap, swipeGesture); #endregion #region Gesture From AspyView //viewController.QAWorkSpaceView.WireUpGestureToView(G__GestureTypes.UIPinch, swipeGesture); #endregion //window.SomeonesTouchingMeInMySpecialPlace += c_ThresholdReached; return(true); }
// 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); }