Beispiel #1
0
        private void NewGame_Clicked(object sender, EventArgs e)
        {
            WriteToDb _saveGame = new WriteToDb();

            MessagingCenter.Send <BornToRace.App, string>((BornToRace.App)Xamarin.Forms.Application.Current, Events.PlayerNameChanged, Player.LastName);
            MessagingCenter.Send <BornToRace.App, double>((BornToRace.App)Xamarin.Forms.Application.Current, Events.PlayerMoneyChanged, Player.Money);
            MessagingCenter.Send <BornToRace.App, int>((BornToRace.App)Xamarin.Forms.Application.Current, Events.PlayerEnergyChanged, Player.Energy);
        }
Beispiel #2
0
        public static Task LoadDirToDb(WriteToDb writeToDb, IEnumerable <string> filesToLoad, IProgress <int> progress1, IProgress <int> progress2)
        {
            int i    = 0;
            int maxi = filesToLoad.Count();

            Task task = Task.Run(() =>
            {
                foreach (string file in filesToLoad)
                {
                    ++i;
                    //if (progress1 != null)
                    {
                        int locProgress = Convert.ToInt32(i * 100 / maxi);
                        progress1.Report(locProgress);
                    }
                    writeToDb(file, progress2);
                }
            });

            return(task);
        }