?
Solved

Open and close modal popup based on conditions

Posted on 2013-12-14
5
Medium Priority
?
608 Views
Last Modified: 2013-12-16
This is what I need:

if (condition == A)
       
     {
                 Open popup with a Please Wait message and a Close button
                 while ((line = sr.ReadLine()) != null)   // This loop takes about 10 minutes
                     {
                           Do Stuff
                           if (condition == B)
                                  {
                                         Change message in popup to "Finished"
                                  }
                     }   // End While
       } // End if (condition == A)

How can this be done?

Thanks,
0
Comment
Question by:Dovberman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 800 total points
ID: 39720359
if (condition == A)
       
     {
                 Open popup with a Please Wait message and a Close button
//At this point your program will wait until a modal popup is closed
0
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 800 total points
ID: 39720384
Typically you would put the long job into a thread
0
 
LVL 16

Assisted Solution

by:hjgode
hjgode earned 400 total points
ID: 39720778
You have to show the popup in a separet thread. You can use the backgroundworker class to create a form in a background thread or you use your own new thread.

The backgroundworker calls provides members to call back into your main caode, so your main 'knows' that state (ie a progress or finish).

There are many examples out there, just search for "backgroundworker popup".

    public Form1()
    {
        InitializeComponent();

    }

    private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
    {
       /* this.Invoke((Action)(() =>
                        {
                            var form2 = new Form2();
                            form2.Show();
                        }));  Winforms Method*/
         Dispatcher.Invoke((Action)(() =>
                        {
                            var form2 = new Form2();
                            form2.Show();
                        }));

    }

    private void Form1_Click(object sender, EventArgs e)
    {
        backgroundWorker1.RunWorkerAsync();
    }

Open in new window


In Form2 you would run your long file reading task.
0
 
LVL 11

Accepted Solution

by:
SAMIR BHOGAYTA earned 800 total points
ID: 39720823
hi.. please go through this example

<styletype="text/css">
.noDisplay
{
display: none;
}
</style>

<divID="divModalPopup">
<cc1:ModalPopupExtenderID="ModalPopupExtender2"runat="server"
TargetControlID="dummy"
PopupControlID="Panel13"
BackgroundCssClass="modalBackground"
DropShadow="true"
OkControlID="OKButton">
</cc1:ModalPopupExtender>
<asp:LinkButtonrunat="server"ID="dummy"CssClass="noDisplay"Text="Click me..."/>
<asp:PanelID="Panel13"runat="server"CssClass="modalPopup"Style="display: none"Width="270px"BorderStyle="Double"ScrollBars="Auto">
<br/>
<tablestyle="width: 100%;"bgcolor="#79A9B9"cols="2"align="center"
cellpadding="2"cellspacing="2"border="2"bordercolor="olive">
<tr>
<tdalign="center">
<b>Attention User!</b>
</td>
</tr>
<tr>
<tdalign="center">
Your request has been submitted. Please make a note of the job information for your records.
</td>
</tr>
</table>
<br/>
<divalign="center">
<asp:ButtonID="OKButton"runat="server"Text="OK"/>
</div>
</asp:Panel>
<br/>
</div>
0
 

Author Closing Comment

by:Dovberman
ID: 39721540
Thank you.
0

Featured Post

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question