Skip to content

Commit b5c9980

Browse files
committed
Implemented Exception Page
1 parent db937dd commit b5c9980

File tree

93 files changed

+42523
-29
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+42523
-29
lines changed
64 KB
Binary file not shown.

SyncPlayWPF/SyncPlayWPF/App.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ namespace SyncPlayWPF {
1111
/// Interaction logic for App.xaml
1212
/// </summary>
1313
public partial class App : Application {
14+
1415
}
1516
}

SyncPlayWPF/SyncPlayWPF/Common/Shared.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,23 @@
33
using System.Linq;
44
using System.Text;
55
using System.Threading.Tasks;
6+
using WpfPageTransitions;
67

78
namespace SyncPlayWPF.Common {
89
public class Shared {
910
public static WpfPageTransitions.PageTransition WindowPageTransition;
1011
public static WpfPageTransitions.PageTransition LandingPageTransition;
12+
public static WpfPageTransitions.PageTransition MasterOverrideTransition;
1113
public static Pages.SessionPages.ChatSession ChatPageSingleton;
1214
public static SyncPlay.SyncPlayWrapper Wrapper;
13-
15+
16+
public static void ThrowException(Exception e) {
17+
MasterOverrideTransition.IsHitTestVisible = true;
18+
var exp_view = new Pages.ApplicationPages.ExceptionView();
19+
exp_view.ShowDisplay(e);
20+
MasterOverrideTransition.ShowPage(exp_view);
21+
}
1422
}
23+
24+
1525
}

SyncPlayWPF/SyncPlayWPF/MainWindow.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@
8686
</Setter>
8787
</Style>
8888
</Grid.Style>
89+
8990
<wpft:PageTransition Name="RootPageTransition" TransitionType="Fade"/>
91+
<wpft:PageTransition Name="MasterOverlayTransition" IsHitTestVisible="False" TransitionType="Fade"/>
9092
</Grid>
9193
</Grid>
9294
</Window>

SyncPlayWPF/SyncPlayWPF/MainWindow.xaml.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,18 @@ public MainWindow() {
2222
InitializeComponent();
2323

2424
Common.Shared.WindowPageTransition = RootPageTransition;
25+
Common.Shared.MasterOverrideTransition = MasterOverlayTransition;
2526

2627
//RootPageTransition.ShowPage(new Pages.SessionLandingPage());
2728
RootPageTransition.ShowPage(new Pages.NewSessionPage());
29+
30+
Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
31+
}
32+
33+
private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) {
34+
Console.WriteLine("Exception thrown!");
35+
Common.Shared.ThrowException(e.Exception);
36+
e.Handled = true;
2837
}
2938

3039
private void WindowDrag(object sender, MouseButtonEventArgs e) {
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<UserControl x:Class="SyncPlayWPF.Pages.ApplicationPages.ExceptionView"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:SyncPlayWPF.Pages.ApplicationPages"
7+
mc:Ignorable="d"
8+
d:DesignHeight="450" d:DesignWidth="800">
9+
<UserControl.Resources>
10+
<ResourceDictionary Source="../../Themes/Generic.xaml"/>
11+
</UserControl.Resources>
12+
<Border Background="{StaticResource DarkMode_AccentColorJ}">
13+
14+
<Grid Margin="25, 10, 25, 10" x:Name="ContainerGrid">
15+
16+
<Grid.RowDefinitions>
17+
<RowDefinition Height="auto"/>
18+
<RowDefinition Height="auto"/>
19+
<RowDefinition Height="*"/>
20+
<RowDefinition Height="auto"/>
21+
</Grid.RowDefinitions>
22+
23+
<TextBlock
24+
Grid.Row="0"
25+
Text="ಠ╭╮ಠ"
26+
FontSize="50"
27+
Margin="10,0,0,0"
28+
Foreground="{StaticResource DarkMode_TextColorA}">
29+
<TextBlock.Effect>
30+
<DropShadowEffect BlurRadius="10" ShadowDepth="0" Opacity="1"/>
31+
</TextBlock.Effect>
32+
</TextBlock>
33+
34+
<TextBlock
35+
Grid.Row="1"
36+
Text="Whoops. It would seem that you have come across an excpetion. So you have two options. You can ignore the exception and continue with normal usage, or you can submit the following stack trace and help us to make SyncPlay.NET better"
37+
TextWrapping="WrapWithOverflow"
38+
FontSize="15"
39+
Margin="0,10,0,0"
40+
Foreground="{StaticResource DarkMode_TextColorF}"/>
41+
42+
<Border
43+
Background="{StaticResource DarkMode_AccentColorE}"
44+
CornerRadius="10"
45+
Margin="0,15,0,0"
46+
Width="{Binding ElementName=ContainerGrid, Path=ActualWidth, Converter={StaticResource PercentageConverter}, ConverterParameter='0.9'}"
47+
Padding="10"
48+
Grid.Row="2">
49+
50+
<ScrollViewer Style="{StaticResource FavsScrollViewer}">
51+
<TextBox
52+
x:Name="ExceptionDetails"
53+
Background="Transparent"
54+
Margin="0,0,10,0"
55+
Foreground="Black"
56+
BorderThickness="0"
57+
Text="Test Exception&#x0a;
58+
at SyncPlayWPF.Pages.SessionLandingPage.ToggleSidePanel(Object sender, RoutedEventArgs e) in D:\GitHub\SyncPlayWPF\SyncPlayWPF\SyncPlayWPF\Pages\SessionLandingPage.xaml.cs:line 37&#x0a;
59+
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)&#x0a;
60+
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)&#x0a;
61+
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)&#x0a;
62+
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)&#x0a;
63+
at System.Windows.Controls.Primitives.ButtonBase.OnClick()&#x0a;
64+
at System.Windows.Controls.Button.OnClick()&#x0a;
65+
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)&#x0a;
66+
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)&#x0a;
67+
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)&#x0a;
68+
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)&#x0a;
69+
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)&#x0a;
70+
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)&#x0a;
71+
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)&#x0a;
72+
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)&#x0a;
73+
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)&#x0a;
74+
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)&#x0a;
75+
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)&#x0a;
76+
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)&#x0a;
77+
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)&#x0a;
78+
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)&#x0a;
79+
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)&#x0a;
80+
at System.Windows.Input.InputManager.ProcessStagingArea()&#x0a;
81+
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)&#x0a;
82+
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)&#x0a;
83+
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)&#x0a;
84+
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean handled)&#x0a;
85+
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean handled)&#x0a;
86+
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean handled)&#x0a;
87+
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)&#x0a;
88+
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)&#x0a;
89+
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)"/>
90+
</ScrollViewer>
91+
</Border>
92+
93+
<StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Center" >
94+
<Button Margin="2,6,2,0" Style="{StaticResource GenericPrimaryActionButton}" Width="125" Content="Submit Exception"/>
95+
<Button Margin="2,6,2,0" Style="{StaticResource GenericPrimaryActionButton}" Width="125" Content="Submit new Issue"/>
96+
<Button Margin="2,6,2,0" Style="{StaticResource GenericPrimaryActionButton}" Width="125" Content="Close"/>
97+
</StackPanel>
98+
99+
</Grid>
100+
101+
</Border>
102+
103+
</UserControl>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace SyncPlayWPF.Pages.ApplicationPages {
17+
/// <summary>
18+
/// Interaction logic for ExceptionView.xaml
19+
/// </summary>
20+
public partial class ExceptionView : UserControl {
21+
public ExceptionView() {
22+
InitializeComponent();
23+
}
24+
25+
public void ShowDisplay(Exception e) {
26+
ExceptionDetails.Text = e.Message + '\n' + e.StackTrace;
27+
}
28+
}
29+
}

SyncPlayWPF/SyncPlayWPF/Pages/NewSessionPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<RowDefinition Height="auto"/>
5656
<RowDefinition Height="auto"/>
5757
</Grid.RowDefinitions>
58-
<custom:PromptingLabel Text="localhost:5005" Grid.Row="0" x:Name="ServerAddressField" PromptingText="Server Address" FocusedUnderlineBrush="{StaticResource DarkMode_ContrastedGradient}"/>
58+
<custom:PromptingLabel Text="syncplay.pl:8995" Grid.Row="0" x:Name="ServerAddressField" PromptingText="Server Address" FocusedUnderlineBrush="{StaticResource DarkMode_ContrastedGradient}"/>
5959
<custom:PromptingLabel Text="sammy" Grid.Row="1" x:Name="UsernameField" PromptingText="Username" FocusedUnderlineBrush="{StaticResource DarkMode_ContrastedGradient}"/>
6060
<custom:PromptingPasswordBox Grid.Row="2" x:Name="PasswordField" PromptingText="Password" FocusedUnderlineBrush="{StaticResource DarkMode_ContrastedGradient}"/>
6161
<custom:PromptingLabel Text="ck" Grid.Row="3" x:Name="RoomNameField" PromptingText="Room Name" FocusedUnderlineBrush="{StaticResource DarkMode_ContrastedGradient}"/>

SyncPlayWPF/SyncPlayWPF/Pages/NewSessionPage.xaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ private void JoinRoom_Clicked(object sender, RoutedEventArgs e) {
3030
var password = PasswordField.ActualPassword;
3131
var roomName = RoomNameField.Text;
3232

33-
Console.WriteLine($"Server : {serverIp}:{serverPort}\n" +
33+
Console.WriteLine(
34+
$"Server : {serverIp}:{serverPort}\n" +
3435
$"Username : {username}\n" +
3536
$"Password : {password}\n" +
3637
$"Room Name : {roomName}");
3738

38-
Common.Shared.WindowPageTransition.ShowPage(new Pages.SessionLandingPage());
3939
Common.Shared.Wrapper = new SyncPlay.SyncPlayWrapper(
4040
serverIp,
4141
serverPort,
@@ -44,6 +44,9 @@ private void JoinRoom_Clicked(object sender, RoutedEventArgs e) {
4444
roomName,
4545
new SyncPlay.MediaPlayers.VLCMediaPlayer.Connector());
4646

47+
Common.Shared.WindowPageTransition.ShowPage(new Pages.SessionLandingPage());
48+
49+
4750
}
4851
}
4952
}

SyncPlayWPF/SyncPlayWPF/Pages/SessionLandingPage.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
</Grid.ColumnDefinitions>
9494

9595
<custom:ImageButton
96+
Click="ToggleSidePanel"
9697
Grid.Column="0"
9798
Image="{StaticResource CollapseButton}"
9899
Style="{StaticResource ImageSilhouette}"

0 commit comments

Comments
 (0)