Click here to Skip to main content
15,908,906 members
Home / Discussions / C#
   

C#

 
GeneralRe: Avoid constructor initialization to Designer Pin
binarycat9-Apr-08 23:27
binarycat9-Apr-08 23:27 
GeneralFind Odd and Even number Pin
M Riaz Bashir9-Apr-08 20:50
M Riaz Bashir9-Apr-08 20:50 
GeneralRe: Find Odd and Even number Pin
mav.northwind9-Apr-08 20:57
mav.northwind9-Apr-08 20:57 
GeneralRe: Find Odd and Even number Pin
Nouman Bhatti9-Apr-08 21:18
Nouman Bhatti9-Apr-08 21:18 
AnswerRe: Find Odd and Even number Pin
carbon_golem10-Apr-08 3:20
carbon_golem10-Apr-08 3:20 
QuestionHow to modify the aseembly Pin
sujithkumarsl9-Apr-08 17:57
sujithkumarsl9-Apr-08 17:57 
GeneralPrinting word docs using word automation Pin
J. R. Anderson9-Apr-08 17:55
J. R. Anderson9-Apr-08 17:55 
QuestionA problem in multithreading Pin
Nothend9-Apr-08 17:47
Nothend9-Apr-08 17:47 
Hello,all:
I am using ArcEngine(a software managing spatial data) to upload data(shapefile etc.) to database.Because the process of uploading data is time-consuming,when I click the ProgressBar window or minimize the parent window and then maximize the parent window,the parent window and the ProgressBar window is white using single thread.

So,I use multithread to work out this prolem,and it does.But,the speed of uploading data to database slows down greatly . The work uploading data is no more than 10 minutes in single thread,but 40 minutes in multithread!!

Who can help me?I appreciate your help!

private delegate bool UpdateHandle(int nValue,string text);
private UpdateHandle myUpdate = null;


myProcessBar is a Window has two controls,a ProgressBar named Bar and a Label named LabelInfo.It has a public method
BeeUpdate(int value, string text)



public bool BeeUpdate(int value, string text)
{
     LabelInfo.Text = text;
     LabelInfo.Refresh();
     if (value > 0)
     {
          if (Bar.Value + value < Bar.Maximum)
          {
               Bar.Value += value;
               Bar.Refresh();
               return true;
          }
          else
          {
               Bar.Value = Bar.Maximum;
               Bar.Refresh();
                    
               this.Close();
               return false;
          }
     }
     return false;
}



the delegate entry point:
private void ShowProcessBar()
{
     myProcessBar = new ProgressBee("Uploading", 100 * ClassCount);
            
     myUpdate = new UpdateHandle(myProcessBar.BeeUpdate);

     myProcessBar.ShowDialog();

     myProcessBar = null;
}


the method called by MainWindow
//caller is the main window
public bool CopyTo(parm1, parm2,Form caller)
{
     MethodInvoker mi = new MethodInvoker(ShowProcessBar);

     mi.BeginInvoke(null, null);

     caller.BeginInvoke(mi);

     Thread.Sleep(2000);
            
     Thread copyProcess = new Thread(delegate()
     {
          for (int i = 0; i < FeatureClassCount; i++)
          {
               Thread.Sleep(30);

               if (condition)
               {
                    //the Interface of ArcEngine  upload data
               }
               else
               {
                    //another Interface of ArcEngine upload data

               }

               caller.Invoke(this.myUpdate, new object[] { 100, "……" });

          }
     });

     copyProcess.Priority = ThreadPriority.AboveNormal;
     copyProcess.Start();
     return true;
}

GeneralRe: A problem in multithreading Pin
Christian Graus11-Apr-08 13:13
protectorChristian Graus11-Apr-08 13:13 
QuestionHelp: Project Management App Pin
demonmaster3k9-Apr-08 16:20
demonmaster3k9-Apr-08 16:20 
QuestionGlobal lists/arrays Pin
Jerry Graham9-Apr-08 12:38
Jerry Graham9-Apr-08 12:38 
GeneralRe: Global lists/arrays Pin
Anthony Mushrow9-Apr-08 13:13
professionalAnthony Mushrow9-Apr-08 13:13 
GeneralRe: Global lists/arrays Pin
PIEBALDconsult9-Apr-08 13:19
mvePIEBALDconsult9-Apr-08 13:19 
GeneralRe: Global lists/arrays Pin
Christian Graus9-Apr-08 14:41
protectorChristian Graus9-Apr-08 14:41 
QuestionUserPaint RichTextBox Pin
xJorDyx9-Apr-08 12:07
xJorDyx9-Apr-08 12:07 
GeneralRe: UserPaint RichTextBox Pin
Christian Graus9-Apr-08 12:22
protectorChristian Graus9-Apr-08 12:22 
GeneralRe: UserPaint RichTextBox Pin
xJorDyx10-Apr-08 4:53
xJorDyx10-Apr-08 4:53 
GeneralCapturing POST data via .NET 2.0 WebBrowser control Pin
Spacix One9-Apr-08 10:41
Spacix One9-Apr-08 10:41 
GeneralWin32 Classes Pin
half-life9-Apr-08 7:56
half-life9-Apr-08 7:56 
GeneralRe: Win32 Classes Pin
Christian Graus9-Apr-08 11:17
protectorChristian Graus9-Apr-08 11:17 
GeneralRe: Win32 Classes Pin
half-life10-Apr-08 8:01
half-life10-Apr-08 8:01 
GeneralRe: Win32 Classes Pin
Dave Kreskowiak9-Apr-08 13:29
mveDave Kreskowiak9-Apr-08 13:29 
GeneralRe: Win32 Classes Pin
half-life10-Apr-08 8:01
half-life10-Apr-08 8:01 
QuestionWhat could cause a Dispatcher Thread to terminate abnormally? Pin
carbon_golem9-Apr-08 7:31
carbon_golem9-Apr-08 7:31 
AnswerRe: What could cause a Dispatcher Thread to terminate abnormally? Pin
carbon_golem9-Apr-08 8:01
carbon_golem9-Apr-08 8:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.