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; }
static ViewModelLocator() { Utility.WriteDebugEntryMessage(MethodBase.GetCurrentMethod()); XamarinWrapper = new XamarinWrapper(); FileHelper = new FileHelper(XamarinWrapper); ResultsService = new ResultsService(XamarinWrapper, FileHelper); }
public ResultsService(IXamarinWrapper xamarinWrapper, IFileHelper fileHelper) { Utility.WriteDebugEntryMessage(System.Reflection.MethodBase.GetCurrentMethod()); _synchronisationContext = xamarinWrapper.MainSynchronizationContext; _fileHelper = fileHelper; _results = new Results(); }
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); }
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(); }
public FileHelper(IXamarinWrapper xamarinWrapper) { Utility.WriteDebugEntryMessage(System.Reflection.MethodBase.GetCurrentMethod()); _resultsFileFullName = Path.Combine(xamarinWrapper.AppDataDirectory, "Simonish.txt"); }
public AboutViewModel(IXamarinWrapper xamarinWrapper) { Utility.WriteDebugEntryMessage(System.Reflection.MethodBase.GetCurrentMethod()); _xamarinWrapper = xamarinWrapper; }