00001 using System;
00002 using System.Drawing;
00003 using System.Collections;
00004 using System.ComponentModel;
00005 using System.Windows.Forms;
00006
00007 namespace Tamir.SharpSsh.jsch.examples
00008 {
00012 public class ProgressForm : System.Windows.Forms.Form
00013 {
00014 private System.Windows.Forms.ProgressBar progressBar1;
00015 private System.Windows.Forms.Button btnCancel;
00016 private System.Windows.Forms.Label lblProgress;
00020 private System.ComponentModel.Container components = null;
00021
00022 public ProgressForm()
00023 {
00024
00025
00026
00027 InitializeComponent();
00028 progressBar1.Minimum = 0;
00029 progressBar1.Maximum = 100;
00030 }
00031
00035 protected override void Dispose( bool disposing )
00036 {
00037 if( disposing )
00038 {
00039 if(components != null)
00040 {
00041 components.Dispose();
00042 }
00043 }
00044 base.Dispose( disposing );
00045 }
00046
00047 public void Update(int progress, string Text)
00048 {
00049 this.BeginInvoke( new invoke(UpdateProgress), new object[]{progress, Text} );
00050 }
00051
00052 public void Finish()
00053 {
00054 this.Close();
00055 }
00056
00057 private void UpdateProgress(int progress, string text)
00058 {
00059 lblProgress.Text=text;
00060 progressBar1.Value=progress;
00061 }
00062
00063 #region Windows Form Designer generated code
00068 private void InitializeComponent()
00069 {
00070 this.progressBar1 = new System.Windows.Forms.ProgressBar();
00071 this.btnCancel = new System.Windows.Forms.Button();
00072 this.lblProgress = new System.Windows.Forms.Label();
00073 this.SuspendLayout();
00074
00075
00076
00077 this.progressBar1.Location = new System.Drawing.Point(48, 32);
00078 this.progressBar1.Name = "progressBar1";
00079 this.progressBar1.Size = new System.Drawing.Size(264, 23);
00080 this.progressBar1.TabIndex = 0;
00081
00082
00083
00084 this.btnCancel.Location = new System.Drawing.Point(144, 64);
00085 this.btnCancel.Name = "btnCancel";
00086 this.btnCancel.TabIndex = 1;
00087 this.btnCancel.Text = "Cancel";
00088
00089
00090
00091 this.lblProgress.Location = new System.Drawing.Point(48, 8);
00092 this.lblProgress.Name = "lblProgress";
00093 this.lblProgress.Size = new System.Drawing.Size(264, 23);
00094 this.lblProgress.TabIndex = 2;
00095 this.lblProgress.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
00096
00097
00098
00099 this.AcceptButton = this.btnCancel;
00100 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
00101 this.ClientSize = new System.Drawing.Size(368, 94);
00102 this.ControlBox = false;
00103 this.Controls.Add(this.lblProgress);
00104 this.Controls.Add(this.btnCancel);
00105 this.Controls.Add(this.progressBar1);
00106 this.Name = "ProgressForm";
00107 this.Text = "ProgressForm";
00108 this.ResumeLayout(false);
00109
00110 }
00111 #endregion
00112 }
00113
00114 public delegate void invoke(int progress, string Text);
00115 }