Add project files.

This commit is contained in:
Daniel Clark
2022-11-01 15:26:08 +00:00
parent daa7b59f22
commit 7e4f880821
408 changed files with 16863 additions and 0 deletions
+84
View File
@@ -0,0 +1,84 @@
<Application
x:Class="TheXamlGuy.App.WeddingDisplay.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<Application.Resources>
<FontFamily x:Key="ContentControlFontFamily">Segoe UI Variable Display</FontFamily>
<FontFamily x:Key="AccentFontFamily">Signature Collection</FontFamily>
<FontFamily x:Key="SemiLightContentControlFontFamily">Segoe UI Variable Display Semil</FontFamily>
<system:Double x:Key="CaptionTextBlockFontSize">12</system:Double>
<system:Double x:Key="BodyTextBlockFontSize">14</system:Double>
<system:Double x:Key="SubtitleTextBlockFontSize">20</system:Double>
<system:Double x:Key="TitleTextBlockFontSize">28</system:Double>
<system:Double x:Key="TitleLargeTextBlockFontSize">40</system:Double>
<system:Double x:Key="DisplayTextBlockFontSize">68</system:Double>
<system:Double x:Key="LargeDisplayTextBlockFontSize">120</system:Double>
<Style x:Key="BaseTextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="{StaticResource ContentControlFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource BodyTextBlockFontSize}" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="LineStackingStrategy" Value="MaxHeight" />
</Style>
<Style
x:Key="CaptionTextBlockStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="FontSize" Value="{StaticResource CaptionTextBlockFontSize}" />
<Setter Property="FontWeight" Value="Normal" />
</Style>
<Style
x:Key="BodyTextBlockStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="FontWeight" Value="Normal" />
</Style>
<Style
x:Key="BodyStrongTextBlockStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
TargetType="TextBlock" />
<Style
x:Key="SubtitleTextBlockStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="FontSize" Value="{StaticResource SubtitleTextBlockFontSize}" />
</Style>
<Style
x:Key="TitleTextBlockStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="FontSize" Value="{StaticResource TitleTextBlockFontSize}" />
</Style>
<Style
x:Key="TitleLargeTextBlockStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="FontSize" Value="{StaticResource TitleLargeTextBlockFontSize}" />
</Style>
<Style
x:Key="DisplayTextBlockStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="FontSize" Value="{StaticResource DisplayTextBlockFontSize}" />
</Style>
<Style
x:Key="LargeDisplayTextBlockStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="FontSize" Value="{StaticResource LargeDisplayTextBlockFontSize}" />
</Style>
</Application.Resources>
</Application>
+79
View File
@@ -0,0 +1,79 @@
using System.Windows;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using TheXamlGuy.Framework.WPF;
using WeddingBooth.Views;
using System.Reflection;
using System;
using System.IO;
using TheXamlGuy.Framework.Core;
using TheXamlGuy.Framework.Microcontroller;
using TheXamlGuy.Framework.Serial;
using TheXamlGuy.Framework.Camera;
using WeddingBooth.LifeCycles;
namespace TheXamlGuy.App.WeddingDisplay
{
public partial class App : Application
{
protected override async void OnStartup(StartupEventArgs args)
{
base.OnStartup(args);
IHost? host = new HostBuilder()
.UseContentRoot(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "WeddingBooth"), true)
.ConfigureAppConfiguration((context, configuration) =>
{
configuration.AddWritableJsonFile("Settings.json", false, true, writableConfiguration =>
{
writableConfiguration.AddDefaultFileStream(Assembly.GetExecutingAssembly().ExtractResource("Settings.json")!)
.AddDefaultConfiguration<StartupConfiguration>("Startup")
.AddDefaultConfiguration<NavigationConfiguration>("Navigation")
.AddDefaultConfiguration<MicrocontrollerConfiguration>("Microcontroller")
.AddDefaultConfiguration<RemoteCameraConfiguration>("RemoteCamera");
});
})
.ConfigureMicrocontrollers((context, builder) =>
{
builder.Add<MicrocontrollerConfiguration, SerialLineReader, string, MicrocontrollerModuleJsonDeserializer>(context.Configuration.GetSection("Microcontroller"))
.AddModule<CapactiveSensor>();
})
.ConfigureEvents(configuration =>
{
configuration.Add<SerialResponse<string>>().WithHandler(args => args);
configuration.Add<Navigated<NavigationView, NavigationViewModel>>().WithHandler(args => args);
configuration.Add<Captured>().WithHandler(args => args);
})
.ConfigureTemplates(configuration =>
{
configuration.Add<NavigationViewModel, NavigationView>("Navigation");
configuration.Add<WelcomeViewModel, WelcomeView>("Welcome");
configuration.Add<SeatingChartViewModel, SeatingChartView>("Seatings");
configuration.Add<CameraViewModel, CameraView>("Camera");
configuration.Add<GalleryViewModel, GalleryView>("Gallery");
})
.ConfigureCamera((context, builder) =>
{
builder.Add<RemoteCameraConfiguration>(context.Configuration.GetSection("RemoteCamera"));
})
.ConfigureServices(ConfigureServices)
.Build();
await host.RunAsync();
}
private void ConfigureServices(HostBuilderContext context, IServiceCollection services)
{
services.AddReqiredCore()
.AddRequiredWpf()
.AddHostedService<AppServices>()
.AddSingleton<MainWindow>()
.AddSingleton<MainWindowViewModel>()
.AddConfiguration<StartupConfiguration>(context.Configuration.GetSection("Startup"))
.AddConfiguration<NavigationConfiguration>(context.Configuration.GetSection("Navigation"))
.AddConfiguration<MicrocontrollerConfiguration>(context.Configuration.GetSection("Microcontroller"))
.AddConfiguration<RemoteCameraConfiguration>(context.Configuration.GetSection("RemoteCamera"))
.RegisterHandlers();
}
}
}
@@ -0,0 +1,35 @@
using Microsoft.Extensions.Hosting;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using TheXamlGuy.Framework.Camera;
using TheXamlGuy.Framework.Core;
namespace WeddingBooth.LifeCycles
{
public class CapturedHandler : IMediatorHandler<Captured>
{
private readonly IHostEnvironment hostEnvironment;
public CapturedHandler(IHostEnvironment hostEnvironment)
{
this.hostEnvironment = hostEnvironment;
}
public void Handle(Captured request)
{
if (request.Photo is Bitmap bitmap)
{
using Bitmap writableBitmap = new(bitmap);
string directory = Path.Combine(hostEnvironment.ContentRootPath, "Photos");
Directory.CreateDirectory(directory);
ImageCodecInfo encoder = ImageCodecInfo.GetImageEncoders().First(x => x.FormatID == ImageFormat.Jpeg.Guid);
EncoderParameters encoderParameters = new() { Param = new[] { new EncoderParameter(Encoder.Quality, 100L) } };
writableBitmap.Save($"{directory}\\{DateTime.Now:MMddyyyy-HHmmss}.jpg", encoder, encoderParameters);
}
}
}
}
@@ -0,0 +1,9 @@
using System.Collections.Generic;
namespace WeddingBooth.LifeCycles
{
public class NavigationConfiguration : List<string>
{
}
}
@@ -0,0 +1,39 @@
using TheXamlGuy.Framework.Core;
using TheXamlGuy.Framework.WPF;
using WeddingBooth.Views;
namespace WeddingBooth.LifeCycles
{
public class NavigationNavigatedHandler : IMediatorHandler<Navigated<NavigationView, NavigationViewModel>>
{
private readonly NavigationConfiguration configuration;
public NavigationNavigatedHandler(NavigationConfiguration configuration)
{
this.configuration = configuration;
}
public void Handle(Navigated<NavigationView, NavigationViewModel> request)
{
foreach (string navigation in configuration)
{
switch (navigation)
{
case "Welcome":
request.DataContext?.Add<WelcomeViewModel>();
break;
case "SeatingChart":
request.DataContext?.Add<SeatingChartViewModel>();
break;
case "Camera":
request.DataContext?.Add<CameraViewModel>();
break;
case "Gallery":
request.DataContext?.Add<GalleryViewModel>();
break;
}
}
}
}
}
@@ -0,0 +1,47 @@
using System.Linq;
using System.Windows;
using TheXamlGuy.Framework.Core;
using WeddingBooth.Views;
using WpfScreenHelper;
namespace WeddingBooth.LifeCycles
{
public class StartedHandler : IMediatorHandler<Started>
{
private readonly StartupConfiguration configuration;
private readonly MainWindow window;
private readonly MainWindowViewModel viewModel;
public StartedHandler(StartupConfiguration configuration,
MainWindow window,
MainWindowViewModel viewModel)
{
this.configuration = configuration;
this.window = window;
this.viewModel = viewModel;
}
public void Handle(Started request)
{
window.DataContext = viewModel;
window.Show();
if (configuration.Display is string display)
{
Screen? screen = Screen.AllScreens.FirstOrDefault(x => x.DeviceName.Contains(display, System.StringComparison.InvariantCultureIgnoreCase)) ?? Screen.AllScreens.FirstOrDefault();
if (screen is not null)
{
window.Left = screen.Bounds.Left;
window.Top = screen.Bounds.Top;
window.Width = screen.Bounds.Width;
window.Height = screen.Bounds.Height;
}
if (configuration.FullScreen)
{
window.WindowState = WindowState.Maximized;
}
}
}
}
}
@@ -0,0 +1,10 @@
namespace WeddingBooth.LifeCycles
{
public class StartupConfiguration
{
public bool FullScreen { get; set; }
public string? Display { get; set; }
}
}
+11
View File
@@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace WeddingBooth.LifeCycles
{
public class Table
{
public string? Name { get; set; }
public List<string> Guests { get; set; } = new List<string>();
}
}
@@ -0,0 +1,32 @@
using System;
using System.Drawing;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media.Imaging;
using TheXamlGuy.Framework.Camera;
using TheXamlGuy.UI.WPF;
namespace WeddingBooth.Markups
{
public class CapturedConverter : ValueConverter<Captured, BitmapSource>
{
[DllImport("gdi32.dll")]
private static extern bool DeleteObject(IntPtr hObject);
protected override BitmapSource? ConvertTo(Captured value, Type? targetType, object? parameter, CultureInfo? culture)
{
if (value.Photo is Bitmap bitmap)
{
IntPtr handle = bitmap.GetHbitmap();
BitmapSource image = Imaging.CreateBitmapSourceFromHBitmap(handle, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(value.Width, value.Height));
DeleteObject(handle);
return image;
}
return default;
}
}
}
@@ -0,0 +1,3 @@
using System.Windows;
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
+140
View File
@@ -0,0 +1,140 @@
{
"Startup": {
"Display": "DISPLAY2",
"FullScreen": true
},
"Navigation": [
"Welcome",
"Camera"
],
"Microcontroller": {
"PortName": "COM7",
"BaudRate": 9600
},
"RemoteCamera": {
"Name": "Test"
},
"SeatingChart": [
{
"Name": "one",
"Guests": [
"Lynne Lamb",
"Peter Lamb",
"Liam Lamb",
"Ryan Lamb",
"Mabel Lamb",
"Hayley Lamb",
"Nikki Rushton",
"John Clark",
"Rebecca Days"
]
},
{
"Name": "two",
"Guests": [
"Pauline Clough",
"John Clough",
"Ava Lamb-Clark",
"Nathan Clark",
"Emma Cunnington",
"George Clough",
"Vera Clough",
"Margaret Clayton"
]
},
{
"Name": "three",
"Guests": [
"Alex Clark",
"Anita Chan",
"Trevor Million",
"Lisa Iveson",
"Brian Clark",
"Brian Clark",
"Emma Lee",
"Lisa Clark",
"Siân Laura Davies"
]
},
{
"Name": "four",
"Guests": [
"Michael Lamb",
"Lesley Lamb",
"Ken Clough",
"Kathryn Dodds",
"Patricia Clough",
"Ann Peck",
"Greg Peck"
]
},
{
"Name": "five",
"Guests": [
"Olive Shorten",
"Lynne Shorten",
"Joyce Clark",
"Alison Clarke",
"Jim Clarke",
"Scott Thirlaway",
"Kevin McVittie",
"Katharyn Church",
"Eve Clark",
"Grace Clark"
]
},
{
"Name": "six",
"Guests": [
"Tom Parker",
"Amy Parker",
"Stephen Coates",
"Ashley Coates",
"Callie Coates",
"Ellie Coates",
"Colin Armstrong",
"Kelly Shearsmith",
"Jay Evans"
]
},
{
"Name": "seven",
"Guests": [
"Kelly Taylor",
"Phillip Taylor",
"Lucas Taylor",
"Lana Taylor",
"Christopher Lamb",
"Emma Hunter",
"Tommy",
"Livinya"
]
},
{
"Name": "eight",
"Guests": [
"Harry Clough",
"Jack Clough",
"Corey Derbyshire",
"Shauna Gallon",
"Lora Johnstone",
"Steven Clark",
"Michael Clarke",
"Nicole Wright"
]
},
{
"Name": "nine",
"Guests": [
"Vikki Finnigan",
"Logan Finnigan",
"Gemma Carr",
"Alysha Carr",
"Ross Finnigan",
"Jemma Clark",
"Lily-Rose Goddard",
"David Ford"
]
}
]
}
+143
View File
@@ -0,0 +1,143 @@
<UserControl
x:Class="WeddingBooth.Views.CameraView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:camera="clr-namespace:TheXamlGuy.Framework.Camera;assembly=Camera"
xmlns:markup="clr-namespace:WeddingBooth.Markups"
x:Name="Camera"
VisualStateExtension.IsStateTriggersAttached="True">
<UserControl.Resources>
<BindingProxy x:Key="BindingProxy" DataContext="{Binding}" />
<BindingProxy x:Key="CountdownProxy" DataContext="{Binding ElementName=Countdown}" />
<BindingProxy x:Key="CameraProxy" DataContext="{Binding ElementName=Camera}" />
<BindingProxy x:Key="ImageProxy" DataContext="{Binding ElementName=Image}" />
</UserControl.Resources>
<Grid>
<CameraPreview x:Name="CameraPreview">
<CameraPreview.LayoutTransform>
<RotateTransform Angle="90" />
</CameraPreview.LayoutTransform>
</CameraPreview>
<ProgressRing
x:Name="ProgressRing"
Width="500"
Height="500"
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsActive="True"
IsIndeterminate="True"
Opacity="0"
Thickness="12" />
<Countdown
x:Name="Countdown"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Completed="{Composite {State {Binding Source={StaticResource CameraProxy}, Path=DataContext},
Completed},
{ChangeProperty {Binding},
CanCapture,
false},
{Invoke Capture}}"
CountdownIdentifier="FiveSecond"
FontFamily="{StaticResource ContentControlFontFamily}"
FontSize="300"
Foreground="White"
TextBlock.FontWeight="Thin" />
<Image
x:Name="Image"
Opacity="0"
Stretch="Fill">
<Image.LayoutTransform>
<RotateTransform Angle="90" />
</Image.LayoutTransform>
</Image>
<Border
x:Name="FlashOverlay"
Background="White"
Opacity="0"
RenderTransformOrigin="0.5,0.5">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{StaticResource AccentFontFamily}"
FontSize="288"
Text="Smile!" />
<Border.RenderTransform>
<ScaleTransform x:Name="ScaleTransform" />
</Border.RenderTransform>
</Border>
</Grid>
<Interaction.XamlEventAggregator>
<XamlEventAggregator EventAggregator="{Binding Source={StaticResource BindingProxy}, Path=DataContext.EventAggregator}">
<EventSubscriber Invoked="{Composite {ChangeProperty {Binding Source={StaticResource ImageProxy}, Path=DataContext}, Source, {EventParameter Invoked, {markup:CapturedConverter}}}, {State {Binding Source={StaticResource CameraProxy}, Path=DataContext}, Captured}, {ChangeProperty {Binding}, CanCapture, true}}" Type="{x:Type camera:Captured}" />
</XamlEventAggregator>
</Interaction.XamlEventAggregator>
<Interaction.InteractiveFrame>
<InteractiveFrame EventAggregator="{Binding Source={StaticResource BindingProxy}, Path=DataContext.EventAggregator}">
<InteractiveFrameButton Invoked="{Composite {Condition {Binding CanCapture}, {Invoke Start, BindingTarget={Binding Source={StaticResource CountdownProxy}, Path=DataContext}}, {State {Binding Source={StaticResource CameraProxy}, Path=DataContext}, Started}}}" Placement="Top" />
</InteractiveFrame>
</Interaction.InteractiveFrame>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="PhotoStates">
<VisualState x:Name="Started">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ProgressRing" Storyboard.TargetProperty="(UIElement.Opacity)">
<DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Completed">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleX">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="2.05" />
<SplineDoubleKeyFrame
KeySpline="0,0,0,1"
KeyTime="00:00:00.250"
Value="1.0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleY">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="2.05" />
<SplineDoubleKeyFrame
KeySpline="0,0,0,1"
KeyTime="00:00:00.250"
Value="1.0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="FlashOverlay" Storyboard.TargetProperty="(UIElement.Opacity)">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0.0" />
<LinearDoubleKeyFrame KeyTime="00:00:00.167" Value="1.0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ProgressRing" Storyboard.TargetProperty="(UIElement.Opacity)">
<DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Captured">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Image" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1" />
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="1" />
<SplineDoubleKeyFrame KeyTime="00:00:04.168" Value="0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleX">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.0" />
<SplineDoubleKeyFrame
KeySpline="0,0,0,1"
KeyTime="00:00:00.167"
Value="1.05" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleY">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.0" />
<SplineDoubleKeyFrame
KeySpline="0,0,0,1"
KeyTime="00:00:00.167"
Value="1.05" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="FlashOverlay" Storyboard.TargetProperty="(UIElement.Opacity)">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.0" />
<LinearDoubleKeyFrame KeyTime="00:00:00.083" Value="0.0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</UserControl>
+16
View File
@@ -0,0 +1,16 @@
namespace WeddingBooth.Views;
public partial class CameraView
{
public CameraView()
{
InitializeComponent();
Loaded += CameraView_Loaded;
}
private void CameraView_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
CameraPreview.StartAsync();
}
}
+22
View File
@@ -0,0 +1,22 @@
using System;
using TheXamlGuy.Framework.Camera;
using TheXamlGuy.Framework.Core;
namespace WeddingBooth.Views;
public class CameraViewModel : ObservableViewModel
{
public CameraViewModel(IPropertyBuilder propertyBuilder,
IEventAggregator eventAggregator,
IServiceFactory serviceFactory,
IDisposer disposer) : base(propertyBuilder, eventAggregator, serviceFactory, disposer)
{
}
public bool CanCapture { get; set; } = true;
public void Capture()
{
EventAggregator.Publish<Capture>();
}
}
+14
View File
@@ -0,0 +1,14 @@
<UserControl x:Class="WeddingBooth.Views.GalleryView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WeddingBooth.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="100"
Text="GALLERY VIEW" />
</UserControl>
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WeddingBooth.Views
{
/// <summary>
/// Interaction logic for GalleryView.xaml
/// </summary>
public partial class GalleryView : UserControl
{
public GalleryView()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,14 @@
using TheXamlGuy.Framework.Core;
namespace WeddingBooth.Views;
public class GalleryViewModel : ObservableViewModel
{
public GalleryViewModel(IPropertyBuilder propertyBuilder,
IEventAggregator eventAggregator,
IServiceFactory serviceFactory,
IDisposer disposer) : base(propertyBuilder, eventAggregator, serviceFactory, disposer)
{
}
}
+17
View File
@@ -0,0 +1,17 @@
using TheXamlGuy.Framework.Core;
namespace WeddingBooth.Views;
public class GuestViewModel : ObservableViewModel
{
public GuestViewModel(IPropertyBuilder propertyBuilder,
IEventAggregator eventAggregator,
IServiceFactory serviceFactory,
IDisposer disposer,
string name) : base(propertyBuilder, eventAggregator, serviceFactory, disposer)
{
Name = name;
}
public string Name { get; }
}
+10
View File
@@ -0,0 +1,10 @@
<Window
x:Class="WeddingBooth.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Content="{Route {Binding Route},
Root}"
Loaded="{Navigate {Binding EventAggregator},
Root,
Navigation}"
WindowStyle="None" />
+23
View File
@@ -0,0 +1,23 @@
using System.Linq;
namespace WeddingBooth.Views;
public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
//var DeviceManager = new CameraDeviceManager();
//DeviceManager.ConnectToCamera();
//DeviceManager.AddDevice(d[3].Connect("192.168.1.1"));
//DeviceManager.CameraConnected += DeviceManager_CameraConnected;
//DeviceManager.SelectedCameraDevice.PhotoCaptured += SelectedCameraDevice_PhotoCaptured;
//DeviceManager.SelectedCameraDevice.CapturePhoto();
}
}
@@ -0,0 +1,18 @@
using TheXamlGuy.Framework.Core;
using TheXamlGuy.Framework.WPF;
namespace WeddingBooth.Views;
public class MainWindowViewModel : ObservableViewModel
{
public MainWindowViewModel(IPropertyBuilder propertyBuilder,
IEventAggregator eventAggregator,
IServiceFactory serviceFactory,
IDisposer disposer,
IRoute route) : base(propertyBuilder, eventAggregator, serviceFactory, disposer)
{
Route = route;
}
public IRoute Route { get; }
}
@@ -0,0 +1,20 @@
<UserControl
x:Class="WeddingBooth.Views.NavigationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Resources>
<BindingProxy x:Key="BindingProxy" DataContext="{Binding}" />
<BindingProxy x:Key="FlipViewProxy" DataContext="{Binding ElementName=FlipView}" />
</UserControl.Resources>
<FlipView
x:Name="FlipView"
ItemContainerTemplateSelector="{Binding TemplateSelector}"
ItemsSource="{Binding}"
UsesItemContainerTemplateSelector="True" />
<Interaction.InteractiveFrame>
<InteractiveFrame EventAggregator="{Binding Source={StaticResource BindingProxy}, Path=DataContext.EventAggregator}">
<InteractiveFrameButton Invoked="{Invoke Previous, BindingTarget={Binding Source={StaticResource FlipViewProxy}, Path=DataContext}}" Placement="Left" />
<InteractiveFrameButton Invoked="{Invoke Next, BindingTarget={Binding Source={StaticResource FlipViewProxy}, Path=DataContext}}" Placement="Right" />
</InteractiveFrame>
</Interaction.InteractiveFrame>
</UserControl>
@@ -0,0 +1,9 @@
namespace WeddingBooth.Views;
public partial class NavigationView
{
public NavigationView()
{
InitializeComponent();
}
}
@@ -0,0 +1,17 @@
using TheXamlGuy.Framework.Core;
namespace WeddingBooth.Views;
public class NavigationViewModel : ObservableViewModelCollection<IObservableViewModel>
{
public NavigationViewModel(IPropertyBuilder propertyBuilder,
IEventAggregator eventAggregator,
IServiceFactory serviceFactory,
IDisposer disposer,
ITemplateSelector templateSelector) : base(propertyBuilder, eventAggregator, serviceFactory, disposer)
{
TemplateSelector = templateSelector;
}
public ITemplateSelector TemplateSelector { get; }
}
@@ -0,0 +1,9 @@
using System.Collections.Generic;
namespace WeddingBooth.LifeCycles
{
public class SeatingChartConfiguration : List<Table>
{
}
}
@@ -0,0 +1,30 @@
using TheXamlGuy.Framework.Core;
using TheXamlGuy.Framework.WPF;
using WeddingBooth.Views;
namespace WeddingBooth.LifeCycles
{
public class SeatingChartNavigatedHandler : IMediatorHandler<Navigated<SeatingChartView, SeatingChartViewModel>>
{
private readonly SeatingChartConfiguration configuration;
public SeatingChartNavigatedHandler(SeatingChartConfiguration configuration)
{
this.configuration = configuration;
}
public void Handle(Navigated<SeatingChartView, SeatingChartViewModel> request)
{
foreach (Table table in configuration)
{
if(request.DataContext?.Add(table.Name) is TableViewModel tableViewModel)
{
foreach (string guest in table.Guests)
{
tableViewModel.Add(guest);
}
}
}
}
}
}
@@ -0,0 +1,30 @@
<UserControl
x:Class="WeddingBooth.Views.SeatingChartView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Margin="40,40,16,16">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="18" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
HorizontalAlignment="Center"
FontFamily="{StaticResource AccentFontFamily}"
FontWeight="Normal"
Style="{StaticResource LargeDisplayTextBlockStyle}"
Text="find your seat" />
<ItemsControl
Grid.Row="2"
ItemTemplateSelector="{Binding TemplateSelector}"
ItemsSource="{Binding}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="3" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Grid>
</UserControl>
@@ -0,0 +1,11 @@
using System.Windows.Controls;
namespace WeddingBooth.Views;
public partial class SeatingChartView : UserControl
{
public SeatingChartView()
{
InitializeComponent();
}
}
@@ -0,0 +1,17 @@
using TheXamlGuy.Framework.Core;
namespace WeddingBooth.Views;
public class SeatingChartViewModel : ObservableViewModelCollection<TableViewModel>
{
public SeatingChartViewModel(IPropertyBuilder propertyBuilder,
IEventAggregator eventAggregator,
IServiceFactory serviceFactory,
IDisposer disposer,
ITemplateSelector templateSelector) : base(propertyBuilder, eventAggregator, serviceFactory, disposer)
{
TemplateSelector = templateSelector;
}
public ITemplateSelector TemplateSelector { get; }
}
+43
View File
@@ -0,0 +1,43 @@
<UserControl
x:Class="WeddingBooth.Views.TableView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Resources>
<SolidColorBrush x:Key="BorderBrush" Color="#FF8C8C8C" />
</UserControl.Resources>
<Border
Margin="0,0,24,24"
BorderBrush="{StaticResource BorderBrush}"
BorderThickness="1">
<Grid Margin="24">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
HorizontalAlignment="Center"
FontFamily="{StaticResource AccentFontFamily}"
FontWeight="Normal"
FontSize="92"
Margin="0 0 0 -28"
Text="{Binding Name}" />
<ItemsControl
Grid.Row="2"
HorizontalAlignment="Center"
ItemsSource="{Binding}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock
Margin="0,0,0,2"
FontWeight="Thin"
Style="{StaticResource SubtitleTextBlockStyle}"
Text="{Binding Name}"
TextAlignment="Center" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Border>
</UserControl>
+9
View File
@@ -0,0 +1,9 @@
namespace WeddingBooth.Views;
public partial class TableView
{
public TableView()
{
InitializeComponent();
}
}
+17
View File
@@ -0,0 +1,17 @@
using TheXamlGuy.Framework.Core;
namespace WeddingBooth.Views;
public class TableViewModel : ObservableViewModelCollection<GuestViewModel>
{
public TableViewModel(IPropertyBuilder propertyBuilder,
IEventAggregator eventAggregator,
IServiceFactory serviceFactory,
IDisposer disposer,
string name) : base(propertyBuilder, eventAggregator, serviceFactory, disposer)
{
Name = name;
}
public string Name { get; }
}
+40
View File
@@ -0,0 +1,40 @@
<UserControl
x:Class="WeddingBooth.Views.WelcomeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock
Margin="0,-0,0,-60"
HorizontalAlignment="Center"
FontFamily="{StaticResource AccentFontFamily}"
FontSize="288"
FontWeight="Light"
Text="Welcome" />
<TextBlock
HorizontalAlignment="Center"
FontStretch="ExtraExpanded"
FontWeight="Thin"
Style="{StaticResource TitleTextBlockStyle}"
Text="TO OUR WEDDING" />
<TextBlock
HorizontalAlignment="Center"
FontStretch="ExtraExpanded"
FontWeight="Thin"
Style="{StaticResource DisplayTextBlockStyle}"
Text="LAURA &amp; DANIEL" />
<TextBlock
Margin="0,0,0,12"
HorizontalAlignment="Center"
FontStretch="ExtraExpanded"
FontWeight="Thin"
Style="{StaticResource TitleTextBlockStyle}"
Text="OCTOBER 6ᵗʰ, 2022" />
<TextBlock
HorizontalAlignment="Center"
FontStretch="ExtraExpanded"
FontWeight="Thin"
Style="{StaticResource TitleTextBlockStyle}"
Text="LET US MAKE MEMORIES OF OUR SPECIAL EVENING"
TextAlignment="Center" />
</StackPanel>
</UserControl>
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WeddingBooth.Views
{
/// <summary>
/// Interaction logic for WelcomeView.xaml
/// </summary>
public partial class WelcomeView : UserControl
{
public WelcomeView()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,15 @@
using TheXamlGuy.Framework.Core;
namespace WeddingBooth.Views;
public class WelcomeViewModel : ObservableViewModel
{
public WelcomeViewModel(IPropertyBuilder propertyBuilder,
IEventAggregator eventAggregator,
IServiceFactory serviceFactory,
IDisposer disposer) : base(propertyBuilder, eventAggregator, serviceFactory, disposer)
{
}
}
+29
View File
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.18362.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<None Remove="Settings.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Settings.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0-rc.2.22472.3" />
<PackageReference Include="WpfScreenHelper" Version="2.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Framework\Camera\Camera.csproj" />
<ProjectReference Include="..\..\Framework\Core\Core.csproj" />
<ProjectReference Include="..\..\Framework\Microcontroller\Microcontroller.csproj" />
<ProjectReference Include="..\..\Framework\Serial\Serial.csproj" />
<ProjectReference Include="..\..\Framework\WPF\WPF.csproj" />
<ProjectReference Include="..\..\Media\Capture\Capture.csproj" />
<ProjectReference Include="..\..\UI\WPF.Controls\WPF.Controls.csproj" />
<ProjectReference Include="..\..\UI\WPF\WPF.csproj" />
</ItemGroup>
</Project>