From 1dbe2e1bb627a79b3499b28c2a91df31089a9450 Mon Sep 17 00:00:00 2001 From: timerix Date: Wed, 29 Nov 2023 11:31:35 +0600 Subject: [PATCH] initial commit --- .gitignore | 8 ++++++++ TicTacToe.sln | 16 ++++++++++++++++ TicTacToe/App.axaml | 10 ++++++++++ TicTacToe/App.axaml.cs | 23 +++++++++++++++++++++++ TicTacToe/Cell.axaml | 10 ++++++++++ TicTacToe/Cell.axaml.cs | 11 +++++++++++ TicTacToe/MainWindow.axaml | 18 ++++++++++++++++++ TicTacToe/MainWindow.axaml.cs | 35 +++++++++++++++++++++++++++++++++++ TicTacToe/Program.cs | 17 +++++++++++++++++ TicTacToe/TicTacToe.csproj | 18 ++++++++++++++++++ nuget.config | 6 ++++++ 11 files changed, 172 insertions(+) create mode 100644 .gitignore create mode 100644 TicTacToe.sln create mode 100644 TicTacToe/App.axaml create mode 100644 TicTacToe/App.axaml.cs create mode 100644 TicTacToe/Cell.axaml create mode 100644 TicTacToe/Cell.axaml.cs create mode 100644 TicTacToe/MainWindow.axaml create mode 100644 TicTacToe/MainWindow.axaml.cs create mode 100644 TicTacToe/Program.cs create mode 100644 TicTacToe/TicTacToe.csproj create mode 100644 nuget.config diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c1b75be --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +bin/ +obj/ +.idea/ +.vs/ +tmp/ +temp/ +packages/ +*.user diff --git a/TicTacToe.sln b/TicTacToe.sln new file mode 100644 index 0000000..76cbaea --- /dev/null +++ b/TicTacToe.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TicTacToe", "TicTacToe\TicTacToe.csproj", "{05A4D578-6136-42EC-B279-26B2D970325E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {05A4D578-6136-42EC-B279-26B2D970325E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {05A4D578-6136-42EC-B279-26B2D970325E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {05A4D578-6136-42EC-B279-26B2D970325E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {05A4D578-6136-42EC-B279-26B2D970325E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/TicTacToe/App.axaml b/TicTacToe/App.axaml new file mode 100644 index 0000000..767b3f6 --- /dev/null +++ b/TicTacToe/App.axaml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/TicTacToe/App.axaml.cs b/TicTacToe/App.axaml.cs new file mode 100644 index 0000000..6534e59 --- /dev/null +++ b/TicTacToe/App.axaml.cs @@ -0,0 +1,23 @@ +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; + +namespace TicTacToe; + +public partial class App : Application +{ + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } + + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + desktop.MainWindow = new MainWindow(); + } + + base.OnFrameworkInitializationCompleted(); + } +} \ No newline at end of file diff --git a/TicTacToe/Cell.axaml b/TicTacToe/Cell.axaml new file mode 100644 index 0000000..f01d175 --- /dev/null +++ b/TicTacToe/Cell.axaml @@ -0,0 +1,10 @@ + + X + diff --git a/TicTacToe/Cell.axaml.cs b/TicTacToe/Cell.axaml.cs new file mode 100644 index 0000000..d18fb3f --- /dev/null +++ b/TicTacToe/Cell.axaml.cs @@ -0,0 +1,11 @@ +using Avalonia.Controls; + +namespace TicTacToe; + +public partial class Cell : UserControl +{ + public Cell() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/TicTacToe/MainWindow.axaml b/TicTacToe/MainWindow.axaml new file mode 100644 index 0000000..bc01056 --- /dev/null +++ b/TicTacToe/MainWindow.axaml @@ -0,0 +1,18 @@ + + + 40 * + + + + + + + + diff --git a/TicTacToe/MainWindow.axaml.cs b/TicTacToe/MainWindow.axaml.cs new file mode 100644 index 0000000..0a6d1af --- /dev/null +++ b/TicTacToe/MainWindow.axaml.cs @@ -0,0 +1,35 @@ +using System; +using Avalonia.Controls; +using Avalonia.Interactivity; + +namespace TicTacToe; + +public partial class MainWindow : Window +{ + public MainWindow() + { + InitializeComponent(); + } + + + private void RestartButton_OnClick(object? sender, RoutedEventArgs e) + { + int size = Convert.ToInt32(SizeTextBox.Text); + GameGrid.Children.Clear(); + GameGrid.RowDefinitions = new RowDefinitions(); + for(int y=0; y BuildAvaloniaApp() + .StartWithClassicDesktopLifetime(args); + + // Avalonia configuration, don't remove; also used by visual designer. + public static AppBuilder BuildAvaloniaApp() + => AppBuilder.Configure() + .UsePlatformDetect() + .LogToTrace(); +} \ No newline at end of file diff --git a/TicTacToe/TicTacToe.csproj b/TicTacToe/TicTacToe.csproj new file mode 100644 index 0000000..79dd074 --- /dev/null +++ b/TicTacToe/TicTacToe.csproj @@ -0,0 +1,18 @@ + + + WinExe + net8.0 + enable + disable + true + true + + + + + + + + + + diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..9f40795 --- /dev/null +++ b/nuget.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file