Exemplo n.º 1
0
 public LessonList(vcWorkSpace _workSpace)
 {
     this._lessonModel        = SharedServiceContainer.Resolve <LessonViewModel>();
     this._lessonResultsModel = SharedServiceContainer.Resolve <LessonResultsViewModel>();
     this._myWorkSpaceParent  = _workSpace;
     this.Initialize();
 }
Exemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // LessonMain TableView
            // Setup tableview source
            this._srcLesson = new LessonMenuTableSource(this);
            this._srcLesson.ScrolledToBottom += ScrolledToBottom;
            this.tvLessonMain.Source          = this._srcLesson;

            // Register Events
            // Level Buttons
            this.btnLevel1.TouchUpInside  += OnClick_btnLevel1;
            this.btnLevel2.TouchUpInside  += OnClick_btnLevel2;
            this.btnLevel3.TouchUpInside  += OnClick_btnLevel3;
            this.btnLevel4.TouchUpInside  += OnClick_btnLevel4;
            this.btnLevel5.TouchUpInside  += OnClick_btnLevel5;
            this.btnLevel6.TouchUpInside  += OnClick_btnLevel6;
            this.btnLevel7.TouchUpInside  += OnClick_btnLevel7;
            this.btnLevel8.TouchUpInside  += OnClick_btnLevel8;
            this.btnLevel9.TouchUpInside  += OnClick_btnLevel9;
            this.btnLevel10.TouchUpInside += OnClick_btnLevel10;
            // Type Buttons
            this.btnTypeBasic.TouchUpInside     += OnClick_btnTypeBasic;
            this.btnTypeFractions.TouchUpInside += OnClick_btnTypeFraction;
            this.btnTypeGroups.TouchUpInside    += OnClick_btnTypeGrouped;
            this.btnTypeMixed.TouchUpInside     += OnClick_btnTypeMixed;
            // Operator Buttons
            this.btnOpAdd.TouchUpInside      += OnClick_btnOpAdd;
            this.btnOpAddSub.TouchUpInside   += OnClick_btnOpAddSub;
            this.btnOpDivision.TouchUpInside += OnClick_btnOpDivision;
            this.btnOpMultiply.TouchUpInside += OnClick_btnOpMultiply;
            this.btnOpMultSub.TouchUpInside  += OnClick_btnOpDivMulti;
            this.btnOpSubtract.TouchUpInside += OnClick_btnOpSubtract;
            // BackToMenu
            this.btnBackToMenu.TouchUpInside += OnClick_btnBackToMenu;



            #region Tutorial
            // 4/8/2016
            // Either of these must be used along with the deque approach in the tableview delegate getcell().
            // But! as I have learnt over the last 2 days, yu need not worry if the cell is a prototype inside a storyboard file.
            // Because the prototyped cell belongs to the tableview inside the storyboard, its already aware of what cell to create in a deque
            // Custom Class method  for auto loading the deque
            //this.tvLessonMain.RegisterClassForCellReuse(typeof(vLessonTableCell), "tvLessonMainCell");
            // Nib file method for autoloading the deque
            //this.tvLessonMain.RegisterNibForCellReuse(UINib.FromName("vlessonTableCell", NSBundle.MainBundle), "tvLessonMainCell");
            #endregion

            // LessonDetail TableView
            // Setup tableview source
            this._srcLessonDetail = new LessonDetailMenuTableSource(this);
            // No need to hook anything up to ScolledBottom.
            this.tvLessonDetail.Source = this._srcLessonDetail;

            // Load Initial lesson list
            _vmLesson = SharedServiceContainer.Resolve <LessonViewModel>();
            this.LoadLessonsInit();
        }
        public NWDbBase(ISQLitePlatform _SQLitePlatform, string _path) : base()
        {
            _sqliteplatform   = _SQLitePlatform;
            _sharedglobal     = SharedServiceContainer.Resolve <ISharedGlobal>();
            _ConnectionString = new SQLiteConnectionString(_sharedglobal.GS__FullDbPath, false);

            Path = _path;
        }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 public UINumberFactory()
 {
     // Factory Classes for expression building
     this._numberFactoryClient  = new NumberFactoryClient();
     this._expressionFactory    = new ExpressionFactory(this._numberFactoryClient);
     this._globalSizeDimensions = iOSCoreServiceContainer.Resolve <iOSNumberDimensions> ();
     this._storyBoard           = iOSCoreServiceContainer.Resolve <UIStoryboard> ();
     this._numberAppSettings    = SharedServiceContainer.Resolve <IAppSettings>();
     //this._intLessonDetailSeq = 1;
 }
Exemplo n.º 6
0
        private ResourceContainer CreateResourceContainer()
        {
            var policy = new ResourceContainer.Policy();
            SharedServiceContainer sharedServices = new SharedServiceContainer();

            var resourceContainer = new ResourceContainer(policy);

            resourceContainer.SharedServices = sharedServices;

            return(resourceContainer);
        }
Exemplo n.º 7
0
        public vcWorkSpace UILoadWorkSpace()
        {
            // Create our workspace object
            var _vcCurrentWorkSpace = this._storyBoard.InstantiateViewController("vcWorkSpace") as vcWorkSpace;
            var _vmLessons          = SharedServiceContainer.Resolve <LessonViewModel>();
            var _vmLessonResults    = SharedServiceContainer.Resolve <LessonResultsViewModel>();

            _vcCurrentWorkSpace.LessonNumletList           = new LessonList <LessonNumletSet>(_vmLessons, _vmLessonResults, _vcCurrentWorkSpace);
            _vcCurrentWorkSpace.LessonNumletList.sortOrder = G__SortOrder.Descending;

            return(_vcCurrentWorkSpace);
        }
Exemplo n.º 8
0
 public LessonDetailMenuTableSource(vcLessonMenu _vc)
 {
     this.vclessonmenu = _vc;
     this.vmLesson     = SharedServiceContainer.Resolve <LessonViewModel> ();
 }
        //
        // 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);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Creates the main expression equation, this is displ.
        /// Divided-by symbol = (opt + /)
        /// Syntax
        /// * Standard Equations
        /// Simple comma seperated values
        /// eg 1,+,1,=,2 || 12.45,x,234.11,=,1200.98
        /// * Fractions
        /// An F placed in front of a fraction tells the factory its a fraction
        /// Fraction eg = "F,1/2" this will display a half
        /// * Methods
        /// These are used to help problem solving in stages, all values are writable
        /// Every new M denots a Method section "Numlet"
        /// Method eg = "M,1,+,1,=,2,M,2,+,2,=,4
        /// Bracing eg = "1,+,(,F,1/2,+,F,1/2,),=,2"
        /// </summary>

        public ExpressionFactory(IUINumberFactoryClient UIPlatform)
        {
            this._numberAppSettings = SharedServiceContainer.Resolve <IAppSettings>();
            this.FactoryClient      = UIPlatform;
            this._intMethodCount    = 0;
        }
 public LessonResultsViewModel()
 {
     lessonResultsService       = SharedServiceContainer.Resolve <IRepoLessonResults <EntityLessonResults> > ();
     lessonDetailResultsService = SharedServiceContainer.Resolve <IRepoLessonDetailResults <EntityLessonDetailResults> > ();
 }
 private void Initialize()
 {
     this.iOSUIAppearance    = iOSCoreServiceContainer.Resolve <iOSUIManager>();
     this._numberAppSettings = SharedServiceContainer.Resolve <IAppSettings>();
 }
Exemplo n.º 13
0
 public LessonViewModel()
 {
     lessonService       = SharedServiceContainer.Resolve <IRepoLesson <EntityLesson> > ();
     lessonDetailService = SharedServiceContainer.Resolve <IRepoLessonDetail <EntityLessonDetail> > ();
 }
Exemplo n.º 14
0
        // 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);
        }