C # [multi-thread + queue] [Source Code] Message prompt box in the lower right corner. Multiple prompt boxes can be displayed at the same time.

Source: Internet
Author: User

--------------------------------------------- August ------------------------------------------------------------------------------------------------------------------------------

Today, we modified the bug of no priority in emergency notification, and added the issue that the location of the survival window will be adjusted when the window is closed. However, we have not passed a comprehensive test. Please wait for a friend, I will release the link after I test it tomorrow (July 15, May 3.

Last modified (which was not modified at the bottom of this article): http://download.csdn.net/detail/juyangjia/5323339

--------------------------------------------- August ------------------------------------------------------------------------------------------------------------------------------

Recently, I made a simple data collection program in my company. I had nothing to do on my own side. I made a small tool for prompting information and sent it to new people, I hope that after you download and read it, you will not need to hide any good things you have written in the future. After all, you can grow with openness.

I admit that some places do not write well... Silly. I wrote multithreading for the first time. Not a lot of things. Just look at it.

With queues and multithreading, you can show multiple prompt boxes at the same time, but the number of prompt boxes displayed at the same time will not exceed the set value, if the value is exceeded, it will be displayed after the box is closed or automatically closed.

 

Let's take a look at it first and continue later:

 

This figure shows that the overlap of the prompt box is set to false.

 

 

This figure shows that overlap is set to true, and all notifications will be together. The following pop-up pops up to block the front.

 

 

I. principles: 1. Add the messages to be displayed to the queue and release the semaphores.

2. When an independent thread receives a semaphore release notification, it indicates that a message needs to be displayed, and the notification is retrieved and displayed.

 

Ii. Usage: the simplest use method is to use the Show () method of the NoticeCenter class.

1. Configure the prompt box attributes (no default values are configured)

// Custom configuration method 1 NoticeCenter. cfg. height = 140; // The High NoticeCenter dialog box appears. cfg. width = 250; // The Width of the pop-up box NoticeCenter. cfg. overlap = false; // whether the pop-up box overlaps. If the value is true, the position of the pop-up box is the same, and the pop-up box that appears later will block the NoticeCenter. cfg. totalShow = 5; // Several prompt boxes are displayed at the same time. If more than 5 prompt boxes are displayed, the thread will wait for the previous thread to release. // custom configuration method 2 NoticeCenter. cfg = new NoticeCfg {Height = 140, Width = 250, TotalShow = 5, Overlap = false };

 

2. instantiate one or more "prompt information classes", that is, instantiate a notification to be prompted to the user. There are three Notice attributes, which are explained as follows:

// 1. Prompt message. The default value of wait is 5000.
Notice notice_1 = new Notice {msg = "this is a test. Try it "};
// 2. wait indicates that the box will be released (closed) After 3000 milliseconds)
Notice notice_2 = new notice {MSG = "this is a test. Try it.", wait = 3000 };
// 3. The content in detail is the content displayed in the pop-up box when you click "View Details". It is not suitable for displaying too much text and displaying specific content in a detail window.
Notice notice_3 = new notice {MSG = "this is a test. Try it. Try it.", wait = 3000, detail = "click to view details and the details set will be displayed, if this parameter is not set, the MSG content is displayed by default "};

3. Call show () of the notification ()

Noticecenter. Show (notice_3); // put the message to be popped up into the queue. The message will pop up when the prompt is displayed.
// Noticecenter. Show (notice_3, true); // if the second parameter is true, the message is put into the first queue.

 

 

Source code:

Http://download.csdn.net/detail/juyangjia/5308805

 

Welcome to download

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.