Example #1
0
        private async Task <MyDataModel2> OpenAlertDialogDelAll()
        {
            // create the TextInputView
            var inputView = new AlertConfirmation("PERHATIAN", "Akan Menghapus semua barang dalam keranjang ? \nBarang akan dikembalikan ke Inventory", "Yes", "Cancel");

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <MyDataModel2>(inputView);

            // subscribe to the TextInputView's Button click event
            inputView.SaveButtonEventHandler +=
                (sender, obj) =>
            {
                // handle validations
                if (((AlertConfirmation)sender).InputResult.strQty == "2")
                {
                    ((AlertConfirmation)sender).ValidationLabelText      = "QTY tidak boleh 0";
                    ((AlertConfirmation)sender).IsValidationLabelVisible = true;
                    return;
                }

                // if all good then set the Result
                ((AlertConfirmation)sender).IsValidationLabelVisible = false;
                //popup.PageClosedTaskCompletionSource.SetResult(((MultipleDataInputView)sender).MultipleDataResult);
                popup.PageClosedTaskCompletionSource.SetResult(((AlertConfirmation)sender).InputResult);
            };

            // subscribe to the TextInputView's Button click event
            inputView.CancelButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(null);
            };

            // Push the page to Navigation Stack
            //await PopupNavigation.PushAsync(popup);
            await Navigation.PushAsync(popup);

            // await for the user to enter the text input
            var result = await popup.PageClosedTask;

            // Pop the page from Navigation Stack
            //await PopupNavigation.PopAsync();
            await Navigation.PopAsync();

            // return user inserted text value
            return(result);
        }
Example #2
0
        internal void AlertConfirmation(AlertConfirmation confirmation, MessageAsyncResult result) {
            Trace.TraceInformation("Controller#{0}::AlertConfirmation, Info = {0}", confirmation.Info);

            if (result != null) {
                if (confirmation.Succeeded) {
                    result.InvokeCallback();
                } else {
                    result.InvokeCallback(new CapiException(confirmation.Info));
                }
            }
        }