Comments (6)
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Closed similar issues:
- How to handle AppWindow closing event before close window on MacOS? (#20134), similarity score: 0.74
- MAUI DisplayAlert() When User Closes Window : Getting Unhandled Exception (#9355), similarity score: 0.73
- DisplayActionSheet hangs app on cancel on MacCatalyst (#6623), similarity score: 0.71
- [Mac Catalyst] Application.Current.OpenWindow not working (#10603), similarity score: 0.71
- DisplayAlert not working on MacCatalyst and UWP (#11766), similarity score: 0.70
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
from maui.
Can you show a little more code that actually shows the dialog? How do you do that?
My suspicion is that it runs on a background thread or something and you'll need to maybe use this. Have you tried the Dispatcher and did that change the behavior at all?
from maui.
@jfversluis I have tried this solutions with Dispatch and without also. Please review
1. Application.Current.MainPage.Dispatcher.Dispatch(async` () =>
await DisplayAlert("Confirmation", "Hello", "cancel")
);
2. var taskCompletionSource = new TaskCompletionSource<bool>();
var alertController = UIAlertController.Create("Confirmation", "Are you sure you want to close the app?", UIAlertControllerStyle.Alert);
alertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, action => _commonEventhandlerService.InvokeSaveEvent(true)));
alertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, action => _commonEventhandlerService.InvokeSaveEvent(false)));
UIApplication.SharedApplication.InvokeOnMainThread(async () =>
{
await UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewControllerAsync(alertController, true);
taskCompletionSource.SetResult(true);
});
// 6. Wait for the task completion source
var presentationSuccessful = await taskCompletionSource.Task;
// 7. Code to execute after successful/failed presentation (optional)
if (presentationSuccessful)
{
_appOperationService.ShutDownApplication();
}
else
{
// Code to handle failed popup presentation (optional)
}
```
from maui.
Hi @dhruvindudhat. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
from maui.
I think you need to create a small repro project for what you're trying to do. From the looks of it, you're calling into straight UIKit code for showing your dialog, which is fine to do but that's not really a MAUI UI issue or bug.
from maui.
This issue has been automatically marked as stale because it has been marked as requiring author feedback to reproduce the issue but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.
from maui.
Related Issues (20)
- Image is flickering after ImageSource change HOT 1
- TabbedPage doesn't change icon colour HOT 2
- FlexLayout Items (such as buttons, labels and so, etc) Padding not Working HOT 2
- TapGestureRecognizer.Tapped fired multiple times on Android when GestureRecognizers were changed after rendering. HOT 1
- TapGestureRecognizer.Tapped fired multiple times on Android when GestureRecognizers were changed after rendering. HOT 1
- AppIcon not displayed for Android 7 HOT 7
- Play a local video on Android in MAUI app HOT 2
- Color.FromHsla only returns white color HOT 1
- Bad performance while using OData client vs using HttpClient on Android HOT 4
- FontImageSource in Button and ImageButton doesn't display properly HOT 2
- Error when trying to run myfirstapp on pixel device emulation HOT 1
- Error: Activity class {../MainActivity} does not exist. HOT 1
- NavigationBarColors from NavigationPage not changing on AppTheme changing HOT 2
- Maui MediaPicker.Default.CapturePhotoAsync fails under iOS with no error message HOT 1
- Memory leak in RadioButton ControlTemplate HOT 1
- RadioButton with ControlTemplate crashes on Android in the release mode HOT 3
- ToolbarItem Icon Color Not Updating with AppThemeBinding HOT 1
- I wanna create my self predictor aviator HOT 1
- [NET9] JavaCast not currently working on NET9
- When in the Shell, HideSoftInputOnTapped does not work at Navigation.PushAsync(animated: false) in TapGestureRecognizer HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from maui.