Modify .xap file before silverlight ie plugin loads it - c#

Q1) How to get notified about the .xap file has started downloading and finished?
Q2) Are there any specific api's that start loading the xap file inside the ie environment?
References to programming examples are welcome.
I need the information to make text translation possible within silverlight application.
Thanks in advance.

Answer 1 : There is no such event to check if application is downloaded or not. It depends on browser and network speed.
Its treated as simple file to the browser. Someone asked this question before also
How do browsers handle caching of XAP packages?
Answer 2: Nopes there is no specific API, its browser which does the download and treat it as a file
What type of translation you are looking for?
Localisation?
Probably try out WebService API to do wonders.

Related

Is it possible to run exe file with silverlight c# or javascript on client side?

Is it possible to run a .exe file on client side with Silverlight.
Or with javascript or something other.
Thanks
Assuming you mean from the context of a remote domain, most definitely not. Think of the ease with which you might deliver a virus by such a mechanism.
In general no - it would be a huge security hole.
It might be possible for specific browser using plug-ins or ActiveX components (in Internet Explorer) that add such a feature - that will leave the browser very exposed though.
See also this - one of the answers there suggest a clever trick if you want to start from the browser an application that you have control over: have the application installer associate a file extension with its EXE, and then you download from the browser a dummy file with that extension.
Yes, But not seemlessly and not cross browser
Browsers are specifically designed to prvent this sort of thing but....
You can do it in internet explorer through activex javascript
function runApp()
{
var shell = new ActiveXObject("WScript.shell");
shell.run("notepad.exe", 1, True);
}
You might be able to do it via plugin with firefox and chrome, but I don't know and I wouldn't be surprised if you can't

How to detect when a user start downloading a file in a browser?

I'm trying to understand (and possibly implement) how some file downloaders detect a download in my browser and automatically start downloading in replacement of the browser internal download module. Any idea how it's done especially related to C# or Java coding ?
In Firefox, download managers are implemented as Extensions (plug-ins). A good starting place would be here

Folder explorer options

I have recently been assigned a task which sounded relatively simple!
Upon attempting it became clear it wasn't as straight forward as i first imagined!!!
I am trying to download multiple files to one location on the users machine. They select these files from lists within a custom share-point web part. Thats the bit i have managed to get working! The downloading is done via WebClient (System.Net.WebClient)
I now want to allow the user to select a location on their local machine to download the files to.
I thought i would be able to use but after attempting this i realized i can only pick files :( in order to get the desired location which will confuse the user
I want something similar to the above but i only need it to return a path location like c:\Temp or any other location the user prefers on their local machine.
Could anyone suggest a control that could provide this functionality. It can also be a share-point control.
In the meantime I will be attempting Tree view as i have never used these before and these may have the power to do this from what i have read
Cheers
Truez
Clarity on language ASP.NET
Unfortunately, you can't do this without some kind of active content, like a Flash control or spit activeX /spit.
It seems strange at first, but you have to consider that this kind of functionality would let a site discover the structure of anyones storage devices; this is not 'a good thing'™
However, perhaps a different approach might solve the problem?
Why are you using WebClient, can't you provide the link to the client and let them choose their own download folder ?
I ended up zipping the files in to one folder and passed the file to be downloaded through the browser! Thanks for your comments!

Online updating a C# program

Greetings,
I'm sorry if this question has been asked already. I've tried using the search function but couldn't find any answer that suited my situation.
I have a real simple C# form application of only 1 file, a exe.
I distributed this currently by 4shared where people can download it as pleased.
However, every time I make changes to the program people will have to download the new version from 4shared.
Now this isn't a ideal situation and I'm a noob when it comes to creating upgrade but the situation I wish is that the program looks at a website / ftp server where I deploy a new version.
I'm looking for a way inside my program to look at the file on that website / ftp server and decide wether there's a new version available.
If there is a new version available in the website / ftp server I would like for the program to update itself to the newest version.
Hope you guys can help me out with this and I hope I explained my situation enough !
NetSparkle is a nice alternative to click-once with more deployment options. http://netsparkle.codeplex.com/
Have a look at ClickOnce. It will do this for you.
When I'm developing and publishing such applications, I usually do it the following way:
Develop a .NET Windows Forms application
Develop a tiny ASP.NET application with an ASMX web service.
Publish the ASMX web service to my public web site.
Add a WSDL reference for the web service to my Windows Forms application.
Create a setup (I prefer Unicode NSIS over ClickOnce).
The logic I implement in the SOAP web service is basically a single function:
[WebMethod]
public string CheckUpdateAvailable( string currentVersion )
{
...
}
The Windows Forms application calls this method (e.g. from a background thread upon program start), passing its current assembly version as a string to the function.
The WSDL function in turn checks the passed version against the newest setup version (e.g. being stored inside web.config or extracted live from the setup.exe on the server). If a newer version exists, it return a string with the URL to download from; otherwise it returns NULL.
When the caller of the WSDL function gets a non-NULL string, it can show a message to the user, asking whether he wants to download and install the executable and then simply execute the URL (via Process.Start).
WyUpdate is the way to go here. We've been using it for over a year with great results (they have excellent support too).
It actually uses patches to update files so that when a 5MB executable only has a small change, the client only has to download a file in the order of kilobytes.
They supply an automatic update component for either Windows Forms or WPF that looks nice and works great.
You can host the update files on either an FTP server or a normal website without any server-side configuration.
There's plenty more to it, and the best place to start is with their video tutorial of how to set up an update.
Here's an open-source library I wrote to address specific needs we had for WinForms and WPF apps. The general idea is to have the greatest flexibility, at the lowest overhead possible. All you'll have to do is create an update feed and reference the library from your app.
So, integration is super-easy, and the library does pretty much everything for you, including synchronizing operations. It is also highly flexible, and lets you determine what tasks to execute and on what conditions - you set the rules (or use some that are there already). Last by not least is the support for any updates source (web, BitTorrent, etc) and any feed format - whatever is not implemented you can just write for yourself.
Cold updates (requiring an application restart) is also supported, and done automatically unless "hot-swap" is specified for the task.
This all boils down to one DLL, less than 70kb in size.
More details at http://www.code972.com/blog/2010/08/nappupdate-application-auto-update-framework-for-dotnet/
Code is at http://github.com/synhershko/NAppUpdate (Licensed under the Apache 2.0 license)
I plan on extending it more when I'll get some more time, but honestly you should be able to quickly enhance it yourself for whatever it currently doesn't support.

Invoke client side MS Word - VS2008/C#3.0

I have a asp.net web site. I want to invoke MS word on a Client machine. Is there any easy way to do this with VS2008, C#3.0?
I can do this with Qt and with an ActiveX control but trying to avoid going this way...
would silverlight be a way to go?
You want to execute an application from the browser (without the evil ActiveX things, of course)?! If you could do that, probably you could wipe off the whole disk too.
And no, Silverlight runs in a partially trusted sandbox. It won't run unmanaged executables on the client machine.
If you are just trying to get Word open to view a document, you could just give your user a link to the .doc/.docx file and their browser would take care of opening the file. If you want to interact with Word, you're going to have a hard time doing that from the browser without using ActiveX.
Silverlight has the same locked down sandbox environment that the web browser has, so that won't help you get around this security limitation.
What are you trying to do with Word? Even if you could launch the app, I don't think you could do any kind of COM interaction from within your web page.
An easy way to merely launch Word would be to have the user download a Word file, but I don't think that's what you're asking and they might not open the file -- they could choose to save it instead.

Categories

Resources