Upload
jaana-metsamaa
View
1.006
Download
3
Embed Size (px)
Citation preview
Jaana MetsamaaSilverlight
TARTU 2008
Mis on Silverlight?
erinevad platvormid
plugi-in
RIA
erinevad veebilehitsejad
Arhitektuur
Töövahendid
http://www.silverlight.net/GetStarted
Silverlight 2 rakenduse ülesehitus
HTML
<OBJECT>
Silverlight Page.xaml.cs
Page.xaml
App.xaml
App.xaml.cs
.XAP
XAML (Extensible Application Markup Language)
<UserControl xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><Grid x:Name=“LayoutRoot”> <TextBlock x:Name="txt" FontSize="32" Text="Tere maailm!“ />
<Button x:Name=“nupp“ Content=“Vajuta“ Click=“meetod" /></Grid></UserControl>
Page.xaml
<UserControl xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><Grid x:Name=“LayoutRoot”> <TextBlock x:Name="txt" FontSize="32" Text="Tere maailm!“ />
<Button x:Name=“nupp“ Content=“Vajuta“ Click=“meetod" /></Grid></UserControl>
Page.xaml
XAML (Extensible Application Markup Language)
<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <TextBlock x:Name="txt" FontSize="32" Text="Tere maailm!" /></Canvas>
<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <TextBlock x:Name="txt" FontSize="32" Text="Tere maailm!" /></Canvas>
TextBlock t = new TextBlock();t.FontSize = 32;t.Text = "Tere maailm!";
TextBlock t = new TextBlock();t.FontSize = 32;t.Text = "Tere maailm!";
=C#
Kasutajaelemendidkujundid,nupud, pildid, videod, tekstikastid,
kerimisribad jms.
Transformatsioonid ja animatsioonid
RotateTransform
ScaleTransform
SkewTransform
TranslateTransform
Transformatsiooni lisamine
<TextBlock x:Name="txt" FontSize="32" Text="Tere maailm!">
<TextBlock.RenderTransform><ScaleTransform ScaleX="2" ScaleY="2"/>
</TextBlock.RenderTransform></TextBlock>
<TextBlock x:Name="txt" FontSize="32" Text="Tere maailm!">
<TextBlock.RenderTransform><ScaleTransform ScaleX="2" ScaleY="2"/>
</TextBlock.RenderTransform></TextBlock>
ScaleTransform st = new ScaleTransform();st.ScaleX = 2;st.ScaleY = 2;txt.RenderTransfrom = st;
ScaleTransform st = new ScaleTransform();st.ScaleX = 2;st.ScaleY = 2;txt.RenderTransfrom = st;
=
Animatsiooni lisamine<TextBlock x:Name="txt" Text="tere" FontSize="32"> <TextBlock.Resources> <Storyboard x:Name="Kuma"> <DoubleAnimation x:Name="Animatsioon" Storyboard.TargetName="txt" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:05" /> </Storyboard> </TextBlock.Resources> </TextBlock>
<TextBlock x:Name="txt" Text="tere" FontSize="32"> <TextBlock.Resources> <Storyboard x:Name="Kuma"> <DoubleAnimation x:Name="Animatsioon" Storyboard.TargetName="txt" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:05" /> </Storyboard> </TextBlock.Resources> </TextBlock>
Animatsioon.Begin();Animatsioon.Begin();
Stiilid ja mallid
<Style x:Key="stiil" TargetType="TextBlock"> <Setter Property="FontSize" Value="24" /> <Setter Property="Margin" Value="5" /> <Setter Property="Foreground"> <Setter.Value> <LinearGradientBrush> <GradientStop Color = "LightBlue" Offset="0"/> <GradientStop Color="SteelBlue“ Offset="1"/> </LinearGradientBrush> </Setter.Value> </Setter> </Style>
<Style x:Key="stiil" TargetType="TextBlock"> <Setter Property="FontSize" Value="24" /> <Setter Property="Margin" Value="5" /> <Setter Property="Foreground"> <Setter.Value> <LinearGradientBrush> <GradientStop Color = "LightBlue" Offset="0"/> <GradientStop Color="SteelBlue“ Offset="1"/> </LinearGradientBrush> </Setter.Value> </Setter> </Style><TextBlock x:Name=“txt“ Text="Hei" Style="{StaticResource stiil}“ /><TextBlock x:Name=“a2“ Text=“Tere" Style="{StaticResource stiil}“ />
<TextBlock x:Name=“txt“ Text="Hei" Style="{StaticResource stiil}“ /><TextBlock x:Name=“a2“ Text=“Tere" Style="{StaticResource stiil}“ />
Databinding• Kasutajaliides paika ja andmete pärast muretseme
hiljem
Publitseerimine• Nõuded veebiserverile samad, mis HTML lehele.
<object data="data:application/x-silverlight," type="application/x-silverlight-2-b1" width="100%" height="100%">
<param name="source" value="Veeebileht.xap"/>
</object>
<object data="data:application/x-silverlight," type="application/x-silverlight-2-b1" width="100%" height="100%">
<param name="source" value="Veeebileht.xap"/>
</object>
Silverlight Streaming
http://silverlight.live.com
Silverlight Streaming parameetrid on
järgmised:
ruumi 10GB;
5TB andmesidemahtu;
Võimalus hostida rakendus tervikuna või
osadena.
Plussid ja miinused+ Mac, Windwos, Linux, Nokia, Windows Mobile+ Teada-tuntud tehnoloogiad+ Laialt levinud videoformaadid+ Kiirus
- Mac arendusvahendid- Veebikaamera ning mikrofon- Mitte nii väga platvormi sõltumatu
Tänan