iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi
I can't seem to be able to close a dialog box when I first ask/promy user to confirm closure e.g.
MessageBoxServiceProvider.Show("About to exit. If you have added new items or amended items your changes will be lost if you haven't saved. Are you sure you want to proceed/cancel?",
"Proceed and Cancel All Changes?", MessageBoxButton.YesNo, MessageBoxImage.Warning, (dialogResult) => { if (dialogResult != DialogResult.Yes) { return; } DialogBoxServiceProvider.CloseCurrentWindow(); });
I am using MVVM.
Thanks
Here, I reattached it for you.
Regards,Handy
Hello,
If you are using our DialogBoxResult, it should automatically close the dialog when ok or cancel. We provide the DialogBoxResult for user to run some command or validation before close the dialog.Normally, if you use UXDialogBox, it should be something like this:
DialogBoxServiceProvider.GetInstanceAsync("ClientUIDataApp3.Views.UXDialogBox1", (dialog) => { dialog.ShowDialog(null, (dialogResult) => { if (dialogResult == DialogResult.OK) { } else if (dialogResult == DialogResult.Cancel) { } }); });
I think I may not have explained properly...yes your code is valid in that this is the code used in the calling screen ie. to popup the dialog box.
Then when the dialog box is closed (DialogResult.OK or DialogResult.Cancel) the calling code can use the logic.
This code I understand runs when the popped up window is closed - I don't want that - I want to prevent the popped up window closing if the user answers 'No' to my MessageBoxServiceProvider.Show(....) message box.
Logic.....
Window1 pops up Window2 using code as you offer above.
Window2 has two buttons - Save and Cancel
Save (mvvm code) saves data and closes Window2 using DialogBoxServiceProvider.CloseCurrentWindow() - this works.
Cancel (mvvm code) display Messagebox asking confirmation from user for Cancel Action.
If user says 'No Cancel' then return to Window2 (works)
If user says 'Yes - Cancel' then this code does not now work <DialogBoxServiceProvider.CloseCurrentWindow();> - it's as if the DialogBoxServiceProvider.CloseCurrentWindow(); is closing the MessageBox and not the Window2.
Can I have an update please - this is still not resolved, thanks
I tried to create a simple project based on the provided logic.
Please have the attached sample evaluated on your end and let us hear your feedback if there is anything that I miss to reproduce the reported problem.
thanks, but this does not do what I need.
Your code simply re-opens a new instance of the pop-up dialog box if the user decides they don't want to cancel. This means any data entry stuff in the Dialog is lost as a new instance of the pop up occurs.
It also seems that this code places the business logic in the calling page - I would want to business logic to reside within the dialog pop up.
Maybe if I explain further the exact scenario. It is to manage (add, amend , delete) lookup/drop down list items used in my application e.g. Languages, countries, gender, age ranges, etc
1) I have a page that displays a list box with 'lookup' items
2) The use will select one and dialog will be popped up listing in a listbox for example a list of languages.
3) The user can then add new item, amend and delete items in the list - this is done in memory.
4) When the user clicks the Save button the in memory changes are uploaded to the database - if the user click Cancel I want to popup a message box asking for confirmation. Ok - amendments care cancelled - Cancel the user return to the dialog box and can then click save and upload amendments to the database.
The problem I see with IsCancel="True" (and your code) on the Cancel button is that the dialog is closed first (and any field/in memory data).
Simply put
1) Click Cancel
2) Ask user for confirmation
3) Do a 'dialog.close' piece of code if user accecpt cancel or simply leave Dialog open as it was before.
I've attached some screenshots
Richard
Here I attached a sample. When a dialogbox open and user click 'Cancel', the dialogbox would not be closed. But it will open messagebox to notify user. If user choose 'No' in the messagebox, it will leave dialogbox as before. But if user choose 'Yes' in messagebox, it will automatically close all.
I hope this scenario is the one that you were looking for.
In order to do that, you would need to remove all dialogbox result in all dialogbox button. The dialogbox result should be handled manually in global dialogbox and bind it with your vm. Therefore, you would also need to use "AutoCloseDialog" as true. Please look into my sample.
I am having a problem opeing the zip file - I have used winzip and 7zip but I get errors (Unsupported compression.......)
Can you please resend.
Thanks, that zipped worked - had a quick look and it looks good - will get back if I have any issues - thanks.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname