예제 #1
0
        private static async Task CloseApp()
        {
            var userConfirmed = await ConfirmCancelDialog.Show("Quit", "Do you want to exit the application?");

            if (userConfirmed)
            {
                ApplicationV2.Quit();
            }
        }
예제 #2
0
        private async Task ShowCancelConfirmDialog()
        {
            var showDialogTask = ConfirmCancelDialog.Show("I am a dialog", "Please click the confirm button to continue");

            await SimulateConfirmButtonClick();

            bool dialogWasConfirmed = await showDialogTask;                     // Wait until the dialog is closed

            AssertV2.IsTrue(dialogWasConfirmed, "User did not confirm dialog"); // Check if user clicked confirm
        }
예제 #3
0
            public Task OnLoad(IDataStore <MyDataModel> store)
            {
                var map = targetView.GetLinkMap();

                var string1 = map.Get <InputField>("string1");

                string1.SubscribeToStateChanges(store, state => state.subSection1.string1, newVal => string1.text = newVal);
                string1.SetOnValueChangedActionThrottled((newVal) => {
                    store.Dispatch(new ActionSetString1()
                    {
                        newS = newVal
                    });
                });

                var bool1 = map.Get <Toggle>("bool1");

                bool1.SubscribeToStateChanges(store, state => state.subSection1.bool1, newVal => bool1.isOn = newVal);
                bool1.SetOnValueChangedAction((newVal) => {
                    store.Dispatch(new ActionSetBool1()
                    {
                        newB = newVal
                    });
                    return(true);
                });

                map.Get <Button>("ToggleBool1").SetOnClickAction(delegate {
                    store.Dispatch(new ActionSetBool1()
                    {
                        newB = !store.GetState().subSection1.bool1
                    });
                });
                map.Get <Button>("SetString1").SetOnClickAction(delegate {
                    store.Dispatch(new ActionSetString1()
                    {
                        newS = "abc"
                    });
                });
                map.Get <Button>("ShowDialog").SetOnClickAction(async(b) => {
                    bool dialogWasConfirmed = await ConfirmCancelDialog.Show("I am a dialog",
                                                                             "Current model.string1=" + store.GetState().subSection1.string1);
                    Log.d("Dialog was confirmed: " + dialogWasConfirmed);
                });
                return(Task.CompletedTask);
            }