Click here to Skip to main content
15,915,739 members
Home / Discussions / C#
   

C#

 
AnswerRe: login authentication Pin
Sivaraman Dhamodharan8-May-13 0:22
Sivaraman Dhamodharan8-May-13 0:22 
GeneralRe: login authentication Pin
geo thomas8-May-13 0:30
professionalgeo thomas8-May-13 0:30 
GeneralRe: login authentication Pin
Dave Kreskowiak8-May-13 2:05
mveDave Kreskowiak8-May-13 2:05 
GeneralRe: login authentication Pin
geo thomas8-May-13 20:06
professionalgeo thomas8-May-13 20:06 
GeneralRe: login authentication Pin
Dave Kreskowiak9-May-13 1:37
mveDave Kreskowiak9-May-13 1:37 
GeneralRe: login authentication Pin
geo thomas9-May-13 19:00
professionalgeo thomas9-May-13 19:00 
Questionrunning asp.net website in a windows application Pin
mrkeivan7-May-13 22:25
mrkeivan7-May-13 22:25 
AnswerRe: running asp.net website in a windows application Pin
Dave Kreskowiak8-May-13 2:06
mveDave Kreskowiak8-May-13 2:06 
AnswerRe: running asp.net website in a windows application Pin
Abhinav S8-May-13 21:22
Abhinav S8-May-13 21:22 
QuestionIIS security settings and different permission Pin
ashabhatt27077-May-13 19:52
ashabhatt27077-May-13 19:52 
SuggestionRe: IIS security settings and different permission Pin
Richard MacCutchan7-May-13 21:14
mveRichard MacCutchan7-May-13 21:14 
Questionsave time with the desired date Pin
demoninside97-May-13 18:38
demoninside97-May-13 18:38 
AnswerRe: save time with the desired date Pin
demoninside97-May-13 20:05
demoninside97-May-13 20:05 
AnswerRe: save time with the desired date Pin
Richard MacCutchan7-May-13 21:06
mveRichard MacCutchan7-May-13 21:06 
QuestionUser defined functions for Excel 2010 in .NET: args linked to cells don't work Pin
PozzaVecia7-May-13 11:02
PozzaVecia7-May-13 11:02 
AnswerRe: User defined functions for Excel 2010 in .NET: args linked to cells don't work Pin
Dave Kreskowiak7-May-13 15:10
mveDave Kreskowiak7-May-13 15:10 
AnswerRe: User defined functions for Excel 2010 in .NET: args linked to cells don't work Pin
PozzaVecia7-May-13 18:48
PozzaVecia7-May-13 18:48 
GeneralRe: User defined functions for Excel 2010 in .NET: args linked to cells don't work Pin
Dave Kreskowiak8-May-13 2:14
mveDave Kreskowiak8-May-13 2:14 
QuestionSolution Explorer to be shown on the toolbar Pin
indian1437-May-13 7:15
indian1437-May-13 7:15 
AnswerRe: Solution Explorer to be shown on the toolbar Pin
Dave Kreskowiak7-May-13 7:41
mveDave Kreskowiak7-May-13 7:41 
GeneralRe: Solution Explorer to be shown on the toolbar Pin
T Pat7-May-13 20:00
T Pat7-May-13 20:00 
AnswerRe: Solution Explorer to be shown on the toolbar Pin
Pete O'Hanlon7-May-13 8:16
mvePete O'Hanlon7-May-13 8:16 
AnswerRe: Solution Explorer to be shown on the toolbar Pin
Anna King8-May-13 3:07
professionalAnna King8-May-13 3:07 
GeneralRe: Solution Explorer to be shown on the toolbar Pin
Pete O'Hanlon8-May-13 3:47
mvePete O'Hanlon8-May-13 3:47 
QuestionBackground worker with progress bar timing issue Pin
Blubbo7-May-13 5:02
Blubbo7-May-13 5:02 
I've come across with this progress bar using worker.ReportProgress(). I was hoping to get a real-time progress Bar value from outside Write_Tag method. In this code below, it does seem to have some 1-2 seconds delay before showing the progress bar status.

Any suggesion?

C#
private void InitializeProgressBars()
{
   for (int i = 0; i < DevicePath.Count; i++)
   {
       progressBar[i] = new ProgressBar();
       progressBar[i].Location = new Point(3, 16);
       progressBar[i].Size = new Size(605, 31);
       progressBar[i].Maximum = 100;
    }

    gbProgressStatus0.Controls.Add(progressBar[0]);
    gbProgressStatus1.Controls.Add(progressBar[1]);
    gbProgressStatus2.Controls.Add(progressBar[2]);
    gbProgressStatus3.Controls.Add(progressBar[3]);
}

private void InitializeBackgroundWorkers()
{
    for (var f = 0; f < DevicePath.Count; f++)
    {
       bw[f] = new BackgroundWorker();
       bw[f].WorkerReportsProgress = true;
       bw[f].WorkerSupportsCancellation = true;
 
       switch (f)
       {
          case 0:
          {
              bw[f].DoWork += new DoWorkEventHandler(BackgroundWorkerFilesDoWork0);
              bw[f].RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundWorkerFilesRunWorkerCompleted0);
              break;
          }
          case 1:
          {
              bw[f].DoWork += new DoWorkEventHandler(BackgroundWorkerFilesDoWork1);
              bw[f].RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundWorkerFilesRunWorkerCompleted1);
              break;
          }
          case 2:
          {
              bw[f].DoWork += new DoWorkEventHandler(BackgroundWorkerFilesDoWork2);
              bw[f].RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundWorkerFilesRunWorkerCompleted2);
              break;
           }
           case 3:
           {
              bw[f].DoWork += new DoWorkEventHandler(BackgroundWorkerFilesDoWork3);
              bw[f].RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundWorkerFilesRunWorkerCompleted3);
              break;
           }
        }
     }

     bw[0].ProgressChanged += (sender, e) => { progressBar[0].Value = e.ProgressPercentage; };
     bw[1].ProgressChanged += (sender, e) => { progressBar[1].Value = e.ProgressPercentage; };
     bw[2].ProgressChanged += (sender, e) => { progressBar[2].Value = e.ProgressPercentage; };
     bw[3].ProgressChanged += (sender, e) => { progressBar[3].Value = e.ProgressPercentage; };
}


private void BackgroundWorkerFilesDoWork0(object sender, DoWorkEventArgs e)
{
   BackgroundWorker worker = sender as BackgroundWorker;
   ProgressBar pb = new ProgressBar();
   pb.Maximum = 100;
   worker.ReportProgress(0);
            
   System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
   sw.Start();
   int status = tag_device0.Write_Tag(0, writeDat, en_statusDat, pb);

   worker.ReportProgress(pb.Value);

   if (ReadTag)
   {
       worker.ReportProgress(0);
       byte[] tagData = new byte[1024];
       tag5_device0.Read_Tag(0, 0, tagData .Length, ref tagData , pb);
       worker.ReportProgress(pb.Value);
    }

    sw.Stop();
    string result = string.Format("Status: {0}    Elapsed: {1}", status, sw.Elapsed.ToString());
    e.Result = result;
}

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.