|
Dear friend
Thanks for reply ..
sorry i did not notice that the code it not visible .... i have edited now ...
By
Joe
|
|
|
|
|
Hi,
I want to provide automatic file download when the user clicks on a (hyperlink)button. Can someone shed a light on how to specify URI correctly for the file protocol in the following code:
private void FileDownload_Click(object sender, RoutedEventArgs e)
{
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("file:///1.zip"), "_blank");
}
It works fine when I use the absolute file path. But how do I specify the relative file path, because I don't know the absolute path on the hosting server?
Thanks,Best,
Jun
|
|
|
|
|
Hi Jun,
If you specify UriKind.Relative in the Uri constructor, it will be relative to the page hosting your Silverlight app.
System.Windows.Browser.HtmlPage.Window.Navigate(
new Uri("SubDirectory/TextFile.txt", UriKind.Relative), "_blank");
Cheers,
Daniel
|
|
|
|
|
Thanks, Daniel. It works.
One side note, though. I couldn't make the complete format work:
System.Windows.Browser.HtmlPage.Window.Navigate(
new Uri("file://SubDirectory/TextFile.txt", UriKind.Relative), "_blank");
It appears that if I use "file://", I must quote the absolute path.Best,
Jun
|
|
|
|
|
Hi,
I have build a silverlight site and uploaded it to my hostint server "DiscountASP.NET". The IP is "www.entribute.com". I can browsw it from my development machine without any problem. However, when I visit it from another Vista PC, I got a "Could not download the Silverlight Application" error. Many posts say it is a MIME type issue on the server, but why can I open it fine from my development machine?
Thanks,Best,
Jun
|
|
|
|
|
I just tried it from here using IE6. I can get to my Silverlight sites no problem but yours gives the following error:
Line: 56
Char: 13
Error: Unhandled Error in Silverlight 3 Application
Code: 2104
Category: InitializeError
Message; 2104 An error has occurred
Code: 0
URL: http://www.entribute.com/
|
|
|
|
|
Ok, I have figured it out. It seems that the path for the compressed source code should be
<param name="source" value="ClientBin//EntributeSilverlight.xap"/>
not
<param name="source" value="ClientBin/EntributeSilverlight.xap"/>
Both work well on the local host but only "//" works on the hosting server.
Thanks,Best,
Jun
|
|
|
|
|
Hi,
We have a strange problem. Our WPF C# application is run on many different Windows OS. At the moment we perform sleep/resume tests and it work fine on all OS but not on XP 64 bit. We get strange crashes on different places in the code. When enter sleep state our application sometimes crashes, and I can't get to usefull information from the crash log. We have try catch arond the running threads but we cant catch the exception.
System.ArithmeticException: Overflow or underflow in arithmetic operation.
Data: System.Collections.ListDictionaryInternal
Source: WindowsBase
TargetSite: System.Object.Invoke(System.Windows.Threading.DispatcherPrioritym System.Delegate, System.Object)
Has also got TimeSpan exception get_TotalMilliseconds()
Source: mscorelib
But I cant see that milliseconds can be a strange value?
I get a some different exceptions. And not a useful stacktrace.
Anyone who have some smililar problems?
Regards
Olofmodified on Thursday, February 25, 2010 5:48 AM
|
|
|
|
|
Hi. Any silverlight I put in my page cover's every other element on the page(even if that element is z-indexed to be in front). This only happens in IE.
I remember having a similar problem with Flash but cant find a SL equivalent solution. Someone suggested setting Windowless to true. But that disabled the silverlight so you couldnt click in it.
ThanksStrive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
|
I have this
But when I set display to block to show the div the silverlight box is just white, with no content loaded. Even if I set the div to block to start with(in which case the SL box works) then hide it and display it again, the SL still doesnt work.
I need to be able to hide and show silverlight clientside.
ThanksStrive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
Hey guys does anyone know a good book in wpf(blend) on problem solution method ? like wrox books. I searched
but found nothing useful please post a link ( Torrent or rapidshare)
|
|
|
|
|
Can anybody see what's going wrong here? I get an empty grid with a blank row for each item in the ObservableCollection .
<Custom:DataGrid Width="454" Height="396" Canvas.Left="8" Canvas.Top="4" Name="gridEvents" FontWeight="Bold" FontFamily="Nina"
AutoGenerateColumns="False" SelectedIndex="0" FontSize="10.667" >
<Custom:DataGrid.Columns>
<Custom:DataGridTextColumn x:Name="dgCol_EVStatus" Header ="Status" FontWeight="Normal" IsReadOnly="True" />
</Custom:DataGrid.Columns>
</Custom:DataGrid>
and
dgCol_EVStatus.Binding = new System.Windows.Data.Binding("Status");
ObservableCollection<RIAudit> _Audits = new ObservableCollection<RIAudit>();
_Audits.Add(auditRec);
gridEvents.ItemsSource = _Audits;
|
|
|
|
|
redivider wrote: AutoGenerateColumns="False"
I think you want "AutoGenerateColumns="True""
corrected spelling
My bad I did not read the entire thing obviously. You don't need the Autogeneratecolumns since you describe one already. But what happens if you let the grid autogenerate the columns for you? And/or the grid might not understand how to display an RIAudit object.Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
modified on Tuesday, February 23, 2010 5:34 PM
|
|
|
|
|
Hmmm.. Figured something aggravating out. RIAudit, out of necessity, uses public properties, instead of accessors. If i change
public string Status;
to
public string Status {get; set;}
then WPF is happy (though the object-ralational database i use is not).
I guess I'll have write a wrapper for RIAudit, unless someone knows how to get around this. ??
|
|
|
|
|
Every one of us has downloaded dozens of executable files from the Web, but for the life of me I can't find out how this is done. Every time you go to a commercial site that offers software for free or for sale, you can click on a download button and a standard dialog with the title, "File Download - Security Warning," pops up with Run, Save, and Cancel buttons.
What do you have to do to bring up this dialog? This obviously isn't a Silverlight-specific question, but searching the general Web forums mysteriously don't seem to answer this question, either. But I have to get this standard dialog coming up from my Silverlight app. If you could just point me to the right subject in a book somewhere, I'd be eternally grateful.
I know there are security issues about downloading executable files. Nevertheless it's done all the time, through this standard "File Download - Security Warning" dialog that is undoubtedly available through thousands of Websites. I don't understand why this seems to be such hidden knowledge. I have several books on Website development and there isn't a word about this in any of them. Where is it actually documented how to do this?
|
|
|
|
|
This shouldn't be difficult for someone whose been a programmer for as many years as you!
|
|
|
|
|
Richard Andrew x64 wrote: This shouldn't be difficult for someone whose been a programmer for as many years as you!
I've never done any Web programming. Silverlight is my first exposure to it. It's been desktop programming for me ever since I landed my first job that required development for a PC back in 1988. Now desktop programming is passé and I need a new career.
I went to the bookstore today and looked through a bunch of ASP.NET books and Website development books and couldn't find a single one that mentioned this standard "File Download - Security Warning" dialog. If you know the answer, please let me know what it is. Evidently I don't even know the technology that puts out this dialog, so I don't know what kind of a book to look in for the answer.
I also read about the Silverlight SaveFileDialog class, hoping it would give me something like what I need, but the examples I'm seeing are very confusing. I was hoping I would be able to get a Stream from a file on my Website and be able to call some function in the SaveFileDialog class that would let me feed that stream into a file I would browse to with the SaveFileDialog.ShowDialog method, and then save the file with that stream, but evidently that's not how it works. There isn't even a Save method in this class, only an Open method. The OpenFileDialog class has methods like Create and OpenWrite but they are restricted for internal use only.
All I want is hint of where to look to do the research. I don't even know what I should be studying.
|
|
|
|
|
I apologize for my sarcasm, but it seemed funny at the time.
As far as I know, the dialog box you're talking about is the duty of the browser to show.
The web server simply serves the file, with its associated MIME type being listed in the HTTP headers.
Now, if the browser sees that it is not a file used for rendering a web page, first it looks to see if it has a registered handler for that type of file. For instance, a WAV file would trigger the browser to launch Media Player.
If there is no registered handler for the specific type of file, then it would open the Save As dialog box.
|
|
|
|
|
I don't know Silverlight, but I would guess that it's probably up to you to implement and launch the Save As dialog box yourself.
When you want to download the file in question, open an HTTP connection to the URL, then once you have that, launch the Save As dialog box for the user to choose a location to save the file.
Then all you have to do is alternately read the network stream and write the file.
|
|
|
|
|
There is a SaveFileDialog class in Silverlight, but it doesn't do what you're speculative Save As dialog would do. I believe I have to read about Isolated Storage and the ways around it.
I believe I know how to download a System.IO.Stream from my Website. The problem then is saving that stream outside of Isolated Storage, which is a security violation. But there must be a way to ask to do that, which forces out the "Download File - Security Warning" dialog. I just have to figure out how to do that.
|
|
|
|
|
I'm not the expert on Silverlight, but I would suspect that the only way to break out of Isolated Storage is by installing your application as a full-trust app, which is not possible for a web application.
Read about the different trust levels, that may provide some clues.
|
|
|
|
|
I know that Websites successfully download executable files all the time. Any Website that sells its programs where you can download them right there on the spot does it. There's nothing special the user has to do to enter the Website. All they have to do to get the download is to go through the "Download File -- Security Warning" dialog.
Maybe there is no way around it if all your Website programming is in in the Silverlight app, which runs on the client. But Silverlight doesn't have to be the whole site. It can just be part of it. I have developed a commercial desktop program that I want to sell through the Web, and I have contracted a Website developer that is doing the bulk of the Website programming for me (since I'm out of my league there). He can't figure out how to download my installation program, which we've uploaded to the Website itself. He says he's "still working on it." I was just fishing around up here to see if anyone had any ideas.
Turns out I was probably asking the wrong question. Unfortunately, I still don't know what the right question is.
|
|
|
|
|
Well let's be clear, it's not the website that's downloading the file when you purchase a program over the net.
It's the user and his browser who is downloading the file. That's why the system allows you to save the file anywhere you want, because it's you doing it.
On the other hand, your Silverlight app is restricted in where it can save files because it's not under the direct control of the local user, and it could very well be malicious. ( Not that yours is malicious, just saying...)
Maybe there is a way you can have your app direct the browser itself to the URL from which it can download the file, and that would provide the functionality you seek.
|
|
|
|
|
This isn't a Silverlight problem. I have to put a regular HTML page behind our Silverlight Download button.
|
|
|
|