Treść książki

Przejdź do opcji czytnikaPrzejdź do nawigacjiPrzejdź do informacjiPrzejdź do stopki
2030Uzasadnieniepotrzebywykorzystaniawątków
privatestaticdoubleDistance(doublex,doubley)
{
returnMath.Sqrt(x*x+y*y);
}
43
privatestaticvoidCheckRandomPointsCount
(longrandomPointsCount)
{
if(randomPointsCount<=0)
{
thrownewArgumentException(
"Thevalueofrandompointsshouldbepositive");
}
}
}
}
Listing2.2.DefnicjagłównegowidokuaplikacjiMonteCarloPi
<Page
x:Class="MonteCarloPi.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MonteCarloPi"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/&
markup-compatibility/2006"
mc:Ignorable="d">
<StackPanelBackground="{ThemeResource&
ApplicationPageBackgroundThemeBrush}">
<StackPanelOrientation="Horizontal"
Margin="5">
<TextBlockText="Liczbapunktów:"
VerticalAlignment="Center"/>
<TextBoxx:Name="TextBoxPointsCount"/>
</StackPanel>
<ButtonContent="Oblicz"
Margin="5"
Click="ButtonCalculatePi_Click"/>
<ListBoxx:Name="ListBoxResults"
Margin="5"/>
</StackPanel>
</Page>