forked from s434786/DINO_SCRUM
Usuniece konfliktu
This commit is contained in:
commit
9e5a1bde5b
@ -17,8 +17,13 @@
|
||||
mc:Ignorable="d"
|
||||
Title="Magazyn Owoców" MinHeight="259" Height="500" MaxWidth="590" MinWidth="590" Width="590" >
|
||||
<Grid>
|
||||
<ListBox MouseDoubleClick="fruitListMouseDoubleClick" x:Name="fruitList" Margin="10,51,10,89"/>
|
||||
<Button Name="sum" Content="Wartość magazynu" Margin="0,0,10,10" VerticalAlignment="Bottom" Height="35" Click="Value_Click" HorizontalAlignment="Right" Width="163"/>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="435*"/>
|
||||
<RowDefinition Height="0*"/>
|
||||
<RowDefinition Height="34*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox MouseDoubleClick="fruitListMouseDoubleClick" x:Name="fruitList" Margin="10,51,10,55"/>
|
||||
<Button Name="sum" Content="Wartość magazynu" Margin="0,0,10,10" VerticalAlignment="Bottom" Height="35" Click="Value_Click" HorizontalAlignment="Right" Width="163" Grid.RowSpan="3"/>
|
||||
<Label Content="Lista owoców:" FontWeight="Bold" HorizontalAlignment="Left" Margin="10,4,0,0" VerticalAlignment="Top" Width="100"/>
|
||||
<Label Content="Nazwa owocu:" FontWeight="Bold" HorizontalAlignment="Left" Margin="91,25,0,0" VerticalAlignment="Top" Width="100"/>
|
||||
|
||||
@ -27,9 +32,11 @@
|
||||
<Label Content="Cena 1szt:" FontWeight="Bold" HorizontalAlignment="Left" Margin="360,25,0,0" VerticalAlignment="Top" Width="73"/>
|
||||
<Label Content="Wartość:" FontWeight="Bold" HorizontalAlignment="Left" Margin="438,25,0,0" VerticalAlignment="Top" Width="65"/>
|
||||
|
||||
<Button x:Name="prevButton" Content="Poprzednia" HorizontalAlignment="Left" Margin="10,0,0,52" VerticalAlignment="Bottom" Width="105" Click="prevButton_Click"/>
|
||||
<Button x:Name="nextButton" Content="Następna" HorizontalAlignment="Right" Margin="0,0,10,52" VerticalAlignment="Bottom" Width="105" Click="nextButton_Click"/>
|
||||
<TextBlock x:Name="pageBlock" FontSize="16" Margin="274,0,273,59" TextWrapping="Wrap" Text="NaN" Height="19" VerticalAlignment="Bottom"/>
|
||||
<Button x:Name="prevButton" Content="Poprzednia" HorizontalAlignment="Left" Margin="10,0,0,18" VerticalAlignment="Bottom" Width="105" Click="prevButton_Click"/>
|
||||
<Button x:Name="nextButton" Content="Następna" HorizontalAlignment="Right" Margin="0,0,10,18" VerticalAlignment="Bottom" Width="105" Click="nextButton_Click"/>
|
||||
<TextBlock x:Name="pageBlock" FontSize="16" Margin="274,0,273,25" TextWrapping="Wrap" Text="NaN" Height="19" VerticalAlignment="Bottom"/>
|
||||
<Label Content="Status:" HorizontalAlignment="Left" Margin="4,0,0,14" VerticalAlignment="Bottom" Grid.RowSpan="3"/>
|
||||
<TextBlock Name="netStatus" HorizontalAlignment="Left" Margin="50,0,0,19" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Bottom" Grid.RowSpan="3"/>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
@ -21,6 +21,7 @@ using Newtonsoft.Json.Linq;
|
||||
using System.Net;
|
||||
using Magazyn.Windows;
|
||||
using Magazyn.Tools;
|
||||
using System.Net.NetworkInformation;
|
||||
|
||||
namespace Magazyn
|
||||
{
|
||||
@ -32,6 +33,7 @@ namespace Magazyn
|
||||
|
||||
bool firstPage;
|
||||
bool lastPage;
|
||||
bool netConn;
|
||||
|
||||
HttpClient client;
|
||||
|
||||
@ -42,6 +44,11 @@ namespace Magazyn
|
||||
InitializeComponent();
|
||||
client = new HttpClient();
|
||||
this.Loaded += MainWindowLoaded;
|
||||
netConn = checkInternetConnection();
|
||||
if (netConn)
|
||||
netStatus.Text = "Połączony";
|
||||
else
|
||||
netStatus.Text = "Rozłączony";
|
||||
}
|
||||
|
||||
private void MainWindowLoaded(object sender, EventArgs e)
|
||||
@ -84,6 +91,9 @@ namespace Magazyn
|
||||
}
|
||||
|
||||
private void RefreshListOfFruits()
|
||||
{
|
||||
|
||||
if (netConn)
|
||||
{
|
||||
pageBlock.Text = (page+1).ToString();
|
||||
|
||||
@ -113,6 +123,7 @@ namespace Magazyn
|
||||
|
||||
UpdateListOfFruits(fruits);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateListOfFruits(Fruit[] list)
|
||||
{
|
||||
@ -178,6 +189,17 @@ namespace Magazyn
|
||||
window.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private Boolean checkInternetConnection()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new Ping().Send("www.google.com").Status == IPStatus.Success;
|
||||
} catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user