本文整理汇总了C#中ProgressBar.Show方法的典型用法代码示例。如果您正苦于以下问题:C# ProgressBar.Show方法的具体用法?C# ProgressBar.Show怎么用?C# ProgressBar.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgressBar
的用法示例。
在下文中一共展示了ProgressBar.Show方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeMonitor_Load
public void MakeMonitor_Load(object sender, EventArgs e)
{
sourceExtension = ".cc";
objectExtension = ".o";
backgroundWorker = new System.ComponentModel.BackgroundWorker();
backgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(backgroundWorker_DoWork);
backgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted);
fileSystemWatcher = new System.IO.FileSystemWatcher();
((System.ComponentModel.ISupportInitialize)(fileSystemWatcher)).BeginInit();
fileSystemWatcher.EnableRaisingEvents = true;
fileSystemWatcher.SynchronizingObject = this;
BackColor = System.Drawing.Color.FromArgb(255, 255, 255);
searchTextBox = new TextBox();
searchTextBox.Bounds = Util.getBoundsOfSearchTextBox(Width, Height);
searchTextBox.Show();
searchTextBox.Visible = true;
Controls.Add( searchTextBox );
searchTextBox.TextChanged += new System.EventHandler(SearchTextBox_TextChanged);
pathLabel = new Label();
pathLabel.Text = "Enter path above.";
pathLabel.Bounds = Util.getBoundsOfPathLabel(Width, Height);
pathLabel.Show();
pathLabel.Visible = true;
Controls.Add(pathLabel);
progressBar = new ProgressBar();
progressBar.Bounds = Util.getBoundsOfProgressBar(Width, Height);
progressBar.Margin = new Padding(0);
progressBar.BackColor = System.Drawing.Color.FromArgb(255, 255, 255);
progressBar.ForeColor = System.Drawing.Color.FromArgb(255, 255, 255);
progressBar.Show();
progressBar.Visible = true;
Controls.Add(progressBar);
percentageLabel = new Label();
percentageLabel.Text = "0%";
percentageLabel.Bounds = Util.getBoundsOfPercentageLabel(Width, Height);
percentageLabel.Show();
percentageLabel.Visible = true;
Controls.Add(percentageLabel);
statusLabel = new Label();
statusLabel.Text = "";
statusLabel.Bounds = Util.getBoundsOfStatusLabel(Width, Height);
statusLabel.ForeColor = System.Drawing.Color.FromArgb(0, 128, 0);
statusLabel.Visible = true;
statusLabel.Show();
Controls.Add(statusLabel);
errorLabel = new Label();
errorLabel.Text = "";
errorLabel.Bounds = Util.getBoundsOfErrorLabel(Width, Height);
errorLabel.ForeColor = System.Drawing.Color.FromName("Red");
errorLabel.Visible = true;
errorLabel.Show();
Controls.Add(errorLabel);
MinimumSize = Util.getMinimumSizeOfMainPage();
Size = Util.getSizeOfMainPage();
Menu = new MainMenu();
MenuItem settings = new MenuItem("&Settings");
settings.Click += new System.EventHandler(settings_Click);
Menu.MenuItems.Add(settings);
((System.ComponentModel.ISupportInitialize)(fileSystemWatcher)).EndInit();
}
示例2: FormMain
public FormMain()
{
Form progressBar = new ProgressBar();
try
{
progressBar.StartPosition = FormStartPosition.CenterScreen;
progressBar.Show();
progressBar.Update();
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
InitSessionContext();
SetDefaultInputs();
CustomInit();
SetFormStartPosition();
bindEvent();
progressBar.Hide();
}
catch(Exception err)
{
MessageBox.Show(err.Message);
}
finally
{
progressBar.Dispose();
}
}
示例3: DownLoad_Click
private void DownLoad_Click(object sender, RoutedEventArgs e)
{
//System.Windows.Controls.ListViewItem item = (System.Windows.Controls.ListViewItem)FileList.SelectedItems[0];
// Strip off 'Root' from the full path
string path = (filedata).Path;
CreateFolder(@"SchoolInteligentUSB\FileRoom");
SaveFileDialog dlg = new SaveFileDialog()
{
RestoreDirectory = true,
OverwritePrompt = true,
Title = "Save as...",
FileName = System.IO.Path.GetFileName(path),
InitialDirectory = usbpath + @"SchoolInteligentUSB\FileRoom"
};
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
if (!string.IsNullOrEmpty(dlg.FileName))
{
// Get the file from the server
string tempdirectroy = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + "Temp";
Directory.CreateDirectory(tempdirectroy);
string filename = dlg.FileName.Substring(dlg.FileName.LastIndexOf("\\") + 1);
Stream output = new FileStream(tempdirectroy + "\\" + filename, FileMode.Create);
//Stream output = new FileStream(dlg.FileName, FileMode.Create);
Stream downloadStream = service.GetFile(path, flag);
// 파일 사이즈 정보 가져오기
StorageFileInfo[] files = null;
files = service.List(null, flag);
double fileSize = 0;
foreach (var file in files)
{
if (path == file.VirtualPathk__BackingField)
fileSize = (double)file.Sizek__BackingField;
}
deletefilepath = tempdirectroy;
//프로그래스바 ㄱㄱ
ProgressBar bar = new ProgressBar(downloadStream, output, fileSize, deletefilepath, dlg.FileName);
bar.getfile += GetFile;
bar.Show();
}
}
}
示例4: backgroundWorker1_DoWork
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate
{
pb = new ProgressBar();
pb.Show();
}));
FileInfo fileInfo = new FileInfo(path);
if (fileInfo.Exists)
{
using (FileStream stream = new FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
using (StreamWithProgress uploadStreamWithProgress = new StreamWithProgress(stream))
{
uploadStreamWithProgress.ProgressChanged += uploadStreamWithProgress_ProgressChanged;
service.UploadFile(fileInfo.Name, fileInfo.Length, 0, uploadStreamWithProgress, flag);
}
}
}
}
示例5: backgroundWorker1_DoWork
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate
{
pb = new ProgressBar();
pb.Show();
}));
//NoUSB 폴더에 저장
FileInfo fileInfo = new FileInfo(zipPath_Convert);
if (fileInfo.Exists)
{
using (FileStream stream = new FileStream(zipPath_Convert, System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
using (StreamWithProgress uploadStreamWithProgress = new StreamWithProgress(stream))
{
uploadStreamWithProgress.ProgressChanged += uploadStreamWithProgress_ProgressChanged;
service.UploadFile(id + " - " + fileInfo.Name, fileInfo.Length, 0, uploadStreamWithProgress, 6);
}
}
}
service.Dispose();
if (System.IO.Directory.Exists(startPath))
{
try
{
System.IO.Directory.Delete(startPath, true);
}
catch
{
return;
}
}
if (System.IO.File.Exists(zipPath + ".zip"))
{
try
{
System.IO.File.Delete(zipPath + ".zip");
}
catch
{
return;
}
}
Environment.Exit(0);
System.Diagnostics.Process.GetCurrentProcess().Kill();
this.Close();
}
示例6: GetFile
private void GetFile(object sender, RoutedEventArgs e)
{
string path, filename;
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.Filter = "All(*.*)|*.*";
Nullable<bool> result = dlg.ShowDialog();
if (result == true)
{
path = dlg.FileName;
filename = path.Substring(path.LastIndexOf("\\") + 1);
try
{
var size = new FileInfo(path).Length;
Stream output = new FileStream(usbpath + @"SchoolInteligentUSB\WindowFolder\" + filename, FileMode.Create);
Stream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read);
ProgressBar bar = new ProgressBar(fileStream, output, size);
bar.Show();
}
catch (System.IO.FileNotFoundException ex)
{
MessageBox.Show(ex.StackTrace);
}
Application.Current.Properties["Resetingicon"] = true;
}
else
return;
}
示例7: DownloadThread
public void DownloadThread()
{
while (true)
{
if (service.ExistFile())
ewh.Set();
ewh.WaitOne();
Stream stream = service.GetFile(file, 0);
Stream output = new FileStream(service.FilePath, FileMode.Create);
StorageFileInfo[] files = null;
string tempdirectroy = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + "Temp";
files = service.List(null, 0);
double fileSize = 0;
foreach (var f in files)
{
if (this.file == f.VirtualPathk__BackingField)
fileSize = (double)f.Sizek__BackingField;
}
//프로그래스바 ㄱㄱ
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate
{
pb = new ProgressBar(stream, output, fileSize, tempdirectroy, service.FilePath);
pb.getfile += GetFile;
pb.Show();
if (!pb.IsActive)
service.DeleteFile(this.file, -1);
}));
}
}
示例8: OpenFile
protected void OpenFile(object sender, EventArgs e)
{
FileChooserDialog fc = new FileChooserDialog ("Choose the directory containing the hives to open",
this,
FileChooserAction.SelectFolder,
"Cancel", ResponseType.Cancel,
"Open", ResponseType.Accept);
if (fc.Run () == (int)ResponseType.Accept) {
string dir = fc.Filename;
fc.Destroy();
List<Thread> threads = new List<Thread>();
Window window = new Gtk.Window(Gtk.WindowType.Toplevel);
VBox progressBox = new VBox(false, 5);
reading = new Label("Reading hives, please wait...");
pulseBar = new ProgressBar();
progressBox.PackStart(reading, true, true, 0);
progressBox.PackStart(pulseBar, true, true, 0);
reading.Show();
pulseBar.Show ();
progressBox.Show();
window.Add(progressBox);
window.SetPosition(Gtk.WindowPosition.CenterOnParent);
window.SetSizeRequest(500,100);
window.Title = "Loading...";
window.Show();
_hives = new List<RegistryHive>();
_filenames = new List<string>();
foreach (var file in System.IO.Directory.GetFiles(dir))
{
using (BinaryReader reader = new BinaryReader(File.OpenRead(file)))
{
reader.BaseStream.Position = 0;
if (reader.BaseStream.Length > 4)
{
byte[] magic = reader.ReadBytes(4);
if (magic[0] == 'r' && magic[1] == 'e' && magic[2] == 'g' && magic[3] == 'f')
{
_total += reader.BaseStream.Length;
_filenames.Add(file);
}
}
}
}
threads = GetReadThreads ();
foreach (Thread thread in threads)
thread.Start();
new Thread(new ThreadStart(delegate {
foreach (Thread thread in threads)
{
while (thread.IsAlive)
{
Application.Invoke(delegate {
pulseBar.Pulse();
});
System.Threading.Thread.Sleep(100);
}
}
Application.Invoke(delegate {
window.Destroy();
Populate();
});
})).Start();
}
else
fc.Destroy();
}
示例9: displayProgressBar
/// <summary>
/// Display a progress bar for heavy tasks.
/// </summary>
public static void displayProgressBar()
{
progressBar = new ProgressBar();
progressBar.Show();
}