Sie sind auf Seite 1von 3

<phone:PhoneApplicationPage x:Class="HelloWorld.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone " xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.

org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" shell:SystemTray.IsVisible="True"> <!--LayoutRoot is the root grid where all page content is placed--> <Grid x:Name="LayoutRoot" Background="Transparent"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <!--TitlePanel contains the name of the application and page title--> <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> <TextBlock x:Name="ApplicationTitle" Text="HelooWorld" Style="{Stati cResource PhoneTextNormalStyle}"/> <TextBlock x:Name="PageTitle" Text="MojPage" Margin="9,-7,0,0" Style ="{StaticResource PhoneTextTitle1Style}"/> </StackPanel>

<!--ContentPanel - place additional content here--> <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="283*" /> <ColumnDefinition Width="173*" /> </Grid.ColumnDefinitions> <TextBox Name="txtInput" Height="70" Margin="166,6,6,459" Grid.Colum nSpan="2" /> <TextBox Name="txtOutput" Grid.ColumnSpan="2" Height="70" Margin="12 7,201,0,264" /> <TextBlock Height="30" HorizontalAlignment="Left" Margin="12,27,0,0" Name="tbInput" Text="Input" VerticalAlignment="Top" Width="60" /> <TextBlock Height="30" HorizontalAlignment="Left" Margin="12,229,0,0 " Name="tbOutput" Text="Output" VerticalAlignment="Top" Width="90" /> <Button Content="GO" Height="72" HorizontalAlignment="Left" Margin=" 216,123,0,0" Name="btnGo" VerticalAlignment="Top" Width="160" Grid.ColumnSpan="2 " Click="btnGo_Click" /> <TextBox Height="99" HorizontalAlignment="Left" Margin="195,358,0,0" Name="txtbox2" VerticalAlignment="Top" Width="199" Grid.ColumnSpan="2" TextCha nged="txtbox2_TextChanged" /> <TextBlock Height="30" HorizontalAlignment="Left" Margin="19,395,0,0 " Name="txtblock2" Text="Glupost" VerticalAlignment="Top" /> </Grid> </Grid> <!--Sample code showing usage of ApplicationBar-->

<!--<phone:PhoneApplicationPage.ApplicationBar> <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True"> <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Click="ApplicationBarIconButton_Click" Text="GO"/> <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="ERASE"/> <shell:ApplicationBar.MenuItems> <shell:ApplicationBarMenuItem Text="MenuItem 1" /> <shell:ApplicationBarMenuItem Text="MenuItem 2"/> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar> </phone:PhoneApplicationPage.ApplicationBar>--> </phone:PhoneApplicationPage> using using using using using using using using using using using using System; System.Collections.Generic; System.Linq; System.Net; System.Windows; System.Windows.Controls; System.Windows.Documents; System.Windows.Input; System.Windows.Media; System.Windows.Media.Animation; System.Windows.Shapes; Microsoft.Phone.Controls;

namespace HelloWorld { public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); } private void btnGo_Click(object sender, RoutedEventArgs e) { txtOutput.Text = txtInput.Text; } private string lastCorrectText=""; private string novaZnamenka = ""; private bool repeatedCallBack = false ; private void txtbox2_TextChanged(object sender, TextChangedEventArgs e) { if (!repeatedCallBack) { DoStuff(); repeatedCallBack = true; }

// AND = && // OR= // NOT= ! } private void DoStuff() { int broj; if (txtbox2.Text.Length > 1) novaZnamenka = txtbox2.Text.Replace(lastCorrectText, ""); bool isBroj = int.TryParse(novaZnamenka, out broj); if (isBroj) // !isBroj { txtOutput.Text = "ne mozes upisat broj"; txtbox2.Text = lastCorrectText; } else { txtOutput.Text = "dobar unos"; lastCorrectText = txtbox2.Text; } } } }

Das könnte Ihnen auch gefallen