ASP.Net / C# 4.5 -- Async Processing -- Async Await - c#

I am looking for some direction on what is the best route I should go with this. I have posted a few times, going off of some recommended design patterns. I have not really received a good direction based on what I am trying to accomplish. I am new to working with Async Processing, and would appreciate some pointers in the right direction. So far, on one of my previous post I have been called ignorant because I requested code samples. Please understand I have been reading everything, and trying everything I can find on the internet. Needless to say there are a LOT of different directions I could go with this, and I am not sure which one is the best.
I will explain what I am trying to do, at a high level, and if anyone out there can PLEASE help me by pointing me in the right direction I would appreciate it. Also, if anyone can point me to some code samples, I would love that. I do not mind reading the material, but it makes a lot more sense if I can see code to follow along with what it is saying. Most of the documentation I have found has code samples, or partial code samples, and I have been doing my best to try to use what I have found to work with my specific need. So far, not much luck. I will admit, when it comes to ASYNC processing, I guess I am ignorant. :)
Anyway, here is what I am trying to accomplish. I am leaving out any specific technology that I may consider using to avoid the debate as to if what I am posting is out of date, or behind the times. I am looking for a point in the right direction, and I am open to whatever at this point. I just need to get this working.
Here is the basics of what I am needing to do
I have an ASP.Net Web Site "Project" that I am working with.
I have a screen that is used to print reports using Active Reports 7.
My task is to allow the user to click a "Print / Preview" button and fire off the report processing.
While the report is running, I need to give the user the ability to click a "Cancel" button and terminate the processing and return to the report screen. (So the UI needs to be responsive during this time the report is processing so the user can click on the cancel button.)
While the report is processing I need to display a popup message to indicate the report is running.
When the report finishes processing, I need to hide this popup message, to indicate to the user the report is completed. Then I need to open the report to be viewed by the user. Currently this is a javascript function that we prepare during the report processing code that opens a new window and calls the report viewer. (So after the report has completed I need the ability to call a javascript function.)
If anyone can kindly point me in the right direction I will be very thankful. I do not mind doing the leg work and reading a mountain of documentation. I just need to be able to know what I am looking at will provide me with the above functionality. Like I said earlier, ignorance or not, if I can get some sample working code (not asking anyone to code this for me, just some code I can step through and help to understand what is happening) it would help a lot.
Thanks you in advance for your time and consideration.

Since you want some operation to happen at the server side along with the UI responding and showing progress. Showing progress of the event. I would suggest using Signalr.Net.
http://signalr.net/
http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr
This is a realtime web api and with this you can create a hub which has functions say "ProcessReport" and "cancelProcessing" you can call this from javascript while connection is open on click of the button and show the progress popup with a cancel button. Have a client event registered with the hub in js say "updatestatus" which can be called from the server to close the popup and eventually close the signalr connection, once the operation is finished. And similarly in the popup cancel click you can again call the hub function cancelProcessing and perform your cancellation and call back with updateStatus.
Hope this helps.

Related

Microsoft Service Manager Console API?

I'm having a hard time finding any documentation on how to interact with the SCSM Console.
Almost all samples and documentation I stumble upon, are regarding interacting with the System Center Backend.
My goal is to have a TextBox and a Button, in the TextBox goes an Incident ID, and a click on the button would then open the incident in the SCSM Console.
I don't know if its even possible, does anyone of you have experience with this?
I've worked with the SCSM SDK for 2 years now and have not come across anything within it which would allow you to launch the console and go straight to a particular incident form. The ConsoleContextHelper requires the console to be already open and mainly interacts with the current view/form.
lovedatsnow's suggestion for using a ConsoleTask on the incident view would be the closest way to implement something similar to what you desire however this wouldn't give much advantage over using the search bar and double clicking the result to open the form.
I've walked through Travis Wright's post with success:
https://blogs.technet.microsoft.com/servicemanager/2010/02/11/tasks-part-1-tasks-overview/
Here is a simpler tutorial that may also be helpful
https://blog.jhnr.ch/2013/12/09/how-to-create-a-custom-scsm-console-task-by-using-some-c-and-xml-magic/

UIAutomation, pause application if Help window appears

This is related to my other question.
I used the OnStructureChanged event to detect that the 'Help' window popped up in the 3rd party application that my application is writing data to. I need my application to pause while the end user resolves the data issue in the 3rd party application, then I need my application to resume once the end user closes the 'Help' window. (Either I need to detect that the 'Help' window was closed or I need to display a message box and use the DialogResult to trigger my application to resume).
I've never encountered something like this before. I don't know if it's possible to do what I want to do. If it is possible, I don't know where to start.
Advice?
UPDATES:
I have only used Threading once before and I think it was a fairly "easy peasy" usage, I pulled it off without much effort, considering I'd never used Threading before. I'm playing around with Threading for this issue right now. There's a good chance I've implemented it incorrectly, but my app isn't functioning correctly anymore...I don't know if I'm even playing with the correct tool.
I had to just keep moving with the project - deadlines, you know...
I ended up using UI Automation to detect the "Help" window, then I showed a message box giving instructions to the end user. I check the MessageBox's DialogResult and continue processing based on that. It might not be the "best" way to skin the cat, but I'm a noob and I have a deadline, so I did what I needed to do to keep moving.

can i see real time javascript events like ajax calls in firebug?

So when I do an ajax POST I can see the thing firing in firebug, I can see the spinning icon as it's running, a finished icon when it's done. I can see results or errors and whatnot, you all know the deal.
Is there a way to get it to show me every javascript event as it fires? So if I have something like this in my windows onload:
defaultJs.LoadImages();
defaultJs.CheckAccount(username);
vendorsJs.UpdateSearch();
I would ideally see each of those happening, or be able to step through them similar to how you would step through CS files while you're attached to the WWW process with F10 and F11 and all that.
My problem is how long it takes tracking through another person's code when I'm tasked with finishing the work of another developer that's been moved to another project. I basically have to do what I described manually reading the code, or set up a ton of console.logs to try and force this sort of information into something I can read.
I'm hoping firebug has some feature I haven't enabled, or there's a program like fiddler (where you see things loading realtime) that'll do it for me.
Sorry if this is a repeat question, I wasn't able to find an answer that worked for me after some searching. I appreciate any time anyone commits to helping me out here. Have a good day yall.
you can debug the JS code using FireBug
http://getfirebug.com/javascript

"Click" button of a program from an application I'm building

Boring background:
I have been working with UltraVNC to control some PC's at work and it does the job great but in order to simplify things I created a program that interfaces with it in C#. Basically I take advantage of the commands the viewer offers to connect, control, watch or transmit to each PC.
Problem is anyone can access the PC's since it has one main account (no domain controller). I need everyone to sign for the PC before they can use it, so to make my job easier I open each PC and block the inputs + blank the screen that way there obligated to sign before use.
Opening each pc and press the block button can be hassle especial when you’re helping someone and a user leaves, others come (btw I work at an electronic library). UltraVNC doesn’t have a command for this; it’s been requested but I don’t think it’s much of a priority for them and the code seems very intimidating for a novice like me so I thought I could try a hack to get what I want.
Problem: I want to “click” a button in a program I use, from an application that I am building in c#. I can currently use the process class to get the handle and identify the specific window I want to use but I have no way to find the button handle which I read is what I need. I found stuff about using findwindow and sendkeys for this but I don’t see how that’ll work unless the button had a keystroke assigned to it which it doesn’t.
So can anyone point me in the right direction?
Why not use something like Eficium Cybercafe SurfShop to achieve what you want? After teh user finished you log the session out, and before someone can log in, they have to sign in.

Receive a message FROM another process

I've been teaching myself how to use messages with Window's APIs, and have actually been doing very well learning them. Problem is, I can't figure out how to receive a message from another application to start code within mine.
Essentially, what I want to do is allow others using a commercial application to click the save button (on the commercial application), and have my application stop the save message, prompt the user, and from that either cancel the save to allow them to continue, or allow the save (which I know how to do now through messages).
I just need to know how to catch a message, and stop it. If anyone can point me to an API call, or function, or just documentation that may help, please do.
Check out Detours by Microsoft Research. It's possible, but not simple. Also, look into how client-side game cheats are performed. I will not link any of them here, but they are out there. That's essentially what you want to do.
I think you'll need to attach your own application to the running process the same way a debugger would... Unless the commercial application has a custom method of plugging into their architecture to do this.
The next question is... do you want to proceed down this path.

Categories