Objective: Find a quick and dirty way to have a method report progress.
Background
I've been asked to take a currently long running process and prevent the user from interrupting it by being able to click anywhere. A lockout screen has been implemented (simply blanketing the canvas with a progress box) and sofar is working well. However, I've been asked to add more to it by giving a progress indicator on this lockout screen. Three Integers will be the values I can use (Success, Fail, Items sent).
Research
The problem I'm having is not knowing how to ask the question in Bing to get the sort of answer I'd like. A lot of answers keep coming back referring to SQL reporting, WinForms (which I already know how to do with BackgroundWorker) or just something unrelated. The closest I've come is here but the answer is "Use AJAX" which is a bit too unspecific but I think I get what its suggesting.
Code Clips
First I'll explain the process that's being called. This first one is the moment the method is called. I think I understand the code here, but it feels like a 1:1 relationship of "Here's data, get back to me when you're done." In view:
$.ajax({
url: '@Url.Action("ThisPage", "Home")',
cache: false,
type: 'POST',
data: form.serialize(),
success: function (data) {
*Clip*
},
error: function () {
*Clip*
}
});
Second, this piece is the Controller section. I've cut it down to the bare essentials so the code is inexact.
public String ThisPage(FormCollection ThisPage)
{
Int32 SucessfulCreations = 0; //The Sucess Variable
Int32 UnsucessfulCreations = 0; //The Fail Variable
List<var> FilteredResults; //Count them up for Items Sent
FilteredResults.ForEach(x=>{
if (x.Pass){
SucessfulCreations++;
}
else{
UnsucessfulCreations++;
}
});
So I have variables I would like, its just how do I get them? Do I have to change the scope? I think I do.
Attacking a solution
I have really no idea where to begin.
Conclusion
I feel like I'm staring at a flat climbing surface that I have no idea where to grip first. Now what?