Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ jobs:
run: For /R %%I in (*.sln) do dotnet build %%I
shell: cmd
- name: test
run: For /R %%I in (*.sln) do dotnet build %%I
run: For /R %%I in (*.sln) do dotnet test %%I
shell: cmd
14 changes: 14 additions & 0 deletions C#/forSpbu/RunningButton/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace RunningButton;

static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
private static void Main()
{
ApplicationConfiguration.Initialize();
Application.Run(new RunningButtonForm());
}
}
12 changes: 12 additions & 0 deletions C#/forSpbu/RunningButton/RunningButton.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>

</Project>
8 changes: 8 additions & 0 deletions C#/forSpbu/RunningButton/RunningButton.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Update="Form1.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
</Project>
53 changes: 53 additions & 0 deletions C#/forSpbu/RunningButton/RunningButtonForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions C#/forSpbu/RunningButton/RunningButtonForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
namespace RunningButton;

/// <summary>
/// Form class for the running button game
/// </summary>
public partial class RunningButtonForm : Form
{
/// <summary>
/// Creates form and initializes the button
/// </summary>
public RunningButtonForm()
{
InitializeComponent();
}

private enum Position
{
TopLeft,
TopRight,
BottomRight,
BottomLeft
}

private void OnEnter(object? sender, EventArgs eventArgs)
{
if (sender is not Button senderButton)
{
return;
}

switch (_buttonPosition)
{
case Position.TopLeft:
_buttonPosition += 1;
senderButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
senderButton.Location = new Point(Size.Width - senderButton.Size.Width, 0);
break;
case Position.TopRight:
_buttonPosition += 1;
senderButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
senderButton.Location = new Point(Size.Width - senderButton.Size.Width, Size.Height - senderButton.Size.Height);
break;
case Position.BottomRight:
_buttonPosition += 1;
senderButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
senderButton.Location = new Point(0, Size.Height - senderButton.Size.Height);
break;
case Position.BottomLeft:
_buttonPosition = 0;
senderButton.Anchor = AnchorStyles.Top | AnchorStyles.Left;
senderButton.Location = new Point(0, 0);
break;
}
}

private void OnClick(object? sender, EventArgs eventArgs)
{
if (sender is not Button)
{
return;
}

Close();
}
}
17 changes: 13 additions & 4 deletions C#/forSpbu/forSpbu.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "03.03", "03.03", "{882A9B9C
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "10.03", "10.03", "{EA6FC7D9-BDFB-49CD-AC00-FC5DDC5274B0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Exam2", "Exam2", "{187107A9-2FE0-4E91-AFE3-7F088370560A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RunningButton", "RunningButton\RunningButton.csproj", "{80CE2F13-4CBF-4AF2-81E4-8809FF8E5BB6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,12 +25,17 @@ Global
{E007586F-9760-4744-BB25-EDEFD6BA860C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E007586F-9760-4744-BB25-EDEFD6BA860C}.Release|Any CPU.Build.0 = Release|Any CPU
{A4F6ADD5-85FD-4F67-8B29-549DDDF6F82E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4F6ADD5-85FD-4F67-8B29-549DDDF6F82E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4F6ADD5-85FD-4F67-8B29-549DDDF6F82E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4F6ADD5-85FD-4F67-8B29-549DDDF6F82E}.Release|Any CPU.Build.0 = Release|Any CPU
{A4F6ADD5-85FD-4F67-8B29-549DDDF6F82E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4F6ADD5-85FD-4F67-8B29-549DDDF6F82E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4F6ADD5-85FD-4F67-8B29-549DDDF6F82E}.Release|Any CPU.Build.0 = Release|Any CPU
{80CE2F13-4CBF-4AF2-81E4-8809FF8E5BB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80CE2F13-4CBF-4AF2-81E4-8809FF8E5BB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80CE2F13-4CBF-4AF2-81E4-8809FF8E5BB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80CE2F13-4CBF-4AF2-81E4-8809FF8E5BB6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{E007586F-9760-4744-BB25-EDEFD6BA860C} = {D3FCB669-E93F-4F0B-B9C5-6592CE93AC7F}
{E007586F-9760-4744-BB25-EDEFD6BA860C} = {D3FCB669-E93F-4F0B-B9C5-6592CE93AC7F}
{A4F6ADD5-85FD-4F67-8B29-549DDDF6F82E} = {D3FCB669-E93F-4F0B-B9C5-6592CE93AC7F}
{80CE2F13-4CBF-4AF2-81E4-8809FF8E5BB6} = {187107A9-2FE0-4E91-AFE3-7F088370560A}
EndGlobalSection
EndGlobal