Example #1
0
        public async void OnUnfocusedVillageCodeEntryAsync(object sender, EventArgs evt)
        {
            VillageProfile villageProfile = await App.SQLiteDatabaseServices.GetVillageAsync(VillageCodeEntry.Text);

            if (villageProfile != null)
            {
                VillageProfileLabel.Text = $"Village: {villageProfile.VillageName} ,{villageProfile.DistrictName}";
            }
            else
            {
                VillageProfileLabel.Text = "Invalid Village code";
            }

            VillageProfileFrame.IsVisible = true;
        }
        /// <summary>
        ///     Handles create profile button click events.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event args.</param>
        private void createProfileBtn_Click(object sender, EventArgs e)
        {
            var name = profileNameTxtBox.Text;

            if (Profiles.Exists(i => i.Name.Equals(name)))
            {
                MessageBox.Show(
                    "A profile with this name exists.",
                    "Error. Can't create.",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            var vp = new VillageProfile(name);
            Profiles.Add(vp);
        }
Example #3
0
        /// <summary>
        ///     Handles create profile button click events.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event args.</param>
        private void createProfileBtn_Click(object sender, EventArgs e)
        {
            var name = profileNameTxtBox.Text;

            if (Profiles.Exists(i => i.Name.Equals(name)))
            {
                MessageBox.Show(
                    "A profile with this name exists.",
                    "Error. Can't create.",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            var vp = new VillageProfile(name);

            Profiles.Add(vp);
        }