0

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?

Community
  • 1
  • 1
  • IF you don't understand the page you linked, then you lack the knowledge to do it... it's very clear what to do on that post. – Gusman Feb 29 '16 at 18:53
  • See http://stackoverflow.com/questions/27690326/upload-progress-with-post-processing/ – guest271314 Feb 29 '16 at 18:53
  • Take a look at something like SignalR, or other similar web socket frameworks for pushing real-time updates from the server back down to the browser. A background task on the server can notify an endpoint in the page's JavaScript code of updates. (You might even be able to have any page on the site listening for updates, so even if the user *does* want to leave the page and do other things you could still have a progress indicator on every page.) – David Feb 29 '16 at 18:53
  • I've pumped in SignalR, but I feel like I forgot a step. The javascript for SignalR is breaking the entire page. '' – Zero Serenity Mar 01 '16 at 19:17

0 Answers0