Managing Download File By Using Win Services? - c#

i am trying to make a window service that will monitor and manage download files from different web pages.....
can some one give me direction where should i start looking ......
currnetly i am trying to understand nagios monitoring windows http://nagios.sourceforge.net/docs/3_0/monitoring-windows.html in which they have given some details related to my work
the thing which i have to do is ,
monitor and manage download file
give a custom name to the download file at saving time
and display save dialog box for specifying the location
currently i am making window service on Win XP but i would like this service to run also on other Win Operation Systems too so do i have to do some special setting for making it compatiable with other windows operation systems ??
thanks in advance
Regards,
NewbieFreak

A .NET windows service will run on any windows platform that supports and has the runtime your service targets installed on it.

Related

Architecture to build an application to extract data from database and write to a file. Application should be schedulable

We need to upgrade a current Windows application that extracts data from a remote Oracle database and writes it to a text file on the local disk. This application will be scheduled to run at specific time.
Right now we have a Windows forms application with config file and using ADO.net and direct sql statements in the code first built using VS 2005.
What is the optimal upgrade path given we have Visual Studio 2015 and Windows server 2016.
Can this be accomplished using other than Windows form Application? Thankyou!
One way to do this would be to try to move the logic to a console application and then use the Windows Task Scheduler.
You could also use a Windows Service for this: Windows Service to run a function at specified time
Personally, I think that the Windows Task Scheduler with a console application would likely be easier. (That's just my opinion, though).
Otherwise, you could use UI Automation for this, but it would be a little annoying. (There are other ways of doing this kind of automation that can be found on Google; I suggest searching on "how to automate a Windows Forms application" if you'd prefer to use a different way to do this).
A couple other references:
how to automate some actions on Windows form Application?
How to Automate simple Windows Form Application using MSAA?

Stop/cancel active file processing in C#

I have an Windows service.It uses Filewatcher API to watch for any new files and start processing the file.
Suppose If i want to stop the file processing during runtime (Note I want to stop the active file processing)how can I do that from any external windows application.
Note: Already I am communicating with the windows service from the external windows application
Communicate to the windows service to stop processing and set FileSystsemWatcher.EnableRaisingEvents to false. When you want to continue processing, communicate to the service and set it back to true.
Without more detail about how you're actually communicating between processes, I can't provide much more detail.
If you external application is a .NET windows application, please refer to the following SO Question
How to send a custom command to a .Net windows Service from.Net code?

Launch Windows Explorer from Metro style app

I would like to download a file to the DownloadsFolder in a Windows Store App. And then I'd like to bring up a Windows Explorer open on the DownloadsFolder (actually on the folder I create in the DownloadsFolder)
But I can't figure out how to do it.
This stackoverflow question Launching a Desktop Application with a Metro-style app suggests using Launcher.LaunchUriAsync. But the documentation claims:
You cannot use this method to launch a URI in the local zone. For example, apps cannot use the file:/// protocol to access files on the local computer. Instead, you must use the Storage APIs to access files.
And indeed, I was trying to use the "file:" protocol to bring up the explorer window. When I did try this mechanism Launcher.LaunchIUriAsync fails.
If the browser can do this, why can't I?
Is there a way for me to bring up windows explorer, or is that outside the real of possibility?
I don't think you can launch the Windows Explorer from metro. One thing you can use, however, is the File Picker.
http://code.msdn.microsoft.com/windowsapps/File-picker-app-extension-0cb95155
If you're willing to have some non-Windows Store components in your solution, there is a workaround for this. Although you can't launch a process directly, you can always run a HTTP listener inside a Windows service which listens for commands from your sandboxed Windows Store (Metro-style) app and launches Explorer (or any other process) for you. A trivial way to do this would be a Web API service inside a Windows service - just implement the GET action in your controller and have arguments for the executable to launch and optionally executable arguments as well.
This is kind of doing an end-run around the sandbox security, though, so you might want to have a tailored Web API instead which just launches a pre-packaged set of apps (like Explorer or one of your own apps).
Of course, for consumer apps this is not a good solution because you can't just install everything from the Windows Store. For LOB apps, though, it's not a bad compromise because you typically have more control over the environment. This is a good way to surface some metrics or other data into a live tile and have your desktop app launch when the tile is clicked. Whether or not this makes for a good user experience is a totally different conversation.
BatRT allows you to run batch file commands from WinRT applications. It utilizes URI calls. This can be used to open up applications or perform file operations.

How to Port or Convert existing Windows Store App(Metro Style) to Desktop App?

I have an existing App in Windows store(Metro Style)[XAML,C#]. I would like to convert this to Desktop(Ultra-book enabled ) and upload in to the Intel AppUp Store.
The application uses GPS and call several web API for certain features.
I there any tool to covert? or how could i port this app to Ultra-book enabled desktop app.?
Please provide step by step help or link..
I would check with Intel what APIs they provide for AppUp. I am almost sure though that there are no tools for this and you just need to solve it on a case by case basis.
I don't think there is any tool to convert it for you. Based on my experience with Intel AppUp, if you can extract your metro app functionality and create a normal desktop application for it, you should be able to submit the app in the AppUp store.
You will have to create a msi package for your desktop app and the msi should create a desktop shortcut which can launch your app. The appUp guys somehow figure out the shortcut target and can launch the app from the AppUp client itself. You will also have to take care of uninstallation from the appup interface.

What's the equivalent of the System.Diagnostic.Process on WinRT (C#)?

I need to launch a couple of commands from my WinRT application, like if it were a Command Console, in order to do this, on not WinRT apps the class to be used is System.Diagnostic.Process but on Win RT his class is not available, is there any equivalent class or method that i could use?
Thanks in advance :)
Windows Store Apps cannot launch other processes directly, as Marylin already said. You can only use Launcher.LaunchFileAsync to launch the default application for the file type (file ending) the passed file has. Using this you could define a self-defined file type like .process in Windows and set its handler application to a windowless desktop application you write. The desktop application reads the process file which has the path to the application stored that is to start and launches it using Process.
This trick would certainly fail the certification but may be useful in apps you deploy to businesses skipping the Store.
A problem would be that the Windows Store App is set to the background if a Desktop application is launched. I think this is one reason that Microsoft does not allow it for certified apps.
You cannot do that from a Windows Store application - those are sandboxed and do not have access to other processes. More details here.

Categories

Resources