|
In Silverlight 2, the only access you have to the user's local hard disk
is using Isolated Storage:
Silverlight Isolated Storage[^]
Silverlight 3, now in beta, provides a save-file dialog that will allow the user
to select a place you can save the file to. Note that this will still require user
interaction - you won't be able to just write anywhere you want to.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
You can do it using a trick.
Instead of calling the web service, from Silverlight call javascript method that will make an open to a given URL, this URL will point to a custom HTTP handler, then you return your file (implementing a custom HTTP handler it's easy can send you some info or link), you only has to say that the file is an attachment.
In my case I just render e jpeg, js:
function showReportDiagramPopup() {
//http: //www.javascripter.net/faq/openinga.htm
window.open("DiagramRenderPopup.aspx", "DatabaseDiagram", "scrollbars=yes, width=800,height=600", false);
// NOT IN USE, rather using popup
// Finally we are not going to use a popup, we just open the generated image as an attachment
//window.location = "DiagramImageHandler.ashx"
}
In Silverlight:
public void ShowDiagramImageRenderPopup()
{
System.Windows.Browser.HtmlPage.Window.CreateInstance("showReportDiagramPopup");
}
HTH
Braulio
/// -------------------------
Braulio Díez
DBSchemaEditor.com
Free Silverlight based DB Schema Modeling Tool
/// -------------------------
|
|
|
|
|
It seems that RoutedEvent is quite similar with event. Is it true that we can do anything by event instead of RoutedEvent? If it is true, what is the advantage of RoutedEvent?
|
|
|
|
|
mildred-frontfree wrote: It seems that RoutedEvent is quite similar with event.
Which "event" are you referring to ?
Routed events are very powerful UI events. They are flexible enough to be placed at any place in the Element tree and handled by any other element. You can have a set of buttons and all the clicks handled at a common root. Also, there are scenarios like EventTriggers in XAML which only work with Routed events.
More information here[^]
|
|
|
|
|
Well, let me explain myself a little bit clear. On msdn there is a example like this.
<br />
public class MyButtonSimple: Button<br />
{<br />
public static readonly RoutedEvent TapEvent = EventManager.RegisterRoutedEvent(<br />
"Tap", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MyButtonSimple));<br />
<br />
public event RoutedEventHandler Tap<br />
{<br />
add { AddHandler(TapEvent, value); } <br />
remove { RemoveHandler(TapEvent, value); }<br />
}<br />
<br />
void RaiseTapEvent()<br />
{<br />
RoutedEventArgs newEventArgs = new RoutedEventArgs(MyButtonSimple.TapEvent);<br />
RaiseEvent(newEventArgs);<br />
}<br />
protected override void OnClick()<br />
{<br />
RaiseTapEvent();<br />
}<br />
<br />
}<br />
<br />
<br />
But, from my point of view, I could although done it this way
<br />
public delegate void DelegateClickEventHandler();<br />
public event DelegateClickEventHandler DelegateClickEvent;<br />
<br />
protected ovveride void OnClick()<br />
{<br />
if(DelegateClickEvent!=null)<br />
{<br />
DelegateClickEvent();<br />
}<br />
}<br />
And I could use this event in XAML either. So i am a little confused.
|
|
|
|
|
Routed events, cunningly enough, are designed to support event routing. Basically this mechanism allows you to register an event inside one element but, and this is the clever part, it can be raised by a completely different element. A simple example (and commonly quoted) is that a toolbar button click can go through the toolbar, then maybe a toolbar container, before finally being handled by your code. As you can see, this goes way beyond what you can manage with a simple event because the event would not bubble up in a traditional event scenario.
The problem you have here, is that the example on MSDN isn't terribly well explained, and the concept isn't clearly defined on the MSDN either.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
That was nicely explained That example on MSDN is pathetic and is more misleading than helping. When you read the explanation you somewhat get the picture but when you reach the example, it totally leaves you guessing into the behavior as of a normal event.
|
|
|
|
|
ABitSmart wrote: That was nicely explained
Thanks.
ABitSmart wrote: That example on MSDN is pathetic and is more misleading than helping.
Isn't it just? I really wish they'd up the quality of samples on MSDN. I used to rely heavily on MSDN - now, I tend to ignore it.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
It doesn't matter anymore. My MSDN is Josh, Sacha, Karl, Dr.WPF and Pete[^] The WPF disciples are fabulous!
|
|
|
|
|
Thanks - it's an honour to be among such giants, and the Disciples are as fine a bunch as you'll ever meet.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
Pete gave a nice explanation. Just to highlight, the Tap event of your example could be handled by any other UI element in the Element tree instead of your Element. Also, could be used as an EventTrigger to start an animations when the event is fired. You can derive the analogy on similar lines as a CLR property and a Dependency Property.
|
|
|
|
|
Now I'm much more clear. As you said, I was totally confused by the example in MSDN. It appears that MSDN just offer a example which can be perfectly debug, but you can not learn the characteristic. Well, Especially in China, little company is using WPF. And you could not find many resources about WPF. Anyway, specail thanks for ABitSmart and Pete.
|
|
|
|
|
Hi,
What is Web Service Software Factory and Web Client Software Factory?
|
|
|
|
|
Kamal Gurnani wrote: What is Web Service Software Factory and Web Client Software Factory?
This isn't Jeapordy. Here's one for you - what is Google?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
Hi everybody,
We are using Composite WPF for our new project, and I'm looking for UI process library for it. For WinForm applications, there is UIPAB, while for WPF, I can't find anything like that. I looked into the Workflow Foundation, but it lacks the features in UIPAB. Any suggestions for UI process design and development for Composite WPF?
Thanks,
Jie
|
|
|
|
|
I do not see any reply.But as far as i know we can customize the UIP App block for WPF.
|
|
|
|
|
Hi,
I was really happy to see the NearestNeighbor rendering added in SP1. I thought this would solve the blurry images and such, but what I see is that it's rendering my images incorrectly. It seems to omit rows or pixels if the image is at certain locations. This is easily reproducible by aligning an image to the center of the window, and slowly resizing the window.
I don't think this is supposed to happen with NearestNeighbor rendering since the image has the same resolution as my display.
Here is Sparpness.PNG from the Microsoft PixelsSnapping tutorial for example:
http://img5.imageshack.us/img5/4061/sharpnessfail.png[^]
Is there any way to make this work?
|
|
|
|
|
I'm curious...
What if you try four side-by-side renders (similar to the
code at Pixel Snapping in WPF Applications[^])...
1) SnapsToDevicePixels=False, RenderOptions.BitmapScalingMode=Unspecified
2) SnapsToDevicePixels=True, RenderOptions.BitmapScalingMode=Unspecified
3) SnapsToDevicePixels=False, RenderOptions.BitmapScalingMode=NearestNeighbor
4) SnapsToDevicePixels=True, RenderOptions.BitmapScalingMode=NearestNeighbor
Do any of those combinations render the way you'd like?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
None of them is correct. Looks like snapstodevicepoxels has no effect in images at all.
NearestNeighbor always, and it's always blurry without nearestneighbor.
|
|
|
|
|
Hi,
I am new to Silverlight Applications. I created one media player control to play video in asp.net website.I want to drag and drop that media player control to desired place when we run the application but there are no events to drag and drop the video. I tried media element control its working fine for drag and drop functionality but i want that feature in media player control. Is there any other alternatives to drag and drop videos to desired place when we execute the application.
Thanks in Advance
Pavani
|
|
|
|
|
pavanip wrote: I tried media element control its working fine for drag and drop functionality but i want that feature in media player control.
Isn't the MediaPlayer an ASP.NET control?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I used Media Player control in Asp.Net but i am not getting how to Drag and Drop Video to desired location using that media Player control.
|
|
|
|
|
Maybe try posting on the ASP.NET board since it's not a silverlight control.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
ok. thank you i posted it in asp.net,dotnet spider,c# corner forums but i didn't get any reply from those forums. And I tried in another way. I added new silverlight project in sasp.net website and I created media element control in xaml file for drag and drop functionlaity and I used that .XAP file in my aspx page when i run in my local system that page running and i am trying to host it in my iis server and there is no silverlight when i open that link it is showing blank space in place of that xaml content. If you know the reason please suggest me how to host my application in server.
|
|
|
|