Primes 1.0
Using Visual Studio and C# we will build a Universal Windows Platform application that generates a sequence of prime numbers.
Create a new project: Visual C# > Windows Universal > Blank App (Universal Windows).
Name the project Primes 1.0.
The MainPage.xaml file contains the user interface markup written in XAML. Copy (Ctrl+C) and paste (Ctrl+V) the fragment below into your application.
<!-- User Interface (UI): Primes 1.0 -->
<StackPanel Background="Yellow" Padding="50">
<!-- Title -->
<TextBlock Text="Primes 1.0" FontSize="40" />
<!-- Limit -->
<TextBlock Text="Limit" FontSize="20" />
<TextBox Name="boxLimit" Text="1000" FontSize="20" />
<Button Content="Generate" Margin="0 10 0 10" Padding="20 10 20 10" FontSize="20" Click="Button_Click" />
<!-- Numbers -->
<ListBox Name="boxNumbers" Height="400" FontSize="20" />
</StackPanel>
Design view (XAML) in Visual Studio while developing the application:
Fig. 1.29. UI design view
MainPage.xaml.cs
The MainPage.xaml.cs file contains the business logic written in C#. Copy (Ctrl+C) and paste (Ctrl+V) the fragment below into your application.
Business logic (C#) view in Visual Studio while developing the application:
Fig. 1.30. Business logic view
Start the app via Debug > Start Debugging or press F5.
Fig. 1.31. Universal app that generates a sequence of prime numbers.
Last updated