Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =======================
- 9:
- ======================
- <Page
- x:Class="demoUWP2.MainPage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="using:demoUWP2"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d">
- <Page.TopAppBar>
- <CommandBar IsOpen="True">
- <AppBarButton Icon="Play" Click="{x:Bind OnTimer}"/>
- <AppBarButton Icon="Pause" Click="{x:Bind OnStopTimer}"/>
- </CommandBar>
- </Page.TopAppBar>
- <Canvas Width="300" Height="300">
- <Ellipse Width="10" Height="10" Fill="Red" Canvas.Left="145" Canvas.Top="145"/>
- <Line Canvas.Left="150" Canvas.Top="150" StrokeThickness="3" Stroke="Blue"
- X1="0" Y1="0" X2="120" Y2="0">
- <Line.RenderTransform>
- <RotateTransform CenterX="0" CenterY="0" Angle="270" x:Name="rotate"/>
- </Line.RenderTransform>
- </Line>
- </Canvas>
- </Page>
- using System;
- using Windows.UI.Xaml;
- using Windows.UI.Xaml.Controls;
- //Szablon elementu Pusta strona jest udokumentowany na stronie https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x415
- namespace demoUWP2
- {
- /// <summary>
- /// Pusta strona, która może być używana samodzielnie lub do której można nawigować wewnątrz ramki.
- /// </summary>
- public sealed partial class MainPage : Page
- {
- private DispatcherTimer _timer = new DispatcherTimer();
- public MainPage()
- {
- this.InitializeComponent();
- _timer.Tick += OnTick;
- _timer.Interval = TimeSpan.FromSeconds(1);
- }
- private void OnTimer()
- {
- _timer.Start();
- }
- private void OnTick(object sender, object e)
- {
- double newAngle = rotate.Angle + 6;
- if (newAngle >= 360)
- newAngle = 0;
- rotate.Angle = newAngle;
- }
- private void OnStopTimer()
- {
- _timer.Stop();
- }
- }
- }
- =========================
- 8:
- =========================
- <Page
- x:Class="HelloWorld.MainPage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="using:HelloWorld"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d">
- <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
- <Button Content="Kliknij!"
- HorizontalAlignment="Left"
- VerticalAlignment="Top" Margin="153,329,0,0" Click="Button_Click"/>
- </Grid>
- </Page>
- using Windows.UI.Xaml;
- using Windows.UI.Xaml.Controls;
- using System;
- //Szablon elementu Pusta strona jest udokumentowany na stronie https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x415
- namespace HelloWorld
- {
- /// <summary>
- /// Pusta strona, która może być używana samodzielnie lub do której można nawigować wewnątrz ramki.
- /// </summary>
- public sealed partial class MainPage : Page
- {
- public MainPage()
- {
- this.InitializeComponent();
- }
- private async void Button_Click(object sender, RoutedEventArgs e)
- {
- MediaElement mediaElement = new MediaElement();
- var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
- Windows.Media.SpeechSynthesis.SpeechSynthesisStream
- stream = await synth.SynthesizeTextToStreamAsync("Hello, World!");
- mediaElement.SetSource(stream, stream.ContentType);
- mediaElement.Play();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement