本文整理汇总了C#中System.ComponentModel.BackgroundWorker类的典型用法代码示例。如果您正苦于以下问题:C# System.ComponentModel.BackgroundWorker类的具体用法?C# System.ComponentModel.BackgroundWorker怎么用?C# System.ComponentModel.BackgroundWorker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.ComponentModel.BackgroundWorker类属于命名空间,在下文中一共展示了System.ComponentModel.BackgroundWorker类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SendToWebSevice
public SendToWebSevice()
{
SendVdxFile = new System.ComponentModel.BackgroundWorker();
SendVdxFile.DoWork += new System.ComponentModel.DoWorkEventHandler(SendVdxFile_DoWork);
SendVdxFile.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(SendVdxFile_RunWorkerCompleted);
}
开发者ID:SiteView,项目名称:ECC8.13,代码行数:7,代码来源:SendToWebSevice.cs
示例2: RoseHAService
public RoseHAService()
{
backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
backgroundWorker1.WorkerReportsProgress = true;
backgroundWorker1.WorkerSupportsCancellation = true;
backgroundWorker1.DoWork += backgroundWorker1_DoWork;
}
开发者ID:capturePointer,项目名称:QQhooker,代码行数:7,代码来源:RoseHAService.cs
示例3: SendRequest
public void SendRequest(string postRequest, Microsoft.Phone.Controls.PerformanceProgressBar performanceProgressBar)
{
var bw = new System.ComponentModel.BackgroundWorker();
bw.DoWork += (s, args) => // This runs on a background thread.
{
System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
{
performanceProgressBar.IsIndeterminate = true;
performanceProgressBar.Visibility = System.Windows.Visibility.Visible;
});
this.parameters = postRequest;
this.request = WebRequest.Create(new Uri("http://192.168.1.71:8080/MobileApplication/mythapi")) as WebRequest;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.BeginGetRequestStream(ReadCallback, request);
};
bw.RunWorkerCompleted += (s, args) =>
{
// Do your UI work here this will run on the UI thread.
// Clear progress bar.
performanceProgressBar.IsIndeterminate = false;
performanceProgressBar.Visibility = System.Windows.Visibility.Collapsed;
};
bw.RunWorkerAsync();
}
开发者ID:asdForever,项目名称:GeneralThings,代码行数:26,代码来源:Networking.cs
示例4: ThumbnailCreator
/// <summary>
/// Initializes a new instance of the <see cref="ThumbnailCreator"/> class.
/// </summary>
/// <param name="tnSettings">The <see cref="ThumbnailSettings"/> to use.</param>
/// <param name="worker">The <see cref="System.ComponentModel.BackgroundWorker"/>worker to use.
/// </param>
public ThumbnailCreator(ThumbnailSettings tnSettings, System.ComponentModel.BackgroundWorker worker)
{
this._tnSettings = tnSettings;
this._worker = worker;
#if false
_imageCodec = GetEncoder (System.Drawing.Imaging.ImageFormat.Png);
_qualityParameter = new System.Drawing.Imaging.EncoderParameter (
System.Drawing.Imaging.Encoder.Quality, 75L);
_qualityParameters = new System.Drawing.Imaging.EncoderParameters (1);
_qualityParameters.Param[0] = _qualityParameter;
#else
_imageCodec = GetEncoder (System.Drawing.Imaging.ImageFormat.Jpeg);
_qualityParameter = new System.Drawing.Imaging.EncoderParameter (
System.Drawing.Imaging.Encoder.Quality, 75L);
_qualityParameters = new System.Drawing.Imaging.EncoderParameters (1);
_qualityParameters.Param[0] = _qualityParameter;
#endif
#if false
using (System.Drawing.Bitmap bitmap1 = new System.Drawing.Bitmap (1, 1))
{
System.Drawing.Imaging.EncoderParameters paramList =
bitmap1.GetEncoderParameterList (_imageCodec.Clsid);
System.Drawing.Imaging.EncoderParameter[] encParams = paramList.Param;
foreach (System.Drawing.Imaging.EncoderParameter p in encParams)
{
THelper.Information ("Type {0}, GUID {1}", p.ValueType, p.Encoder.Guid);
}
paramList.Dispose ();
}
#endif
}
开发者ID:rm2,项目名称:CLAutoThumbnailer,代码行数:40,代码来源:ThumbnailCreator.cs
示例5: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(422, 326);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// backgroundWorker1
//
this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
//
// FMV
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(422, 326);
this.Controls.Add(this.pictureBox1);
this.Name = "FMV";
this.Text = "FMV";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FMV_FormClosing);
this.Load += new System.EventHandler(this.FMV_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
开发者ID:Ermelber,项目名称:EveryFileExplorer,代码行数:38,代码来源:FMVViewer.designer.cs
示例6: MyButton_Click
void MyButton_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (_worker != null)
{
_worker.CancelAsync();
_worker = null;
this.Content = _previousContent;
}
else if (MyOnClick != null)
{
_previousContent = this.Content;
_worker = new System.ComponentModel.BackgroundWorker();
_worker.WorkerSupportsCancellation = true;
_worker.WorkerReportsProgress = (MyOnProgress != null);
_worker.ProgressChanged += worker_ProgressChanged;
_worker.RunWorkerCompleted += worker_RunWorkerCompleted;
_worker.DoWork += delegate(object s, System.ComponentModel.DoWorkEventArgs args)
{
try
{
MyOnClick(this, _worker);
}
catch (Exception ex)
{
System.Windows.MessageBox.Show(ex.ToString(), ex.Message);
}
};
this.Content = "Cancel";
_worker.RunWorkerAsync();
}
}
开发者ID:atesio,项目名称:MyMusicTagger,代码行数:31,代码来源:MyButton.cs
示例7: LoginWindow
public LoginWindow()
{
InitializeComponent();
this.loginBackgroundWorker = new System.ComponentModel.BackgroundWorker();
this.loginBackgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(loginBackgroundWorker_DoWork);
this.loginBackgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(loginBackgroundWorker_RunWorkerCompleted);
}
开发者ID:ziyan,项目名称:reactivity,代码行数:7,代码来源:LoginWindow.xaml.cs
示例8: InitializeListener
public void InitializeListener()
{
SocketWorker = new System.ComponentModel.BackgroundWorker();
SocketWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.SocketWorker_DoWork);
Listener = new Listener();
Listener.OnReceiveCommand += Listener_OnReceiveCommand;
}
开发者ID:whins,项目名称:FSAgent,代码行数:7,代码来源:Tray.cs
示例9: B_BaseBot
public B_BaseBot(String module_name, bool active = true)
{
this.module_name = module_name;
bw = new System.ComponentModel.BackgroundWorker();
bw.DoWork += new System.ComponentModel.DoWorkEventHandler(bw_DoWork);
if (active)
writeToMainLog("Module loaded!");
}
开发者ID:WildGenie,项目名称:D3_Bot_Tool,代码行数:8,代码来源:B_BaseBot.cs
示例10: InitializeAgent
public void InitializeAgent()
{
AgentWorker = new System.ComponentModel.BackgroundWorker();
AgentWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.AgentWorker_DoWork);
Agent = new Agent();
Agent.OnCallStateChanged += Agent_OnCallStateChanged;
Agent.OnAccountStateChanged += Agent_OnAccountStateChanged;
}
开发者ID:whins,项目名称:FSAgent,代码行数:8,代码来源:Tray.cs
示例11: TVDBLoader
public TVDBLoader(AbstractRepositoryFactory _repositories,
System.ComponentModel.BackgroundWorker _worker,
System.ComponentModel.DoWorkEventArgs _eventArgs)
{
repositories = _repositories;
worker = _worker;
eventArgs = _eventArgs;
}
开发者ID:Tarkeel,项目名称:TVTracker,代码行数:8,代码来源:TVDBLoader.cs
示例12: MainWindow
public MainWindow()
{
m_game.AddSubscriber(this);
InitializeComponent();
worker = new System.ComponentModel.BackgroundWorker();
worker.DoWork += new System.ComponentModel.DoWorkEventHandler(DoWork);
}
开发者ID:henceee,项目名称:1dv607_2015,代码行数:8,代码来源:MainWindow.xaml.cs
示例13: CanTestContentsOfList
public void CanTestContentsOfList()
{
var worker = new System.ComponentModel.BackgroundWorker();
var list = new System.Collections.Generic.List<int>();
worker.RunWorkerCompleted += delegate { list.Add(1); };
worker.DoWork += delegate { Thread.Sleep(1); };
worker.RunWorkerAsync();
Assert.That(list, Has.Count.EqualTo(1).After(5000, 100));
}
开发者ID:Buildstarted,项目名称:ContinuousTests,代码行数:9,代码来源:AfterConstraintTests.cs
示例14: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.backgroundWorker = new System.ComponentModel.BackgroundWorker();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.label = new System.Windows.Forms.Label();
this.btnCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// backgroundWorker
//
this.backgroundWorker.WorkerReportsProgress = true;
this.backgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker_DoWork);
this.backgroundWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker_ProgressChanged);
this.backgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker_RunWorkerCompleted);
//
// progressBar
//
this.progressBar.Location = new System.Drawing.Point(13, 43);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(483, 18);
this.progressBar.TabIndex = 0;
//
// label
//
this.label.Location = new System.Drawing.Point(13, 9);
this.label.Name = "label";
this.label.Size = new System.Drawing.Size(483, 16);
this.label.TabIndex = 1;
this.label.Text = "Please wait for the task to complete.";
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(206, 73);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// BackgroundWorkerDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(508, 108);
this.ControlBox = false;
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.label);
this.Controls.Add(this.progressBar);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "BackgroundWorkerDialog";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = " Cinar Database Tools";
this.TopMost = true;
this.ResumeLayout(false);
}
开发者ID:fizikci,项目名称:Cinar,代码行数:61,代码来源:BackgroundWorkerDialog.designer.cs
示例15: AddUser
public AddUser()
{
InitializeComponent();
bw = new System.ComponentModel.BackgroundWorker();
bw.WorkerReportsProgress = true;
bw.RunWorkerCompleted += bw_RunWorkerCompleted;
bw.DoWork += bw_DoWork;
bw.ProgressChanged += bw_ProgressChanged;
}
开发者ID:FuujinTheHacker,项目名称:LoM,代码行数:9,代码来源:AddUser.xaml.cs
示例16: ExportingDialog
public ExportingDialog(iMetaLibrary.Scanners.MovieScanner MovieScanner, iMetaLibrary.Scanners.TvScanner TvScanner)
{
this.Build ();
notebook1.ShowTabs = false;
notebook1.ShowBorder = false;
bkgWorker = new System.ComponentModel.BackgroundWorker();
bkgWorker.WorkerSupportsCancellation = true;
bkgWorker.DoWork += HandleBkgWorkerDoWork;
System.Timers.Timer pulsar = new System.Timers.Timer(50) { AutoReset = true};
pulsar.Elapsed += delegate {
pbarExporting.Pulse();
};
this.buttonCancel.Clicked += delegate(object sender, EventArgs e)
{
bkgWorker.CancelAsync();
this.Destroy();
};
this.buttonOk.Clicked += delegate(object sender, EventArgs e) {
if(notebook1.Page == 0)
{
string folder = filechooserbutton1.Filename;
if(String.IsNullOrEmpty(folder) || !System.IO.Directory.Exists(folder)){
MessageBox.Show("Invalid export location specfied.");
return;
}
this.buttonOk.Visible = false;
bkgWorker.RunWorkerAsync(new object[] { folder, MovieScanner, TvScanner} );
pulsar.Start();
notebook1.Page = 1;
}
else
{
// final page.
this.Destroy();
}
};
bkgWorker.RunWorkerCompleted += delegate(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) {
pulsar.Stop();
if(e.Result as bool? == true)
{
notebook1.Page = 2;
this.buttonOk.Visible = true;
this.buttonCancel.Visible = false;
}
else
{
notebook1.Page = 3;
this.buttonOk.Visible = true;
this.buttonCancel.Visible = false;
}
};
}
开发者ID:revenz,项目名称:iMeta,代码行数:56,代码来源:ExportingDialog.cs
示例17: XLSLoader
public XLSLoader(string _filename,
AbstractRepositoryFactory _factory,
System.ComponentModel.BackgroundWorker _worker,
System.ComponentModel.DoWorkEventArgs _eventArgs)
{
factory = _factory;
filename = _filename;
worker = _worker;
eventArgs = _eventArgs;
}
开发者ID:Tarkeel,项目名称:TVTracker,代码行数:10,代码来源:XLSLoader.cs
示例18: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.uxMessagesListBox = new System.Windows.Forms.ListBox();
this.uxUpdateLinkLabel = new System.Windows.Forms.LinkLabel();
this.uxCheckerBackgroundWorker = new System.ComponentModel.BackgroundWorker();
this.uxUpdateBackgroundWorker = new System.ComponentModel.BackgroundWorker();
this.SuspendLayout();
//
// uxMessagesListBox
//
this.uxMessagesListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.uxMessagesListBox.FormattingEnabled = true;
this.uxMessagesListBox.Location = new System.Drawing.Point(5, 6);
this.uxMessagesListBox.Name = "uxMessagesListBox";
this.uxMessagesListBox.Size = new System.Drawing.Size(238, 160);
this.uxMessagesListBox.TabIndex = 0;
//
// uxUpdateLinkLabel
//
this.uxUpdateLinkLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.uxUpdateLinkLabel.AutoSize = true;
this.uxUpdateLinkLabel.Enabled = false;
this.uxUpdateLinkLabel.Location = new System.Drawing.Point(121, 172);
this.uxUpdateLinkLabel.Name = "uxUpdateLinkLabel";
this.uxUpdateLinkLabel.Size = new System.Drawing.Size(42, 13);
this.uxUpdateLinkLabel.TabIndex = 1;
this.uxUpdateLinkLabel.TabStop = true;
this.uxUpdateLinkLabel.Text = "Update";
this.uxUpdateLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.uxUpdateLinkLabel_LinkClicked);
//
// uxCheckerBackgroundWorker
//
this.uxCheckerBackgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.uxCheckerBackgroundWorker_DoWork);
this.uxCheckerBackgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.uxCheckerBackgroundWorker_RunWorkerCompleted);
//
// uxUpdateBackgroundWorker
//
this.uxUpdateBackgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.uxUpdateBackgroundWorker_DoWork);
this.uxUpdateBackgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.uxUpdateBackgroundWorker_RunWorkerCompleted);
//
// UpdateForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(247, 190);
this.Controls.Add(this.uxUpdateLinkLabel);
this.Controls.Add(this.uxMessagesListBox);
this.Name = "UpdateForm";
this.Text = "Update";
this.Load += new System.EventHandler(this.UpdateForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
开发者ID:patware,项目名称:QuickyCodeGen,代码行数:59,代码来源:UpdateForm.designer.cs
示例19: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this._backgroundWorker = new System.ComponentModel.BackgroundWorker();
//
// _backgroundWorker
//
this._backgroundWorker.WorkerReportsProgress = true;
this._backgroundWorker.WorkerSupportsCancellation = true;
this._backgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this._backgroundWorker_DoWork);
this._backgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this._backgroundWorker_RunWorkerCompleted);
this._backgroundWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this._backgroundWorker_ProgressChanged);
}
开发者ID:GamehubDev,项目名称:Nin_Online_Unity,代码行数:16,代码来源:ProgressDialog.designer.cs
示例20: CallRC
private void CallRC()
{
//Fix CE 3.6 /refresh command - Launch BackgroundWorker for DeleteDDS
System.ComponentModel.BackgroundWorker bw = new System.ComponentModel.BackgroundWorker();
bw.WorkerSupportsCancellation = true;
bw.WorkerReportsProgress = true;
bw.DoWork += new System.ComponentModel.DoWorkEventHandler(DeleteDDS);
bw.RunWorkerAsync();
Framework.CRYENGINE_RC_Call(m_convertedFilePath + " /refresh" + UserDialogCmd() + GetAdditionalCompressionPreset(), "File " + m_fileName + " succefully send to the Ressource Compiler at " + m_convertedFilePath);
}
开发者ID:Guillaume201,项目名称:Importer-Hub-for-CRYENGINE,代码行数:12,代码来源:CTextureTiffConvert.cs
注:本文中的System.ComponentModel.BackgroundWorker类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论