当前位置: 首页>>代码示例>>C#>>正文


C# ComponentModel.BackgroundWorker类代码示例

本文整理汇总了C#中System.ComponentModel.BackgroundWorker的典型用法代码示例。如果您正苦于以下问题:C# System.ComponentModel.BackgroundWorker类的具体用法?C# System.ComponentModel.BackgroundWorker怎么用?C# System.ComponentModel.BackgroundWorker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


System.ComponentModel.BackgroundWorker类属于命名空间,在下文中一共展示了System.ComponentModel.BackgroundWorker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的System.ComponentModel.BackgroundWorker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。