Confirm in Static Methods

4 posts, 0 answers
  1. Shanka
    Shanka avatar
    17 posts
    Member since:
    Jun 2010

    Posted 17 Sep 2010 Link to this post

    public static bool DisplayInfoMessage1(string strMsg)
            {
               if (MessageBox.Show(strMsg, mstrProjectName, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    return true;
                }
                else
                {
                    return false;
                }       
            }

    I want to do this using the RadWindow.Confirm box Please Help I try it any times but cannot done it


    RadWindow.Confirm(strMsg, new EventHandler<WindowClosedEventArgs>(OnClosed));        can not write inside static Method

    private void OnClosed(object sender, WindowClosedEventArgs e)
            {
                
                if (e.DialogResult == true)
                {
                    ConfirmationStatus = true;
                }
                else
                {
                    ConfirmationStatus = false;
                }
            }
     
    ConfirmationStatus  is Public Boolean value.
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 20 Sep 2010 Link to this post

    Hello Shanka,

     As the Confirm method of the RadWindow class is an asynchronous (in contrast with the Show method of the MessageBox class) you cannot use its result as a return value of your method - the event handler will be called after the value is returned. If you give us some more details about the scenario we might be able to help you use the Confirm method in your case.

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Shanka
    Shanka avatar
    17 posts
    Member since:
    Jun 2010

    Posted 21 Sep 2010 Link to this post

    I want to Show Confirm and get Boolean value after Click Yes or No

    i done it Application Closed event

     private void Exit_Click(object sender, RoutedEventArgs e)
            {
                RadWindow.Confirm("Do You want to Close ?", new EventHandler<WindowClosedEventArgs>(this.FormClose));
            }


            private void FormClose(object sender, WindowClosedEventArgs e)
            {
                if (e.DialogResult == true)
                {
                    this.Close();
                }

            }

    But The Confirm is used several times in my Project I want to pass my String and Get the answer true or False .
    with out create instance of Class.Like

    ClassName instance = New ClassNAme();
    if (instance.MethodNAme("Are You Sure "))
    {
      // My content
    }


    Please help

    Thank you,
    Shanka.
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 27 Sep 2010 Link to this post

    Hello Shanka,

     What you need to do cannot be achieved with the RadWindow control because of the way it works. What I would suggest you is to use the approach you currently use (with the Closed event handler).

    Greetings,
    Miroslav Nedyalkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top