Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the confirmation dialog for CommandResult.Confirm #399

Open
zadjii-msft opened this issue Feb 3, 2025 · 5 comments
Open

Implement the confirmation dialog for CommandResult.Confirm #399

zadjii-msft opened this issue Feb 3, 2025 · 5 comments
Labels
Area-HostUX UX elements of the host CmdPal application good first issue Good for newcomers Issue-Task

Comments

@zadjii-msft
Copy link
Owner

as spec'd in #395

we need a dialog to prompt for confirmation of certain destructive commands.

@moooyo
Copy link
Collaborator

moooyo commented Mar 10, 2025

I've investigated some possible implement, and I think we need to discuss some API design for this usage.

Just a example, please consider we need to do a dangerous operator, such as shut down the computer.
So, we need to show a dialog to user and let them decide Yes/No. Then base on the choice, do the right thing.

So, if our design is, return a CommandResult.Confirm, what's the next step? Where should we get the result and continue to process?

I make a simple demo to show my implement. I set up the dialog configuration and the callback function, then pass it to the host. Host will create a new window and show the dialog on this new window (not cmdpal), receive user's selection and use it to call the callback function.

@zadjii-msft any suggestion?

content-dialog.mp4

@zadjii-msft
Copy link
Owner Author

@moooyo is there any reason we can't just open that ContentDialog within the main CmdPal window itself? the way I tried to spec out the IConfirmationArgs of CommandResult.Confirm was basically just things we'd need to put into a content dialog, so I figure that'd work, right?

@moooyo
Copy link
Collaborator

moooyo commented Mar 10, 2025

@moooyo is there any reason we can't just open that ContentDialog within the main CmdPal window itself? the way I tried to spec out the IConfirmationArgs of CommandResult.Confirm was basically just things we'd need to put into a content dialog, so I figure that'd work, right?

Oh...My bad, we can do. I was trapped in the contentDialog API itself before. We can do it sure. I will try to implement it on the main page. @zadjii-msft

@moooyo
Copy link
Collaborator

moooyo commented Mar 12, 2025

How about this one? @zadjii-msft

Video.Project.7.mp4

Code here: #536

@zadjii-msft
Copy link
Owner Author

That's like exactly what I pictured! :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-HostUX UX elements of the host CmdPal application good first issue Good for newcomers Issue-Task
Projects
None yet
Development

No branches or pull requests

2 participants