コード例 #1
0
        private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            MedicineInventory newItem = new MedicineInventory()
            {
                GenericName   = tbx_gen.Text,
                BrandName     = tbx_brd.Text,
                Dosage        = tbx_dsg.Text,
                StocksLeft    = int.Parse(tbx_amt.Text),
                TimeLastAdded = DateTime.Now
            };

            ContentDialogButtonClickDeferral deferral = args.GetDeferral();

            try
            {
                var result = await AddMedicineViaDataServiceAsync(newItem);

                NewMedicine = result;
                Result      = AddMedicineResult.Success;
            }
            catch (Exception)
            {
                Result = AddMedicineResult.AddFailed;
            }
            deferral.Complete();
        }
コード例 #2
0
 private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
 {
     Result = AddMedicineResult.Cancelled;
 }