Exemple #1
0
        private async void AddCreatures(object sender, EventArgs e)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            if (creature.Initiative == 0)
            {
                await SetInitative();
            }

            for (int i = 0; i < amountOfCreatures; i++)
            {
                var copy = CreatureViewModel.Copy(creature);
                copy.Number = i + 1;
                encounter.Creatures.Add(copy);
            }

            encounter.Creatures.Sort(CreatureViewModel.CompareInitiative);

            await PopupNavigation.Instance.PopAsync();

            IsBusy = false;
        }
        private void CopyCreature(object sender, EventArgs e)
        {
            var creature = ((ImageButton)sender).BindingContext as CreatureViewModel;

            Analytics.TrackEvent("Copy creature", new Dictionary <string, string>
            {
                { "creatureName", creature.Name }
            });
            var copy = CreatureViewModel.Copy(creature);

            encounter.Creatures.Add(copy);
        }