コード例 #1
0
        public GameViewModel(IXamarinWrapper xamarinWrapper, GameService gameService)
        {
            Utility.WriteDebugEntryMessage(System.Reflection.MethodBase.GetCurrentMethod());

            StartCommand = new Command(Start, CanExecuteStart);
            HitCommand   = new Command <int>(Hit, CanExecuteHit);

            // Define the initial state for bound views.
            // No need to set via the properties because this view model has not been bound to the page yet.

            // ToDo: This isn't right, initial state should come from the GameService. Raise launched phase changed event?

            _canStart         = true;
            _canHit           = false;
            _score            = 0;
            _timeLeft         = 1;
            _overlayText      = "Simon\n(ish)";
            _overlayIsVisible = true;

            ButtonColours = new[] { Colours[0, 0], Colours[1, 0], Colours[2, 0], Colours[3, 0] };

            _xamarinWrapper = xamarinWrapper;
            _gameService    = gameService;
            _gameService.PhaseChangeRequired += OnPhaseChangeRequired;
            _gameService.CountdownTimer      += OnCountdownTimer;
            _gameService.PlayTimer           += OnPlayTimer;
        }
コード例 #2
0
        static ViewModelLocator()
        {
            Utility.WriteDebugEntryMessage(MethodBase.GetCurrentMethod());

            XamarinWrapper = new XamarinWrapper();
            FileHelper     = new FileHelper(XamarinWrapper);
            ResultsService = new ResultsService(XamarinWrapper, FileHelper);
        }
コード例 #3
0
ファイル: ResultsService.cs プロジェクト: rmjcsltd/Simonish
        public ResultsService(IXamarinWrapper xamarinWrapper, IFileHelper fileHelper)
        {
            Utility.WriteDebugEntryMessage(System.Reflection.MethodBase.GetCurrentMethod());

            _synchronisationContext = xamarinWrapper.MainSynchronizationContext;
            _fileHelper             = fileHelper;

            _results = new Results();
        }
コード例 #4
0
        public GameService(IXamarinWrapper xamarinWrapper, IFileHelper fileHelper, ITimer timer, ResultsService resultsService)
        {
            Utility.WriteDebugEntryMessage(System.Reflection.MethodBase.GetCurrentMethod());

            _xamarinWrapper         = xamarinWrapper;
            _fileHelper             = fileHelper;
            _resultsService         = resultsService;
            _synchronisationContext = xamarinWrapper.MainSynchronizationContext;

            _game  = new Game();
            _timer = timer;
            _timer.SetAction(OnTimer);
        }
コード例 #5
0
ファイル: ResultsViewModel.cs プロジェクト: rmjcsltd/Simonish
        public ResultsViewModel(IXamarinWrapper xamarinWrapper, ResultsService resultsService)
        {
            Utility.WriteDebugEntryMessage(System.Reflection.MethodBase.GetCurrentMethod());

            _xamarinWrapper = xamarinWrapper;
            resultsService.ResultsChanged += OnResultsChanged;

            // Define the initial state for bound views.
            // No need to set via the properties because this view model has not been bound to the page yet.

            // ToDo: This isn't right, initial state should come from the ResultsService.

            _results = new Results();
        }
コード例 #6
0
        public FileHelper(IXamarinWrapper xamarinWrapper)
        {
            Utility.WriteDebugEntryMessage(System.Reflection.MethodBase.GetCurrentMethod());

            _resultsFileFullName = Path.Combine(xamarinWrapper.AppDataDirectory, "Simonish.txt");
        }
コード例 #7
0
        public AboutViewModel(IXamarinWrapper xamarinWrapper)
        {
            Utility.WriteDebugEntryMessage(System.Reflection.MethodBase.GetCurrentMethod());

            _xamarinWrapper = xamarinWrapper;
        }