Kenneth van Ewijk пре 10 година
родитељ
комит
67a75f56d3

+ 11 - 0
YJMPD-UWP/Helpers/Extensions.cs

@@ -13,5 +13,16 @@ namespace YJMPD_UWP.Helpers
                    (token.Type == JTokenType.String && token.ToString() == String.Empty) ||
                    (token.Type == JTokenType.Null);
         }
+
+        public static string UppercaseFirst(this string s)
+        {
+            // Check for empty string.
+            if (string.IsNullOrEmpty(s))
+            {
+                return string.Empty;
+            }
+            // Return char and concat substring.
+            return char.ToUpper(s[0]) + s.Substring(1).ToLower();
+        }
     }
 }

+ 23 - 16
YJMPD-UWP/MainPage.xaml

@@ -20,12 +20,12 @@
 
         <Style x:Key="NavIcon" TargetType="TextBlock">
             <Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
-            <Setter Property="FontSize" Value="28" />
+            <Setter Property="FontSize" Value="22" />
             <Setter Property="Margin" Value="0,5,0,0" />
         </Style>
 
         <Style x:Key="NavText" TargetType="TextBlock">
-            <Setter Property="FontSize" Value="28" />
+            <Setter Property="FontSize" Value="22" />
             <Setter Property="Margin" Value="18,0,0,0" />
         </Style>
 
@@ -35,15 +35,19 @@
             <Setter Property="VerticalAlignment" Value="Center" />
             <Setter Property="Margin" Value="10,5,10,0" />
         </Style>
+        <Style x:Key="GameInfoHeaderPanel" TargetType="RelativePanel">
+            <Setter Property="VerticalAlignment" Value="Center" />
+            <Setter Property="Margin" Value="10,5,10,0" />
+        </Style>
 
         <Style x:Key="GameInfoIcon" TargetType="TextBlock">
             <Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
-            <Setter Property="FontSize" Value="20" />
+            <Setter Property="FontSize" Value="16" />
             <Setter Property="Margin" Value="5,5,0,0" />
         </Style>
 
         <Style x:Key="GameInfoText" TargetType="TextBlock">
-            <Setter Property="FontSize" Value="20" />
+            <Setter Property="FontSize" Value="16" />
             <Setter Property="Margin" Value="15,0,0,0" />
         </Style>
     </Page.Resources>
@@ -99,12 +103,19 @@
                         </ListBox>
                     </Viewbox>
                     
-                    <StackPanel RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" Background="Gray">
+                    <RelativePanel RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" Background="Gray">
                         
-                        <StackPanel Visibility="{Binding GameVisible, Converter={StaticResource BoolToVisConverter}}" HorizontalAlignment="Stretch">
-                            <StackPanel Style="{StaticResource GameInfoPanel}">
-                                <TextBlock Margin="5,0,0,0" FontSize="16" FontWeight="Bold" Text="Current game"/>
-                            </StackPanel>
+                        <StackPanel Visibility="{Binding GameVisible, Converter={StaticResource BoolToVisConverter}}" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" RelativePanel.Above="Copyright" Margin="0,0,0,8">
+                            
+                            <RelativePanel Style="{StaticResource GameInfoHeaderPanel}">
+                                <TextBlock Margin="5,0,0,0" FontSize="18" FontWeight="Bold" Text="Current game" />
+                                <HyperlinkButton Click="BackToGame_Click" RelativePanel.AlignRightWithPanel="True">
+                                    <StackPanel Orientation="Horizontal">
+                                        <TextBlock Style="{StaticResource Icon}" Text="&#xE7A7;" Margin="0,3,0,0" Foreground="Black"/>
+                                        <TextBlock Text="Back to game" Margin="5,0,0,0" Foreground="Black"/>
+                                    </StackPanel>
+                                </HyperlinkButton>
+                            </RelativePanel>
 
                             <StackPanel Style="{StaticResource GameInfoPanel}">
                                 <TextBlock Style="{StaticResource GameInfoIcon}" Text="&#xE8A1;"/>
@@ -115,18 +126,14 @@
                                 <TextBlock Style="{StaticResource GameInfoIcon}" Text="&#xE716;"/>
                                 <TextBlock Style="{StaticResource GameInfoText}" Text="{Binding Players}"/>
                             </StackPanel>
-
-                            <StackPanel Style="{StaticResource GameInfoPanel}">
-                                <Button Content="Back to Game" Click="BackToGame_Click" Style="{StaticResource Green}"/>
-                            </StackPanel>
                         </StackPanel>
                         
-                        <StackPanel Orientation="Horizontal" Margin="15,5">
-                            <TextBlock Text="YJMPD-UWP @"/>
+                        <StackPanel Orientation="Horizontal" Margin="15,5" RelativePanel.AlignBottomWithPanel="True" Name="Copyright">
+                            <TextBlock Text="YJMPD-UWP ©"/>
                             <TextBlock Text="{Binding Year}" Margin="5,0,0,0" />
                         </StackPanel>
 
-                    </StackPanel>
+                    </RelativePanel>
                 </RelativePanel>
             </SplitView.Pane>
             

+ 0 - 1
YJMPD-UWP/Model/ApiHandler.cs

@@ -36,7 +36,6 @@ namespace YJMPD_UWP.Model
 
         public void HandleMessage(JObject o)
         {
-            Debug.WriteLine(o.ToString());
             Command c = (Command)Enum.Parse(typeof(Command), o["command"].ToString());
 
             switch (c)

+ 6 - 3
YJMPD-UWP/Model/NetworkHandler.cs

@@ -50,7 +50,11 @@ namespace YJMPD_UWP.Model
             if (Status != NetworkStatus.CONNECTED)
                 return "error";
 
-            return await din.ReadLineAsync();
+            string data = await din.ReadLineAsync();
+
+            Debug.WriteLine("Receiving -> " + data);
+
+            return data;
         }
 
         public async Task<bool> Write(string data)
@@ -58,7 +62,7 @@ namespace YJMPD_UWP.Model
             if (Status != NetworkStatus.CONNECTED)
                 return false;
 
-            Debug.WriteLine(data);
+            Debug.WriteLine("Sending -> " + data);
 
             dout.WriteString(data + Environment.NewLine);
             await dout.StoreAsync();
@@ -98,7 +102,6 @@ namespace YJMPD_UWP.Model
 
                 while (running)
                 {
-                    Debug.WriteLine("Awaiting incoming data... " + workItem.Status.ToString());
 
                     string data = "";
 

+ 6 - 2
YJMPD-UWP/ViewModels/MainPageVM.cs

@@ -1,4 +1,5 @@
 using System;
+using YJMPD_UWP.Helpers;
 
 namespace YJMPD_UWP.ViewModels
 {
@@ -31,7 +32,7 @@ namespace YJMPD_UWP.ViewModels
         {
             get
             {
-                return App.Game.Status.ToString();
+                return App.Game.Status.ToString().UppercaseFirst();
             }
         }
 
@@ -39,7 +40,10 @@ namespace YJMPD_UWP.ViewModels
         {
             get
             {
-                return App.Game.Players.Count + " players";
+                if (App.Game.Players.Count == 1)
+                    return "1 player";
+                else
+                    return App.Game.Players.Count + " players";
             }
         }