Making Async custom message box

I have created a Custom Message Box class which when called displays a message box on the current page. I have also provided buttons inside of message box to accept user preference. After the custom message box is added to the page execution of methods continue.
I want to make the page wait until user opts an option from the message box just like existing MessageBox class.
I have created a method show() which displays the custom message box on the current page. How do I make it async to stop the execution till an option is selected by the user?

See
Quickstart: Calling asynchronous APIs in  C# or Visual Basic and
Asynchronous Programming with Async and Await for an overview of how the .Net async system works.
The tl;dr for your scenario is to have your ShowAsync() method return a Task so it can be awaited:
class CustomMessageDialog
public Task ShowAsync()
// Do whatever is needed to show the MessageDialog
public Task<int> ShowAndReturnAsync()
int indexChosen; // the index of the command picked by the user
// Do whatever is needed to show the MessageDialog
return indexChosen;

Similar Messages

  • Json file in message box

    Hi
    Is there a way i can read my json file stored in my folder in the message box i have tried the with the code below but keeps getting error
    //Message box code
    List<string> strings = new List<string>() {    "Friday 16Th 6PM", "Sunday 18TH 10AM & 7PM", "Wednesday 21st 6PM", "Friday 23RD 6PM", "Sunday 25th 10AM & 7PM", "Wednesday
    28th 6PM", "Friday 30th 6PM", };
            public ListPicker()
                InitializeComponent();
                lbx.ItemsSource = strings;
                lbx.SelectionChanged += lbx_SelectionChanged;
            void lbx_SelectionChanged(object sender, SelectionChangedEventArgs e)
                value = lbx.SelectedIndex;
                switch (value)
                    case 0:MessageBox.Show("");
                        break;
                    case 1: MessageBox.Show("");
                        break;
                    case 2: MessageBox.Show(" ");
                        break;
                    case 3: MessageBox.Show(" ");
                        break;
                    case 4: MessageBox.Show(" ");
                        break;
                    case 5: MessageBox.Show("");
                        break;
            public int value { get; set; }
    //Json file reference code
            string filepath = @"Assets\resources.json";
                            StorageFolder folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
                            StorageFile file = await folder.GetFileAsync(filepath); // error here
                            var data = await Windows.Storage.FileIO.ReadTextAsync(file);
    Thank you in advance and reply soon
    Jayjay john

    Hi
    I implemented a method in my app for json files in folder to read in a message box when i try to run in the emulator it throws the following exception "An exception of type 'System.NotImplementedException' occurred in DevotionJson.DLL but was not handled
    in user code"
    Kindly view my code below for necessary correction
    CustomMessageBox cmb;
            private void openMsgBox(object sender, RoutedEventArgs e)
                // create new Stack panel
                StackPanel sp = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Vertical };
                //get policy text from file
                string policy = getPolicy();
                //Create new label
                TextBlock tb = new TextBlock()
                    Text =policy,
                    TextWrapping = TextWrapping.Wrap,
                    FontSize = 25,
                //Create new Scroll viewer
                ScrollViewer sv = new ScrollViewer()
                    VerticalScrollBarVisibility=ScrollBarVisibility.Auto,
                    Height=500,
                // add texblock in scroll viewer
                sv.Content = tb;
                //Add the controls to stack panel
                sp.Children.Add(sv);
                // Create new Custom Message Box instance
                cmb = new CustomMessageBox()
                    // Set its content to our Stack Panel
                    Content = sp,
                    Opacity = 0.98,
                    // Left button of message box Button
                    LeftButtonContent = "Accepts",
                    //Right button of message Box
                    RightButtonContent="Reject",
                //Handle msg box click
                cmb.Dismissing += cmb_Dismissing;
                //Show the message box...
                cmb.Show();
            private string getPolicy()
                throw new NotImplementedException();
            void cmb_Dismissing(object sender, DismissingEventArgs e)
                if (e.Result==CustomMessageBoxResult.LeftButton)
                    MessageBox.Show("Now you can use this app.");
                else
                    //do what you want
                    MessageBox.Show("It's mandatory to accepts the T&C to use this app. Exiting from app.");
                    App.Current.Terminate();
            public string getPolicy(string JsonfilePath)
                string strText = "This";
                using (StreamReader r = new StreamReader("BibleInYear/Bible1.json"))
                    string json = r.ReadToEnd();
                    dynamic array = JsonConvert.DeserializeObject(json);
                    //... read text from json file
                return strText;
    I await your response and thank you in advance
    Jayjay john

  • Making a Message Box always on top

    Hi all,
    I want a solution so that the message box I show on the screen should remain always on top of all the windows. Just like the common windows operating system modal dialog boxes so that the user cannot proceed unless and untill he closes the message box.
    I have tried with the JDialog by calling the method
    setModal(true);
    but unable to fix it.
    Thanx in advance,
    With regards
    Yuvraj
    Mumbai.

    If you instanciate your JDialog with the parent Frame, it will be always on top of it.
    JFrame fra = new JFrame();
    fra.setVisible(true);
    JDialog dia = new JDialog(fra);
    dia.setModal(true);
    dia.setVisible(true);
    Happy programming !

  • Custom message Template

    Hello,
    Do any of you know what message template to use -- so that when a Invoice approval is initiated the notification will contain :some cutom values in addition to the standard format for Open Notification -- we've been using "Open Mail (Templated)"message template.
    Our managers and controllers want to see the supplier info and account #'s
    in the notification -- so they can quickly approve
    If making a custom template is the only way to do this - because a standard
    (out of box) template doesn't have this info -- could someone please
    forward along their procedures for making a custom template.
    Thanks
    vivek

    Hello,
    The Workflow Admin Guide should really read as follows.
    If you create new custom templates, your custom templates should contain only the high-level notification layout and general information common to all e-mail notifications. You must name the message attributes for these templates with the same standard names as the message attributes for the standard templates. Do not create any new custom message attributes in your templates with nonstandard names, and do not reference any nonstandard attribute tokens in the template message body. A notification mailer can only token substitute the attributes in the message body if you use the standard attribute names. To include additional information in a custom message template, enter that information directly into the template message body, without using tokens
    We had reviewed this issue and realized there there is no direct and supported way to token substitute custom tokens in the template without modifying the seeded PLSQL code. Above changed are reflected in the future releases of WF Admin Guide.
    Sorry for the confusion.
    Hope this helps.
    Vijay

  • Photoshop CS5.1: The message box reads: Could not print "________.jpg" because of a disk error. Fix?

    Photoshop CS5.1: The message box reads: Could not print “________.jpg” because of a disk error. Fix?

    How To Get Help Quickly!
    Is the printer driver up-to-date?
    Could your disk actually be faulty?
    Boilerplate-text:
    Are Photoshop and OS fully updated?
    As with all unexplainable Photoshop-problems you might try trashing the prefs (after making sure all customized presets like Actions, Patterns, Brushes etc. have been saved and making a note of the Preferences you’ve changed) by pressing command-alt-shift on starting the program or starting from a new user-account.
    System Maintenance (repairing permissions, purging PRAM, running cron-scripts, cleaning caches, etc.) might also be beneficial, Onyx has been recommended for such tasks.
    http://www.apple.com/downloads/macosx/system_disk_utilities/onyx.html
    Weeding out bad fonts never seems to be a bad idea, either. (Validate your fonts in Font Book and remove the bad ones.)
    If 3rd party plug-ins are installed try disabling them to verify if one of those may be responsible for the problem.

  • Missing Message Box after Skin Copy in IC Agent

    Hi,
    I copied the default skin in a customer z-skin (and added a logo).
    Everything works fine, even the company logo is visible.
    Now I have the problem that for the role "IC Agent" all the three message boxes have disappeared and that behind the SAP logo, the "Interaction Center" is smaller then before.
    Is this a problem in the process of the copy? Or is the mistake somewhere else?
    Thanks for your help
    Tim

    Hi Tim,
    We are facing exactly the same issue with our skin. we tried to copy 'NOVA' into a new custom skin and the three message boxes have disappeared.
    Also we get a warning on UI when we use this new custom skin saying "Communication management software system is not configured".
    Please can you extend help on this one. This is important for us.
    Many Thanks
    Priyanka

  • What's the easiest way to have a message box?

    Hey, i'm making this game and i have one frame and i have and one panel inside, and when the user completes the game i want a message box to popup saying "Congratulations, You Won!"
    At the moment when the user wins the game, i've just put a "System.out.println("You've Won"); but i want a message box to appear on top of the game. What's the best and simplest way to achieve this?
    I tried replacing my "System.out.println("You've Won") with JOptionPane.showMessageDialog(null, "You Won!"); and that just caused the whole thing to freeze up.
    Thanks

    saru88 wrote:
    I did as you suggested and changed the "null" in
    JOptionPane.showMessageDialog(null, "You Won!"); to
    JOptionPane.showMessageDialog(this, "You Won!"); to refer to the JPanel which contains the game code.And? Any benefit (unlikely)?
    Sorry for my lack of explanation about freezing up, what happens is the message box appears, but the inside is completely transparent and so i can see the game display behind it. And if i click inside it, then it does nothing but change the focus to that window. When i said freeze before i meant, it becomes "non responding" and so I have to open "Task Manager" and close it that way. This sounds like a thread issue. Are you calling JOptionPane.showMessageDialog(...) off of the EDT, the Event Dispatch Thread?

  • Blank Message Box when Saving a report in InfoView

    Post Author: Jmusser
    CA Forum: Administration
    I'm getting a blank message box when I try to save any report from any folder in infoview for users I have setup in the following Group.  Has anyone run into this on know what is set wrong in security?
    We are running BOXI2.  I have setup a custom security group for InfoView Users that grants rights to the following in Home > BusinessObjects Enterprise Applications > InfoView >- all other rights are not specified
    Log on to InfoView and view this object in the CMC
    Edit this object
    Search for simple text
    Do an advanced search
    Filter object listing by object type
    View the favorites folder
    View the Inbox
    Create categories
    Assign categories
    Send documents
    Create folders
    At the top level folder I have permissions granted as
    General
    Add objects to the folder
    Denied
    View objects
    Granted
    Granted
    Edit objects
    Granted
    Granted
    Modify the rights users have to objects
    Denied
    Schedule the document to run
    Denied
    Delete objects
    Denied
    Define server groups to process jobs
    Denied
    Delete instances
    Denied
    Copy objects to another folder
    Granted
    Granted
    Schedule to destinations
    Denied
    View document instances
    Granted
    Granted
    Pause and Resume document instances
    Denied
    Securely modify rights users have to objects.
    Denied
    Reschedule instances
    Denied
    Schedule on behalf of other users
    Denied
    Allow discussion threads
    Granted
    Granted
    View objects that the user owns
    Granted
    Granted
    Edit objects that the user owns
    Granted
    Granted
    Modify the rights users have to objects that the user owns
    Denied
    Delete objects that the user owns
    Granted
    Granted
    Delete instances that the user owns
    Granted
    Granted
    View document instances that the user owns
    Granted
    Granted
    Pause and Resume document instances that the user owns
    Granted
    Granted
    Securely modify rights users have to objects that the user owns.
    Denied
    Reschedule instances that the user owns
    Denied
    Desktop Intelligence
    Refresh the report's data
    Granted
    Granted
    Refresh List of Values
    Granted
    Granted
    Use Lists of Values
    Granted
    Granted
    View SQL
    Denied
    Export the report's data
    Granted
    Granted
    Download files associated with the object
    Granted
    Granted
    Desktop Intelligence Add in
    Download files associated with the object
    Granted
    Granted
    Desktop Intelligence Template
    Download files associated with the object
    Granted
    Granted
    Report
    Print the report's data
    Granted
    Granted
    Refresh the report's data
    Granted
    Granted
    Export the report's data
    Granted
    Granted
    Download files associated with the report
    Granted
    Granted
    Web Intelligence Document
    Refresh the report's data
    Granted
    Granted
    Edit Query
    Denied
    Refresh List of Values
    Granted
    Granted
    Use Lists of Values
    Granted
    Granted
    View SQL
    Denied
    Export the report's data
    Granted
    Granted
    Download files associated with the object
    Granted
    Granted

    Try This..
    1. Open the crystal client on your local machine and import that particular report.
    2. Do Database -> Verify Database. Then refresh the report on your PC and make sure that it returns data as expected.
    3. Export it back to repository and try scheduling it again. You can verify through CMC for Crystal Reports under " Database Configuration" property to make sure it points to the right ODBC.
    Let us know.

  • Custom messages in OBIEE 11.1.1.5

    We have a requirement to display custom messages in analysis when a user clicks on the results tab. The custom messages should be displayed to the user in the following circumstances:
    - When two dimension columns are selected without fact measures in the criteria tab. The message displayed should be " A fact measure should be included in the query."
    - When a fact measure is selected with no dimension column(s) in the criteria tab. The message displayed should be " At least one dimension column should be included in the query."
    Is there a way to do this in OBIEE 11g? Can you provide the steps to implement this?
    Thanks

    Hi,
    Edit your answres report and the Answres---result tab--> edit anlysis properties---> select No result setting combo box and select it custom message option and give your own message...
    Ex: Please look and the link
    http://imageshare.web.id/images/j2ifl5qxgqynqs0zthe.jpg
    Thanks
    Deva

  • ALE - error in custom  message type creation

    HAI friends,
    I am new to ALE IDOC, i am creating custom message type for custom table . i created segment, idoc, message type and executed  outbound program . in outbound client, status is dispatch ok. so problem in outbound.
    my problem is in inbound . i created one function module idoc_input_zmsg. In test tool for idoc processing ie. TCODE WE19, i clicked my segment and then i clicked the inbound function module button . In function module text box my own function module idoc_input_zmsg is available. but when i click ok button, i am getting the following error.
    "INTERFACE FOR FUNCTION IDOC_INPUT_ZMSG IS INCORRECT".
    PLS HELP ME . THANKS IN ADVANCE.
    WITH REGARDS,
    SENTHIL KUMAR.R

    All the IDOC processings FMs should have similar interface like this.
    *"  IMPORTING
    *"     VALUE(INPUT_METHOD) LIKE  BDWFAP_PAR-INPUTMETHD
    *"     VALUE(MASS_PROCESSING) LIKE  BDWFAP_PAR-MASS_PROC
    *"  EXPORTING
    *"     VALUE(WORKFLOW_RESULT) LIKE  BDWFAP_PAR-RESULT
    *"     VALUE(APPLICATION_VARIABLE) LIKE  BDWFAP_PAR-APPL_VAR
    *"     VALUE(IN_UPDATE_TASK) LIKE  BDWFAP_PAR-UPDATETASK
    *"     VALUE(CALL_TRANSACTION_DONE) LIKE  BDWFAP_PAR-CALLTRANS
    *"  TABLES
    *"      IDOC_CONTRL STRUCTURE  EDIDC
    *"      IDOC_DATA STRUCTURE  EDIDD
    *"      IDOC_STATUS STRUCTURE  BDIDOCSTAT
    *"      RETURN_VARIABLES STRUCTURE  BDWFRETVAR
    *"      SERIALIZATION_INFO STRUCTURE  BDI_SER
    *"  EXCEPTIONS
    *"      WRONG_FUNCTION_CALLED
    Check if you have different one. Even if the name of variables is not as above you may get the error message .
    Cheers

  • Custom messages in adf/uix ?

    hi, how can i display a message like , " record(s) saved successfully " in adf/uix. ??
    zaibi.

    Hi,
    Edit your answres report and the Answres---result tab--> edit anlysis properties---> select No result setting combo box and select it custom message option and give your own message...
    Ex: Please look and the link
    http://imageshare.web.id/images/j2ifl5qxgqynqs0zthe.jpg
    Thanks
    Deva

  • Message box text attributes

    I would appreciate any scripting help on how to make all of the text in a message box for a pdf all bold or to make specific words bold.  Any help is appreciated.

    You can create a custom dialog that can include bold text, for a static text element, for example. It's much easier to create bold blocks of text, as opposed to individual bold words within a block of text. See the execDialog method and other dialog related documentation: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.142.html

  • Teststand message box larger font for 95 years old

    Hi
    I am working with people > 90 yrs.
    the message pop up window occupied on top of the screen.
    How can I help them by changing the font and/or color of the message pop up.
    the real estate of the screen is there.
    message pop up dominates the screen, nothing else matters
    Please allow me to change the font for seniors with strained eyes.

    Hi trout00
    You have a couple different options for changing the font size of the message box. The first option is to change the native Windows message box settings. From Windows XP, right-click on your desktop and go to "Properties". Click on the "Appearance" tab in the Display Properties dialog box, and click on the "Advanced" button. In the Advanced Appearance dialog box, select "Message Box" from the "Item" drop-down menu. This will allow you to change the font of the message box text.
    Your other option is to use a custom step type. This KnowledgeBase has more information on this option, including a link to an example program.
    Russell G.
    NI Applications Engineering

  • Linked Drop Down Lists with a message box

    Hello all -
    I'm using Adobe Designer 7.0 and I've created a form with two linked dropdown lists. The second dropdown list displays certain options depending on what was selected from the first dropdown list. I based my dropdowns on the country/states dropdowns in the Interactive Purchase Order sample found at [installdir]\EN\Samples\Purchase Order\Interactive.
    But I also want to display a message box (with a helpful explanation) when the second dropdown list is clicked before making a selection from the first dropdown list. Right now, a tone sounds when that happens. I think it would be helpful to provide an explanation (in a message box) instead of just the tone.
    I tried this javascript on the second dropdown click event, but it displays the message box all the time, not just when the first dropdown was unselected:
    if (dropdownlist1.rawValue == " ");
    xfa.host.messageBox("Please choose a value from dropdownlist1 first.");
    Can anybody show me how to display the message box only when dropdownlist2 is clicked and a selection has not yet been made from dropdownlist1?

    The best thing is to dynamically build your where clause based on the user selection. Test the values of all form fields and if the user does not make a selection, do not include that in the where clause.
    Trying to build a single, static where clause that accounts for all possible user input permutations is extremely difficult.

  • Error message Box

    xfa.host.messageBox("Error!", "Hello world", 0, 0);
    This code in all lower versions of reader (upto version 7.0.9 ) would pop a message box with Hello world in the Title bar of the message box. the same code however in reader 8.1 shows Warning: javascript window - Hello world in title bar.
    Is there a way to over-ride this and just show the customized title bar?
    Thanks for your help.

    All prior versions? Only in versions 5.1 and above.
    It is a known problem. Adobe tightened up security restrictions too much.

Maybe you are looking for

  • Crystal report 9 supports frame work 2.0

    Hi experts, we are using Crysatl report 9 and build the reports using VS2003 with the frame work 1.1.4322. We are fetching the online report by deploying the same in the IIS server which has the frame work [1.0,1.1,2.0]. When we use Asp.net frame wor

  • Error while mass conversion of Planned order to production order

    Hi All, Thanks in Advance for help. We are facing one issue since Oct-2011. We have set up batch jobs for early morning to convert planned orders in to production orders. This is set up for transaction COHV. We have both MTO and MTS scenario. But pro

  • 40" LCD fitting in Armoire

    I have an armoire that has an opening width of 39 1/2" .  I found a couple Samsung and Sony models that are pretty close in specifications and the width are very close to that.  Is there a recommended amount of space on the sides of the TV for ventil

  • Empty contacts with the new version of pc suite

    Hi, I have a nokia 6111 connected to my pc with a usb cable. When I go to my contacts with the nokia phone browser, the list is empty. It works well with my old version of pc suite 6.82 but since I'm upgraded it to the 6.83.14.1, the list is empty. I

  • Satellite 300 - Can't connect Printer

    We have 2 Toshiba Laptops, the older one is running perfectly and printing wirelessly via the NetGear print server, just purchased the Satelitte 300 and no matter how hard I try cannot get the laptop to print wirelessly - can go through all the insta