示例#1
0
        protected override async void OnAppearing()
        {
            if (person == null)
            {
                IsAddPage                  = true;
                Title                      = "Dodaj osobę";
                lblPageTitle.Text          = "Dodaj osobę";
                this.CirclePhoto.IsVisible = false;
                this.BeltImage.IsVisible   = false;
            }
            else
            {
                IsAddPage         = false;
                this.Name.Text    = person.Name;
                this.Surname.Text = person.Surname;
                this.Pseudo.Text  = person.Pseudo;
                Belt belt = await _connection.GetAsync <Belt>(person.BeltId);

                this.pckrBelt.SelectedIndex    = (int)belt.BeltColour;
                this.pckrStripes.SelectedIndex = (int)belt.Stripes;
                this.BeltImage.Source          = ImageSource.FromResource(GetBeltPicFromBeltId(person.BeltId));

                if (!String.IsNullOrEmpty(person.Photo))
                {
                    this.btnPhotoMaker.Text = "Zrób zdjęcie";
                }

                if (String.IsNullOrEmpty(person.Photo))
                {
                    this.CirclePhoto.IsVisible = false;
                }
                else
                {
                    this.CirclePhoto.IsVisible = true;
                }

                this.CirclePhoto.Source = person.Photo;
                this.AddBtn.Text        = "Zapisz";
                Title             = "Aktualizuj dane";
                lblPageTitle.Text = "Aktualizuj dane";
            }
        }
示例#2
0
        public async Task InitialOperations()
        {
            await _connection.CreateTableAsync <Belt>();

            await _connection.CreateTableAsync <Person>();

            int BeltCount = await _connection.Table <Belt>().CountAsync();

            if (BeltCount == 0)
            {
                for (int i = 0; i <= 4; i++)
                {
                    for (int j = 0; j <= 4; j++)
                    {
                        Belt belt = new Belt((BeltColour)i, (byte)j);
                        await _connection.InsertAsync(belt);
                    }
                }
            }
        }