Skip to content

Commit 87e9e1d

Browse files
committed
Add an "About Scribble" Window
1 parent 36c955d commit 87e9e1d

File tree

4 files changed

+92
-4
lines changed

4 files changed

+92
-4
lines changed

Scribble/Assets/about.png

441 Bytes
Loading

Scribble/ViewModels/MainViewModel.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics;
34
using System.IO;
45
using System.Linq;
56
using System.Text.Json;
@@ -10,6 +11,7 @@
1011
using Avalonia.Platform.Storage;
1112
using Avalonia.Threading;
1213
using CommunityToolkit.Mvvm.ComponentModel;
14+
using CommunityToolkit.Mvvm.Input;
1315
using Microsoft.AspNetCore.SignalR.Client;
1416
using Microsoft.Extensions.Configuration;
1517
using MsBox.Avalonia;
@@ -696,4 +698,22 @@ public async Task LeaveRoom()
696698
}
697699

698700
public HubConnectionState GetLiveDrawingServiceConnectionState() => _collaborativeDrawingService.ConnectionState;
701+
702+
[RelayCommand]
703+
private void OpenUrl(string url)
704+
{
705+
if (!string.IsNullOrEmpty(url))
706+
{
707+
try
708+
{
709+
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
710+
}
711+
catch (Exception ex)
712+
{
713+
// Hack for Linux if the above fails
714+
Process.Start("xdg-open", url);
715+
Console.WriteLine($"Could not open URL: {ex.Message}");
716+
}
717+
}
718+
}
699719
}

Scribble/Views/MainView.axaml

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@
146146
</StackPanel>
147147
</Button>
148148
<Rectangle Height="2" Fill="#49808080" />
149+
<Button Name="AboutOption" Margin="0" HorizontalAlignment="Stretch" Click="AboutOption_OnClick">
150+
<StackPanel Orientation="Horizontal" Spacing="4">
151+
<Image Source="avares://Scribble/Assets/about.png" Width="18" Height="18" />
152+
<Label FontSize="12">About Scribble</Label>
153+
</StackPanel>
154+
</Button>
149155
<Button Name="ExitOption" Margin="0" Click="ExitOption_OnClick" HorizontalAlignment="Stretch">
150156
<StackPanel Orientation="Horizontal" Spacing="4">
151157
<Image Source="avares://Scribble/Assets/exit.png" Width="18" Height="18" />
@@ -297,17 +303,17 @@
297303
</StackPanel.Styles>
298304
</StackPanel>
299305

300-
<!-- Multi-User Drawing Dialog -->
301-
<Panel>
306+
<!-- Collaborative Drawing Dialog -->
307+
<Panel Name="LiveDrawingWindow" IsVisible="False">
302308
<!-- Invisible Background that catches clicks -->
303309
<Rectangle Name="LiveDrawingWindowOverlay"
304310
Fill="Transparent"
305311
IsVisible="False" PointerPressed="LiveDrawingWindowOverlay_OnPointerPressed" />
306312

307-
<Border Name="LiveDrawingWindow" HorizontalAlignment="Center" VerticalAlignment="Center"
313+
<Border HorizontalAlignment="Center" VerticalAlignment="Center"
308314
Background="#2B2B2B"
309315
Padding="18"
310-
CornerRadius="12" IsVisible="False">
316+
CornerRadius="12">
311317
<StackPanel MinWidth="400" Spacing="12">
312318
<TextBlock HorizontalAlignment="Center" Foreground="#AAAAAA" Margin="0, 0, 0, 12">Collaborative Drawing (DEMO)</TextBlock>
313319
<StackPanel Orientation="Vertical" Spacing="8">
@@ -353,5 +359,49 @@
353359
</StackPanel>
354360
</Border>
355361
</Panel>
362+
363+
<!-- About Scribble Modal -->
364+
<Panel Name="AboutScribbleWindow" IsVisible="False">
365+
<!-- Invisible Background that catches clicks -->
366+
<Rectangle Name="AboutScribbleWindowOverlay"
367+
Fill="Transparent"
368+
IsVisible="False" PointerPressed="AboutScribbleOverlay_OnPointerPressed" />
369+
370+
<Border HorizontalAlignment="Center" VerticalAlignment="Center"
371+
Background="#2B2B2B"
372+
Padding="18"
373+
CornerRadius="12">
374+
<StackPanel MaxWidth="600" Spacing="12">
375+
<TextBlock HorizontalAlignment="Center" Foreground="#AAAAAA" Margin="0, 0, 0, 12">About Scribble</TextBlock>
376+
<StackPanel Orientation="Vertical" Spacing="12">
377+
<StackPanel Orientation="Vertical" Spacing="4">
378+
<TextBlock TextWrapping="Wrap" FontWeight="ExtraLight">
379+
Scribble is a cross-platform digital whiteboard program built with C#/.NET, AvaloniaUI, SignalR, SkiaSharp.
380+
</TextBlock>
381+
<TextBlock TextWrapping="Wrap" FontWeight="ExtraLight">
382+
I got bored of doing another web-based project so I decided to pick up C#/.NET and Avalonia by building this
383+
</TextBlock>
384+
</StackPanel>
385+
386+
<StackPanel Orientation="Vertical" Spacing="4">
387+
<TextBlock TextWrapping="Wrap" Foreground="WhiteSmoke">
388+
Scribble v0.1.0-alpha, by
389+
<HyperlinkButton Content="Hermes"
390+
Padding="0"
391+
Margin="0"
392+
Command="{Binding OpenUrlCommand}"
393+
CommandParameter="https://github.com/TruePadawan" />
394+
</TextBlock>
395+
<HyperlinkButton Name="Icons8Button"
396+
Content="Icons by Icons8"
397+
Padding="0"
398+
Margin="0"
399+
Command="{Binding OpenUrlCommand}"
400+
CommandParameter="http://icons8.com/icons" />
401+
</StackPanel>
402+
</StackPanel>
403+
</StackPanel>
404+
</Border>
405+
</Panel>
356406
</Panel>
357407
</UserControl>

Scribble/Views/MainView.axaml.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,13 @@ private void CloseLiveDrawingWindow()
475475
{
476476
LiveDrawingWindow.IsVisible = false;
477477
LiveDrawingWindowOverlay.IsVisible = false;
478+
Dispatcher.UIThread.Post(() => CanvasContainer.Focus());
479+
}
478480

481+
private void CloseAboutScribbleWindow()
482+
{
483+
AboutScribbleWindow.IsVisible = false;
484+
AboutScribbleWindowOverlay.IsVisible = false;
479485
Dispatcher.UIThread.Post(() => CanvasContainer.Focus());
480486
}
481487

@@ -677,4 +683,16 @@ private void RoomIdTextBox_OnTextChanged(object? sender, TextChangedEventArgs e)
677683
}
678684
}
679685
}
686+
687+
private void AboutScribbleOverlay_OnPointerPressed(object? sender, PointerPressedEventArgs e)
688+
{
689+
CloseAboutScribbleWindow();
690+
}
691+
692+
private void AboutOption_OnClick(object? sender, RoutedEventArgs e)
693+
{
694+
CloseMenu();
695+
AboutScribbleWindow.IsVisible = true;
696+
AboutScribbleWindowOverlay.IsVisible = true;
697+
}
680698
}

0 commit comments

Comments
 (0)