Skip to content

Commit 22f30b4

Browse files
open project works
1 parent 06933f7 commit 22f30b4

18 files changed

+2583
-233
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
.vs/
22
Counter/obj/
3+
Counter/bin/
4+
Windows/obj/
5+
Windows/bin/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "Counter/submodules"]
2+
path = Counter/submodules
3+
url = https://github.com/Splitwirez/avalonia-aero-theme

Counter.sln

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
4-
VisualStudioVersion = 17.13.35716.79 d17.13
4+
VisualStudioVersion = 17.13.35716.79
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Counter", "Counter\Counter.csproj", "{B7ECF9E1-6808-4F83-BC8E-C6B940D82304}"
77
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Windows", "Windows\Windows.csproj", "{48DAB9C0-0C77-40C4-BF07-F12C0BDA2C43}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
1517
{B7ECF9E1-6808-4F83-BC8E-C6B940D82304}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{B7ECF9E1-6808-4F83-BC8E-C6B940D82304}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{B7ECF9E1-6808-4F83-BC8E-C6B940D82304}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{48DAB9C0-0C77-40C4-BF07-F12C0BDA2C43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{48DAB9C0-0C77-40C4-BF07-F12C0BDA2C43}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{48DAB9C0-0C77-40C4-BF07-F12C0BDA2C43}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{48DAB9C0-0C77-40C4-BF07-F12C0BDA2C43}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE

Counter/App.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

Counter/Assets/Fonts/SEGUIVAR.TTF

1.77 MB
Binary file not shown.

Counter/ControlsExtensions.cs

Lines changed: 118 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,148 @@
11
using Avalonia.Controls;
22
using Avalonia.Controls.Primitives;
3+
using Avalonia.Input;
34
using Avalonia.Interactivity;
45

5-
namespace Counter
6+
namespace Counter;
7+
8+
public static class ControlsExtensions
69
{
7-
public static class ControlsExtensions
10+
public static T OnKeyDown<T>(this T element, params Action<T, KeyEventArgs>[] callbacks) where T : InputElement
811
{
9-
public static Button OnClick(this Button button, params Action<Button, RoutedEventArgs>[] callbacks)
12+
for (int i = 0; i < callbacks.Length; i++)
1013
{
11-
for (int i = 0; i < callbacks.Length; i++)
12-
{
13-
int index = 0;
14-
button.Click += (obj, args) => callbacks[index]((Button)obj!, args);
15-
}
16-
17-
return button;
14+
int index = 0;
15+
element.KeyDown += (obj, args) => callbacks[index]((T)obj!, args);
1816
}
1917

20-
public static Button OnClick(this Button button, Action<Button, RoutedEventArgs> callback)
18+
return element;
19+
}
20+
21+
public static T OnKeyDown<T>(this T element, Action<T, KeyEventArgs> callback) where T : InputElement
22+
{
23+
element.KeyDown += (obj, args) => callback((T)obj!, args);
24+
return element;
25+
}
26+
27+
public static Button OnClick(this Button button, params Action<Button, RoutedEventArgs>[] callbacks)
28+
{
29+
for (int i = 0; i < callbacks.Length; i++)
2130
{
22-
button.Click += (obj, args) => callback((Button)obj!, args);
23-
return button;
31+
int index = 0;
32+
button.Click += (obj, args) => callbacks[index]((Button)obj!, args);
2433
}
2534

26-
public static Button OnClick(this Button button, params Action[] callbacks)
27-
{
28-
for (int i = 0; i < callbacks.Length; i++)
29-
{
30-
int index = 0;
31-
button.Click += (obj, args) => callbacks[index]();
32-
}
35+
return button;
36+
}
3337

34-
return button;
35-
}
38+
public static Button OnClick(this Button button, Action<Button, RoutedEventArgs> callback)
39+
{
40+
button.Click += (obj, args) => callback((Button)obj!, args);
41+
return button;
42+
}
3643

37-
public static Button OnClick(this Button button, Action callback)
44+
public static Button OnClick(this Button button, params Action[] callbacks)
45+
{
46+
for (int i = 0; i < callbacks.Length; i++)
3847
{
39-
button.Click += (obj, args) => callback();
40-
return button;
48+
int index = 0;
49+
button.Click += (obj, args) => callbacks[index]();
4150
}
4251

43-
public static Panel AddChildren(this Panel control, params Control[] children)
44-
{
45-
control.Children.AddRange(children);
46-
return control;
47-
}
52+
return button;
53+
}
4854

49-
public static ItemsControl AddItems(this ItemsControl control, params object[] items)
50-
{
51-
for (int i = 0; i < items.Length; i++)
52-
control.Items.Add(items[i]);
53-
return control;
54-
}
55+
public static Button OnClick(this Button button, Action callback)
56+
{
57+
button.Click += (obj, args) => callback();
58+
return button;
59+
}
5560

56-
public static MenuItem AddItems(this MenuItem menu, params MenuItem[] menuItems)
57-
{
58-
for (int i = 0; i < menuItems.Length; i++)
59-
menu.Items.Add(menuItems[i]);
60-
return menu;
61-
}
61+
public static Panel AddChildren(this Panel control, params Control[] children)
62+
{
63+
control.Children.AddRange(children);
64+
return control;
65+
}
6266

63-
public static TabControl AddItems(this TabControl tabControl, TabItem[] items)
64-
{
65-
for (int i = 0; i < items.Length; i++)
66-
tabControl.Items.Add(items[i]);
67-
return tabControl;
68-
}
67+
public static ItemsControl AddItems(this ItemsControl control, params object[] items)
68+
{
69+
for (int i = 0; i < items.Length; i++)
70+
control.Items.Add(items[i]);
71+
return control;
72+
}
6973

70-
public static T SetDock<T>(this T control, Dock dock) where T : Control
71-
{
72-
control.SetValue(DockPanel.DockProperty, dock);
73-
return control;
74-
}
74+
public static MenuItem AddItems(this MenuItem menu, params MenuItem[] menuItems)
75+
{
76+
for (int i = 0; i < menuItems.Length; i++)
77+
menu.Items.Add(menuItems[i]);
78+
return menu;
79+
}
7580

76-
public static T SetGrid<T>(this T control, int column, int row, int columnSpan = 1, int rowSpan = 1) where T : Control
77-
{
78-
if (column != 0)
79-
SetColumn(control, column);
80-
if (row != 0)
81-
SetRow(control, row);
82-
if (columnSpan != 1)
83-
SetColumnSpan(control, columnSpan);
84-
if (rowSpan != 1)
85-
SetRowSpan(control, rowSpan);
86-
return control;
87-
}
81+
public static TabControl AddItems(this TabControl tabControl, TabItem[] items)
82+
{
83+
for (int i = 0; i < items.Length; i++)
84+
tabControl.Items.Add(items[i]);
85+
return tabControl;
86+
}
8887

89-
public static T SetColumn<T>(this T control, int value) where T : Control
90-
{
91-
control.SetValue(Grid.ColumnProperty, value);
92-
return control;
93-
}
88+
public static T SetDock<T>(this T control, Dock dock) where T : Control
89+
{
90+
control.SetValue(DockPanel.DockProperty, dock);
91+
return control;
92+
}
9493

95-
public static T SetRow<T>(this T control, int value) where T : Control
96-
{
97-
control.SetValue(Grid.RowProperty, value);
98-
return control;
99-
}
94+
public static T SetGrid<T>(this T control, int column, int row, int columnSpan = 1, int rowSpan = 1) where T : Control
95+
{
96+
if (column != 0)
97+
SetColumn(control, column);
98+
if (row != 0)
99+
SetRow(control, row);
100+
if (columnSpan != 1)
101+
SetColumnSpan(control, columnSpan);
102+
if (rowSpan != 1)
103+
SetRowSpan(control, rowSpan);
104+
return control;
105+
}
100106

101-
public static T SetColumnSpan<T>(this T control, int value) where T : Control
102-
{
103-
control.SetValue(Grid.ColumnSpanProperty, value);
104-
return control;
105-
}
107+
public static T SetColumn<T>(this T control, int value) where T : Control
108+
{
109+
control.SetValue(Grid.ColumnProperty, value);
110+
return control;
111+
}
106112

107-
public static T SetRowSpan<T>(this T control, int value) where T : Control
108-
{
109-
control.SetValue(Grid.RowSpanProperty, value);
110-
return control;
111-
}
113+
public static T SetRow<T>(this T control, int value) where T : Control
114+
{
115+
control.SetValue(Grid.RowProperty, value);
116+
return control;
117+
}
112118

113-
public static T SetTooltip<T>(this T control, string tooltip) where T : Control
114-
{
115-
control.SetValue(ToolTip.TipProperty, tooltip);
116-
return control;
117-
}
119+
public static T SetColumnSpan<T>(this T control, int value) where T : Control
120+
{
121+
control.SetValue(Grid.ColumnSpanProperty, value);
122+
return control;
123+
}
118124

119-
public static T OnSelectionChanged<T>(this T control, Action action) where T : SelectingItemsControl
120-
{
121-
control.SelectionChanged += (_, _) => action();
122-
return control;
123-
}
125+
public static T SetRowSpan<T>(this T control, int value) where T : Control
126+
{
127+
control.SetValue(Grid.RowSpanProperty, value);
128+
return control;
129+
}
130+
131+
public static T SetTooltip<T>(this T control, string tooltip) where T : Control
132+
{
133+
control.SetValue(ToolTip.TipProperty, tooltip);
134+
return control;
135+
}
136+
137+
public static T OnSelectionChanged<T>(this T control, Action action) where T : SelectingItemsControl
138+
{
139+
control.SelectionChanged += (_, _) => action();
140+
return control;
141+
}
142+
143+
public static T OnTextChanged<T>(this T control, Action action) where T : Control
144+
{
145+
control.SizeChanged += (_, e) => action();
146+
return control;
124147
}
125148
}

Counter/Counter.csproj

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,49 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
4+
<OutputType>Library</OutputType>
55
<TargetFramework>net9.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<PublishAot>true</PublishAot>
9+
<AssemblyName>Counter</AssemblyName>
10+
<PublishTrimmed>True</PublishTrimmed>
11+
</PropertyGroup>
12+
13+
<!--for optimization-->
14+
<PropertyGroup Condition="'$(Configuration)' != 'Debug'">
15+
<NoWin32Manifest>true</NoWin32Manifest>
16+
<OptimizationPreference>size</OptimizationPreference>
17+
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
18+
<DebugType>none</DebugType>
19+
<InvariantGlobalization>false</InvariantGlobalization>
20+
<StackTraceSupport>false</StackTraceSupport>
21+
<UseSystemResourceKeys>true</UseSystemResourceKeys>
922
</PropertyGroup>
1023

1124
<ItemGroup>
1225
<PackageReference Include="Avalonia" Version="11.2.4" />
26+
<!--<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.2.4" />-->
1327
<PackageReference Include="Avalonia.Desktop" Version="11.2.4" />
14-
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.4" />
1528
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.4" />
16-
<PackageReference Include="Avalonia.Themes.Simple" Version="11.2.4" />
17-
<PackageReference Include="Classic.Avalonia.Theme" Version="11.2.0.7" />
18-
<PackageReference Include="Material.Avalonia" Version="3.9.2" />
29+
<!--<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.4" />-->
30+
<!--<PackageReference Include="Avalonia.Themes.Simple" Version="11.2.4" />-->
31+
<!--<PackageReference Include="Classic.Avalonia.Theme" Version="11.2.0.7" />-->
32+
<PackageReference Include="FluentAvaloniaUI" Version="2.2.0" />
33+
<!--<PackageReference Include="GridExtra.Avalonia" Version="0.9.1" />-->
34+
<!--<PackageReference Include="Material.Avalonia" Version="3.9.2" />-->
1935
<PackageReference Include="MessageBox.Avalonia" Version="3.2.0" />
20-
<PackageReference Include="Semi.Avalonia" Version="11.2.1.4" />
36+
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
37+
<!--<PackageReference Include="Semi.Avalonia" Version="11.2.1.4" />-->
38+
</ItemGroup>
39+
40+
<PropertyGroup>
41+
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
42+
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
43+
</PropertyGroup>
44+
45+
<ItemGroup>
46+
<AvaloniaResource Include="Assets\**" />
2147
</ItemGroup>
2248

2349
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
@@ -29,5 +55,11 @@
2955
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
3056
<DefineConstants>$(DefineConstants);OS_MAC</DefineConstants>
3157
</PropertyGroup>
58+
<PropertyGroup Label="Avalonia">
59+
<AvaloniaUseCompiledBindingsByDefault>True</AvaloniaUseCompiledBindingsByDefault>
60+
<EnableAvaloniaXamlCompilation>False</EnableAvaloniaXamlCompilation>
61+
<AvaloniaXamlIlDebuggerLaunch>False</AvaloniaXamlIlDebuggerLaunch>
62+
<AvaloniaXamlReportImportance>Normal</AvaloniaXamlReportImportance>
63+
</PropertyGroup>
3264

3365
</Project>

Counter/Counter.csproj.user

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
4+
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
5+
</PropertyGroup>
6+
<PropertyGroup>
7+
<ActiveDebugProfile>Counter</ActiveDebugProfile>
8+
<_LastSelectedProfileId>E:\source\Counter\Counter\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
9+
</PropertyGroup>
10+
</Project>

0 commit comments

Comments
 (0)