backgroundworker

background task with an asp.net web application

喜欢而已 提交于 2019-12-01 12:14:37
Is this the technique to run a background job every x minutes: http://msdn.microsoft.com/en-us/library/system.threading.threadpool.queueuserworkitem%28VS.71%29.aspx So would I load this in the global.asax? I have written a couple of Blogs on background threads http://professionalaspnet.com/archive/2008/08/04/Creating-a-Background-Thread-to-Log-IP-Information.aspx http://professionalaspnet.com/archive/2009/09/21/Communication-With-a-Background-Thread-in-ASP.NET.aspx Another method is to have a page that when accessed, does the task you intend to do. Then you setup some process (a lot of hosting

Exploiting the BackGroundWorker for cross-thread invocation of GUI actions on Winforms controls?

此生再无相见时 提交于 2019-12-01 11:43:36
问题 Inspired by my own experience with multithreaded Winforms applications, as well as questions such as Avoiding the woes of Invoke/BeginInvoke in cross-thread WinForm event handling? Avoid calling Invoke when the control is disposed I've come up with a very simple pattern, whose soundness I would like to verify. Basically I'm creating (and running throughout the application's lifetime) a BGW whose sole purpose is the synchronization of invoke requests. Consider: public MainForm() {

background task with an asp.net web application

只愿长相守 提交于 2019-12-01 11:35:17
问题 Is this the technique to run a background job every x minutes: http://msdn.microsoft.com/en-us/library/system.threading.threadpool.queueuserworkitem%28VS.71%29.aspx So would I load this in the global.asax? 回答1: I have written a couple of Blogs on background threads http://professionalaspnet.com/archive/2008/08/04/Creating-a-Background-Thread-to-Log-IP-Information.aspx http://professionalaspnet.com/archive/2009/09/21/Communication-With-a-Background-Thread-in-ASP.NET.aspx 回答2: Another method is

BackgroundWorker still needs to call Invoke?

ε祈祈猫儿з 提交于 2019-12-01 11:34:20
In the last question Display progress bar while doing some work in C#? , people has recommend use of BackgroundWorker . I thought in BackgroundWorker DoWork method you can update the GUI directly, but why this function call need to be called using Invoke . toolTip.SetToolTip(button, toolTipText); The RunWorkerCompleted callback is marshalled onto the UI thread; DoWork is not. You should use the ReportProgress method to update the UI during DoWork processing. See: How to: Run an Operation in the Background You are mistaken, you can't call the UI thread directly from the handler for the DoWork

Access windows control from Backgroundworker DoWork

风格不统一 提交于 2019-12-01 11:09:55
my issue is the following: I have a windows form in which I've placed a LayoutPanel, when the forms Loads, multiple controls like: textboxes and labels are being added to the LayoutPanel. Then on a button click, I need to process the data entered by the user on those dynamically created controls. For that purpouse I use a Backgroundworker which is supposed to take those controls and read their data. My issue es that the Backgroundworker doesn't allows me to access the control from the DoWork Method, but I need to do it that way because I'll be reporting the progress of the operations. Here are

What is the stack size of a BackgroundWorker DoWork Thread? Is there way to change it?

空扰寡人 提交于 2019-12-01 11:04:39
I know for a C# main program the stack size 1 MB (32-bit and any) or 4 MB (64-bit), see Why is stack size in C# exactly 1 MB? What is the default stack size of the BackgroundWorker DoWork thread? Is there a way to change the stack size of the BackgroundWorker DoWork thread beside creating another thread like the following example: private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { Thread thread = new Thread(delegate() { // do work with larger stack size }, 8192 * 1024); thread.Start(); thread.Join(); } I'm using a BackgroundWorker because I've a Windows Forms application

How to directly access the UI thread from the BackgroundWorker thread in WPF?

只谈情不闲聊 提交于 2019-12-01 11:01:27
I'm creating a backup utility in WPF and have a general question about threading : In the method backgroundWorker.DoWork() , the statement Message2.Text = "..." gives the error " The calling thread cannot access this object because a different thread owns it. ". Is there no way for me to directly access the UI thread within backgroundWorker.DoWork(), i.e. change text in a XAML TextBox at that point? Or do I need to store all display information in an internal variable , and then display it in backgroundWorker.ProgressChanged() , as I had to do with e.g. percentageFinished? XAML: <Window x

How to create an auto-upload Android picture app?

独自空忆成欢 提交于 2019-12-01 10:47:39
I am trying to create an app that automatically uploads a picture to my server . The idea is that a user creates a picture with the native/normal camera and my app gets a notification (catches the event) and uploads the picture (in the background). I found a solution for Windows Phone ( see here ), but not for Android. How can I do this? - Is this technically even possible (with the given APIs) or is it a special feature just for contracted services ( Facebook or Dropbox do that )? Thank you! Right now i don't believe there is a Broadcast that is fired for a camera capture event that other

Best Practice for BackGroundWorker in WinForms using an MVP architecture

只愿长相守 提交于 2019-12-01 09:38:16
问题 I am working on a winforms project. I am implementing an MVP architecture. I have some processing intensive jobs running at the presenter (Reading from file system and performing bulk inserts to a DB). I would like to perform these operations in a background thread without locking up the UI and update controls on my view (progress bar, and datagridview). Should I just access the backgroundworker object within my presenter and handle it's events in the presenter by having the view event

Background Worker How To

ぃ、小莉子 提交于 2019-12-01 09:31:59
I'm trying to implement background worker into my program, so that it wont freeze when i run the program and starts retrieving the data I need. I'm not quite sure how background worker works. Background workers are threads that run in the background and do work without interrupting/blocking your main thread. You can read more here . In quick terms: In DoWork do your blocking operation. Whenever you can, report how far through you are with the operation using (sender as BackgroundWorker).ReportProgress(50); for example to report 50% completion. You can have your main thread subscribe to the