-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5f9140
commit 3da4221
Showing
102 changed files
with
5,113 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[*.cs] | ||
|
||
# CA1822: Mark members as static | ||
dotnet_diagnostic.CA1822.severity = none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.2.32630.192 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Compunet.SudokuSolver", "Compunet.SudokuSolver\Compunet.SudokuSolver.csproj", "{919C24F3-65B8-41A2-8156-A9A29FEC51FB}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A6841F4F-45FB-430C-BDCF-358343CDDCBD}" | ||
ProjectSection(SolutionItems) = preProject | ||
.editorconfig = .editorconfig | ||
EndProjectSection | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{919C24F3-65B8-41A2-8156-A9A29FEC51FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{919C24F3-65B8-41A2-8156-A9A29FEC51FB}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{919C24F3-65B8-41A2-8156-A9A29FEC51FB}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{919C24F3-65B8-41A2-8156-A9A29FEC51FB}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {C6C6CD8F-B694-45F7-BDC6-5E5B51478904} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Application x:Class="Compunet.SudokuSolver.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:Compunet.SudokuSolver"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="/Theming/Themes/LightTheme.xaml"/> | ||
<ResourceDictionary Source="/Theming/Fonts.xaml"/> | ||
<ResourceDictionary Source="/Theming/Icons.xaml"/> | ||
<ResourceDictionary Source="/Theming/ToolTip.xaml"/> | ||
<ResourceDictionary Source="/Theming/TextBox.xaml"/> | ||
<ResourceDictionary Source="/Theming/Buttons.xaml"/> | ||
<ResourceDictionary Source="/Theming/Windows.xaml"/> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Compunet.SudokuSolver.Container; | ||
using Compunet.SudokuSolver.Mvvm; | ||
using Compunet.SudokuSolver.Services; | ||
using Compunet.SudokuSolver.Theming.Themes; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using System.Windows; | ||
|
||
namespace Compunet.SudokuSolver | ||
{ | ||
public partial class App : Application | ||
{ | ||
protected override async void OnStartup(StartupEventArgs e) | ||
{ | ||
IServiceCollection services = new ServiceCollection(); | ||
ConfigureServices(services); | ||
|
||
IoC.CreateSimple(services); | ||
|
||
await IoC.Simple.GetRequiredService<ISettingsService>().Load(); | ||
await IoC.Simple.GetRequiredService<IThemeService>().Load(); | ||
|
||
MainWindow = new AppWindow(); | ||
MainWindow.Show(); | ||
} | ||
|
||
private IServiceCollection ConfigureServices(IServiceCollection services) | ||
{ | ||
return services.AddTransient<CreatePuzzleDialogViewModel>() | ||
.AddTransient<SudokuViewModel>() | ||
.AddTransient<AppWindowViewModel>() | ||
.AddTransient<AppSidebarViewModel>() | ||
.AddSingleton<ISudokuStoreService, SudokuStoreService>() | ||
.AddSingleton<ISudokuInputService, SudokuInputService>() | ||
.AddSingleton<ISettingsService, SettingsService>() | ||
.AddSingleton<ICreatePuzzleDialogService, CreatePuzzleDialogService>() | ||
.AddSingleton<IExitService, ExitService>() | ||
.AddSingleton<IThemeService, ThemeManager>(); | ||
} | ||
|
||
protected override void OnExit(ExitEventArgs e) | ||
{ | ||
IoC.Simple.GetRequiredService<IExitService>().OnExit(); | ||
IoC.Simple.GetRequiredService<ISettingsService>().Save().Wait(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<controls:BaseWindow | ||
x:Class="Compunet.SudokuSolver.AppWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:Compunet.SudokuSolver" | ||
mc:Ignorable="d" | ||
xmlns:controls="clr-namespace:Compunet.SudokuSolver.Controls" | ||
xmlns:views="clr-namespace:Compunet.SudokuSolver.Views" | ||
xmlns:converters="clr-namespace:Compunet.SudokuSolver.Mvvm.Converters" | ||
xmlns:mvvm="clr-namespace:Compunet.SudokuSolver.Mvvm" | ||
xmlns:wpf="clr-namespace:Compunet.SudokuSolver.Windows" | ||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors" | ||
xmlns:behavior="clr-namespace:Compunet.SudokuSolver.Behaviors" | ||
d:DataContext="{d:DesignInstance Type=mvvm:AppWindowViewModel}" | ||
WindowState="Maximized" | ||
FlowDirection="RightToLeft" | ||
Style="{StaticResource ThemeWindow}" | ||
MinHeight="700" | ||
MinWidth="{Binding ElementName=BoardControl, Path=ActualWidth}" | ||
Title="סודוקו" Height="450" Width="1000"> | ||
|
||
<Grid> | ||
|
||
<Grid Name="RootContent"> | ||
|
||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition x:Name="SidebarArea" Width="1*"/> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition Width="1*"/> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Grid Grid.Column="0"> | ||
|
||
<views:AppSidebarControl Width="60" HorizontalAlignment="Left"/> | ||
|
||
</Grid> | ||
|
||
<Grid Grid.Column="1" | ||
Name="BoardControl"> | ||
|
||
<Viewbox> | ||
|
||
<views:SudokuControl Margin="20" | ||
Width="500" | ||
Height="550"/> | ||
|
||
</Viewbox> | ||
|
||
</Grid> | ||
|
||
<!--<Grid> | ||
<controls:SubmitFeedbackPopupControl x:Name="SubmitFeedbackPopup"/> | ||
</Grid>--> | ||
|
||
</Grid> | ||
|
||
<Grid> | ||
<Border Name="OverlayBorder" | ||
Background="Black" | ||
Opacity="0" | ||
Visibility="Collapsed"/> | ||
</Grid> | ||
|
||
</Grid> | ||
|
||
</controls:BaseWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Compunet.SudokuSolver.Container; | ||
using Compunet.SudokuSolver.Controls; | ||
using Compunet.SudokuSolver.Mvvm; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using System.Windows; | ||
using System.Windows.Media.Effects; | ||
|
||
namespace Compunet.SudokuSolver | ||
{ | ||
public partial class AppWindow : BaseWindow, IWindowOverlayMode | ||
{ | ||
public AppWindow() | ||
{ | ||
InitializeComponent(); | ||
DataContext = IoC.Simple.GetRequiredService<AppWindowViewModel>(); | ||
} | ||
|
||
public void SetOverlay() | ||
{ | ||
OverlayBorder.Visibility = Visibility.Visible; | ||
OverlayBorder.Opacity = .5; | ||
Effect = new BlurEffect() { Radius = 10.0 }; | ||
} | ||
|
||
public void CancelOverlay() | ||
{ | ||
OverlayBorder.Opacity = 0; | ||
OverlayBorder.Visibility = Visibility.Collapsed; | ||
Effect = null; | ||
} | ||
} | ||
|
||
public interface IWindowOverlayMode | ||
{ | ||
void SetOverlay(); | ||
void CancelOverlay(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Windows; | ||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] |
38 changes: 38 additions & 0 deletions
38
Source/Compunet.SudokuSolver/Behaviors/InvokeCommandOnKeyDownBehavior.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Microsoft.Xaml.Behaviors; | ||
using System.Windows; | ||
using System.Windows.Input; | ||
|
||
namespace Compunet.SudokuSolver.Behaviors | ||
{ | ||
public class InvokeCommandOnKeyDownBehavior : Behavior<UIElement> | ||
{ | ||
public static readonly DependencyProperty CommandProperty = | ||
DependencyProperty.Register(nameof(Command), | ||
typeof(ICommand), | ||
typeof(InvokeCommandOnKeyDownBehavior), | ||
new PropertyMetadata(null)); | ||
|
||
|
||
public ICommand Command | ||
{ | ||
get => (ICommand)GetValue(CommandProperty); | ||
set => SetValue(CommandProperty, value); | ||
} | ||
|
||
|
||
protected override void OnAttached() | ||
{ | ||
AssociatedObject.KeyDown += AssociatedObject_KeyDown; | ||
} | ||
|
||
protected override void OnDetaching() | ||
{ | ||
AssociatedObject.KeyDown -= AssociatedObject_KeyDown; | ||
} | ||
|
||
private void AssociatedObject_KeyDown(object sender, KeyEventArgs e) | ||
{ | ||
Command?.Execute(e.Key); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
Source/Compunet.SudokuSolver/Behaviors/SidebarCollapseBehavior.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Microsoft.Xaml.Behaviors; | ||
using System.Windows; | ||
|
||
namespace Compunet.SudokuSolver.Behaviors | ||
{ | ||
public class SidebarCollapseBehavior : Behavior<FrameworkElement> | ||
{ | ||
public static readonly DependencyProperty HostActualWidthProperty = | ||
DependencyProperty.Register("HostActualWidth", | ||
typeof(double), | ||
typeof(SidebarCollapseBehavior), | ||
new PropertyMetadata(0.0, OnHostActualWidthChanged)); | ||
|
||
private static void OnHostActualWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | ||
{ | ||
} | ||
|
||
public double HostActualWidth | ||
{ | ||
get => (double)GetValue(HostActualWidthProperty); | ||
set => SetValue(HostActualWidthProperty, value); | ||
} | ||
|
||
|
||
|
||
protected override void OnAttached() | ||
{ | ||
|
||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
Source/Compunet.SudokuSolver/Behaviors/SystemWindowButtonBehavior.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Microsoft.Xaml.Behaviors; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace Compunet.SudokuSolver.Behaviors | ||
{ | ||
public abstract class SystemWindowButtonBehavior : Behavior<Button> | ||
{ | ||
public static readonly DependencyProperty TargetWindowProperty = | ||
DependencyProperty.Register(nameof(TargetWindow), | ||
typeof(Window), | ||
typeof(SystemWindowButtonBehavior), | ||
new PropertyMetadata(null)); | ||
|
||
public Window TargetWindow | ||
{ | ||
get => (Window)GetValue(TargetWindowProperty); | ||
set => SetValue(TargetWindowProperty, value); | ||
} | ||
|
||
protected override void OnAttached() | ||
{ | ||
AssociatedObject.Click += AssociatedObjectOnClick; | ||
base.OnAttached(); | ||
} | ||
|
||
protected override void OnDetaching() | ||
{ | ||
AssociatedObject.Click -= AssociatedObjectOnClick; | ||
base.OnDetaching(); | ||
} | ||
|
||
private void AssociatedObjectOnClick(object sender, RoutedEventArgs e) | ||
{ | ||
OnButtonClick(TargetWindow); | ||
} | ||
|
||
protected virtual void OnButtonClick(Window window) { } | ||
} | ||
|
||
|
||
} |
12 changes: 12 additions & 0 deletions
12
Source/Compunet.SudokuSolver/Behaviors/SystemWindowButtonCloseBehavior.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.Windows; | ||
|
||
namespace Compunet.SudokuSolver.Behaviors | ||
{ | ||
public class SystemWindowButtonCloseBehavior : SystemWindowButtonBehavior | ||
{ | ||
protected override void OnButtonClick(Window window) | ||
{ | ||
window?.Close(); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Source/Compunet.SudokuSolver/Behaviors/SystemWindowButtonMaximaizeBehavior.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.Windows; | ||
|
||
namespace Compunet.SudokuSolver.Behaviors | ||
{ | ||
public class SystemWindowButtonMaximaizeBehavior : SystemWindowButtonBehavior | ||
{ | ||
protected override void OnButtonClick(Window window) | ||
{ | ||
window.WindowState = window.WindowState | ||
== WindowState.Maximized | ||
? WindowState.Normal | ||
: WindowState.Maximized; | ||
} | ||
} | ||
|
||
|
||
} |
12 changes: 12 additions & 0 deletions
12
Source/Compunet.SudokuSolver/Behaviors/SystemWindowButtonMinimaizeBehavior.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.Windows; | ||
|
||
namespace Compunet.SudokuSolver.Behaviors | ||
{ | ||
public class SystemWindowButtonMinimaizeBehavior : SystemWindowButtonBehavior | ||
{ | ||
protected override void OnButtonClick(Window window) | ||
{ | ||
window.WindowState = WindowState.Minimized; | ||
} | ||
} | ||
} |
Oops, something went wrong.