Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7091881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:14:35+00:00 2026-05-28T08:14:35+00:00

In one of my classes, I have got code: private static void Notify(string url,

  • 0

In one of my classes, I have got code:

    private static void Notify(string url, string author, string mess)
    {
        Toast slice = new Toast(100000, url, author, mess) { Height = 90 };
        slice.Show();
        return;
    }

    public void Job()
    {
        Notify("http://google.com", "username", "hi all");
        while (true)
        {
            if (Run() == false)
                break;
        }
        /* .... */
    }

Notify function is displays a small box with my text. it works well, but if it comes after a loop, then the program hangs. ie if after Notify("http://google.com", "username", "hi all"); add return;, program will not hang.

I tried to make this function in another thread, but then for some reason it does not work properly and displays a “white list”. What am I doing wrong and what you can do in this situation? Sorry for bad English.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:14:36+00:00Added an answer on May 28, 2026 at 8:14 am

    From what’s been said in the comments, I may have a solution for you.

    First, be sure you are calling Job() from the main UI thread. For example, directly in a UI object Event Handler, or within a call to a UI object’s Invoke() method.

    Then I would change your code as follows:

    private static void Notify(string url, string author, string mess)
    {
        using(Toast slice = new Toast(100000, url, author, mess) { Height = 90 })
        {
            slice.ShowDialog();
        }
    }
    
    public void Job()
    {
        Notify("http://google.com", "username", "hi all");
    }
    

    Note that I remove the loop entirely, and I use ShowDialog() to prevent further interaction with the program until the slice window is closed.

    I’ve also put slice in a using() block, because it should have Dispose() called when you are done with it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got two classes, one a subclass of the other (say Animal and
I have two classes, and want to include a static instance of one class
I have got several classes looking like the one below, and I need to
I have 2 classes and one of them has map<string, vector<string> > I want
I have two classes one of which inherits from the other. Im trying to
I have several classes that conceptually belong to one tier. They have no common
I have a field for addedBy in one of my classes. I've set up
I have some classes that, for one reason or another, cannot be or need
In one of my projects, I have some classes that represent entities that cannot
I have a class library. In one of the classes, I am adding a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.