Skip to content

Commit

Permalink
WndSclAmount and github 60 check handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Stelusteee committed Dec 8, 2024
1 parent f7a54a7 commit 4ab9f2e
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 52 deletions.
Binary file modified .vs/BombTimer/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified .vs/BombTimer/v17/.futdcache.v2
Binary file not shown.
Binary file modified .vs/BombTimer/v17/.suo
Binary file not shown.
68 changes: 42 additions & 26 deletions .vs/BombTimer/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
"RelativeMoniker": "D:0:0:{3C394F86-AE6C-4D5B-8875-A51878CC3F7C}|BombTimer\\BombTimer.csproj|solutionrelative:bombtimer\\wnd.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{3C394F86-AE6C-4D5B-8875-A51878CC3F7C}|BombTimer\\BombTimer.csproj|c:\\users\\stelu\\source\\repos\\bombtimer\\bombtimer\\helpwnd.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{3C394F86-AE6C-4D5B-8875-A51878CC3F7C}|BombTimer\\BombTimer.csproj|solutionrelative:bombtimer\\helpwnd.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
"AbsoluteMoniker": "D:0:0:{3C394F86-AE6C-4D5B-8875-A51878CC3F7C}|BombTimer\\BombTimer.csproj|c:\\users\\stelu\\source\\repos\\bombtimer\\bombtimer\\wnd.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{3C394F86-AE6C-4D5B-8875-A51878CC3F7C}|BombTimer\\BombTimer.csproj|solutionrelative:bombtimer\\wnd.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{3C394F86-AE6C-4D5B-8875-A51878CC3F7C}|BombTimer\\BombTimer.csproj|c:\\users\\stelu\\source\\repos\\bombtimer\\bombtimer\\helpwnd.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{3C394F86-AE6C-4D5B-8875-A51878CC3F7C}|BombTimer\\BombTimer.csproj|solutionrelative:bombtimer\\helpwnd.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
"AbsoluteMoniker": "D:0:0:{3C394F86-AE6C-4D5B-8875-A51878CC3F7C}|BombTimer\\BombTimer.csproj|c:\\users\\stelu\\source\\repos\\bombtimer\\bombtimer\\updatenotifier.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{3C394F86-AE6C-4D5B-8875-A51878CC3F7C}|BombTimer\\BombTimer.csproj|solutionrelative:bombtimer\\updatenotifier.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{3C394F86-AE6C-4D5B-8875-A51878CC3F7C}|BombTimer\\BombTimer.csproj|c:\\users\\stelu\\source\\repos\\bombtimer\\bombtimer\\updatenotifier.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{3C394F86-AE6C-4D5B-8875-A51878CC3F7C}|BombTimer\\BombTimer.csproj|solutionrelative:bombtimer\\updatenotifier.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{3C394F86-AE6C-4D5B-8875-A51878CC3F7C}|BombTimer\\BombTimer.csproj|c:\\users\\stelu\\source\\repos\\bombtimer\\bombtimer\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
Expand All @@ -39,40 +43,40 @@
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\Program.cs",
"RelativeDocumentMoniker": "BombTimer\\Program.cs",
"ToolTip": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\Program.cs",
"RelativeToolTip": "BombTimer\\Program.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABAAAAAOAAAAAAAAAA==",
"Title": "UpdateNotifier.cs",
"DocumentMoniker": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\UpdateNotifier.cs",
"RelativeDocumentMoniker": "BombTimer\\UpdateNotifier.cs",
"ToolTip": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\UpdateNotifier.cs",
"RelativeToolTip": "BombTimer\\UpdateNotifier.cs",
"ViewState": "AgIAAAMAAAAAAAAAAAAAAAgAAAAiAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-15T09:55:17.372Z",
"WhenOpened": "2024-12-08T06:43:27.149Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "HelpWnd.cs",
"DocumentMoniker": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\HelpWnd.cs",
"RelativeDocumentMoniker": "BombTimer\\HelpWnd.cs",
"ToolTip": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\HelpWnd.cs",
"RelativeToolTip": "BombTimer\\HelpWnd.cs",
"ViewState": "AgIAABIAAAAAAAAAAAAAACgAAABRAAAAAAAAAA==",
"Title": "UpdateNotifier.Designer.cs",
"DocumentMoniker": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\UpdateNotifier.Designer.cs",
"RelativeDocumentMoniker": "BombTimer\\UpdateNotifier.Designer.cs",
"ToolTip": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\UpdateNotifier.Designer.cs",
"RelativeToolTip": "BombTimer\\UpdateNotifier.Designer.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAACwAAAANAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-14T19:21:50.444Z",
"WhenOpened": "2024-12-08T06:43:11.376Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "HelpWnd.Designer.cs",
"DocumentMoniker": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\HelpWnd.Designer.cs",
"RelativeDocumentMoniker": "BombTimer\\HelpWnd.Designer.cs",
"ToolTip": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\HelpWnd.Designer.cs",
"RelativeToolTip": "BombTimer\\HelpWnd.Designer.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAKUAAAAdAAAAAAAAAA==",
"Title": "Wnd.Designer.cs",
"DocumentMoniker": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\Wnd.Designer.cs",
"RelativeDocumentMoniker": "BombTimer\\Wnd.Designer.cs",
"ToolTip": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\Wnd.Designer.cs",
"RelativeToolTip": "BombTimer\\Wnd.Designer.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAO4AAAAsAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-14T18:08:31.234Z",
"WhenOpened": "2024-11-23T18:22:29.753Z",
"EditorCaption": ""
},
{
Expand All @@ -83,10 +87,22 @@
"RelativeDocumentMoniker": "BombTimer\\Wnd.cs",
"ToolTip": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\Wnd.cs",
"RelativeToolTip": "BombTimer\\Wnd.cs",
"ViewState": "AgIAAJwAAAAAAAAAAAAAAKwAAAAhAAAAAAAAAA==",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAwAAAApAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-13T17:17:34.604Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\Program.cs",
"RelativeDocumentMoniker": "BombTimer\\Program.cs",
"ToolTip": "C:\\Users\\stelu\\source\\repos\\BombTimer\\BombTimer\\Program.cs",
"RelativeToolTip": "BombTimer\\Program.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAgAAAAjAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-15T09:55:17.372Z"
}
]
}
Expand Down
4 changes: 0 additions & 4 deletions BombTimer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@ static void Main()
}
}

// Don't worry if it looks stuck: setup and updatedownloader [DONE]
// Don't override the save file [DONE]
// Valve themed UI [DONE]
// Never ask update again [CANCELED]
// Uninstaller
// Project timer
30 changes: 29 additions & 1 deletion BombTimer/UpdateNotifier.Designer.cs

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

4 changes: 2 additions & 2 deletions BombTimer/UpdateNotifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ public UpdateNotifier()
InitializeComponent();

float dpiScale = 144f / DeviceDpi;
PointF scaleFactor = new PointF((float)Width / 500, (float)Height / 200);
PointF scaleFactor = new ((float)Width / 500, (float)Height / 200);

label1.Location = new Point((int)(12 * scaleFactor.X), (int)(9 * scaleFactor.Y));
label1.Font = new Font("Arial", 10F * dpiScale * scaleFactor.X, FontStyle.Bold, GraphicsUnit.Point, 0);
label1.Font = new Font("Arial", 10F * dpiScale * scaleFactor.X, FontStyle.Regular, GraphicsUnit.Point, 0);

label2.Location = new Point((int)(51 * scaleFactor.X), (int)(88 * scaleFactor.Y));
label2.Font = new Font("Arial", 10F * dpiScale * scaleFactor.X, FontStyle.Regular, GraphicsUnit.Point, 0);
Expand Down
4 changes: 1 addition & 3 deletions BombTimer/Wnd.Designer.cs

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

42 changes: 26 additions & 16 deletions BombTimer/Wnd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
using SFML.Audio;
using Octokit;
using System.Net;
//using System.Diagnostics;

namespace BombTimer
{
public partial class Wnd : Form
{
UpdateNotifier updateNotifier = new UpdateNotifier();

string currentVersion = "v1.3.0";
string currentVersion = "v1.3.2";
string workspaceName = "Stelusteee";
string repositoryName = "BombTimer";
public async void CheckForUpdate()
Expand All @@ -32,10 +33,11 @@ public async void CheckForUpdate()
}
}

int WndSclAmount = 50;
SaveData data = new SaveData();
public Wnd()
{
CheckForUpdate();
try { CheckForUpdate(); } catch (Exception) {}

if (File.Exists("UpdateDownloaderUsed.exe"))
{
Expand All @@ -51,14 +53,24 @@ public Wnd()
{
data.soundIndex = 1;
data.wndLocation = new Point(0, 0);
data.wndSize = new Size(350, 350);
data.wndSize = new Size(1, 1) * (minWndSize + maxWndSize) / 2;
string json = JsonConvert.SerializeObject(data, Formatting.Indented);
File.WriteAllText("save.json", json);
//MessageBox.Show("Right click to open the context menu.", "Hi! Need help?", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

InitializeComponent();

WndSclAmount = Screen.PrimaryScreen.Bounds.Height / 30;

minWndSize = RoundToN(Screen.PrimaryScreen.Bounds.Height / 4, WndSclAmount);
maxWndSize = RoundToN(Screen.PrimaryScreen.Bounds.Height / 2, WndSclAmount);

if (data.wndSize.Width > maxWndSize || data.wndSize.Width < minWndSize)
data.wndSize = new Size(1, 1) * (minWndSize + maxWndSize) / 2;

Location = data.wndLocation;
ClientSize = data.wndSize;

ctxMenuStrip.Renderer = new CustomContextMenuRenderer();
}

Expand Down Expand Up @@ -87,10 +99,10 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
HideAction();
return true;
case (Keys.Control | Keys.Oemplus):
ScaleWindow(50);
ScaleWindow(WndSclAmount);
return true;
case (Keys.Control | Keys.OemMinus):
ScaleWindow(-50);
ScaleWindow(-WndSclAmount);
return true;
case (Keys.Control | Keys.D0):
SoundSelectAction(0);
Expand Down Expand Up @@ -144,7 +156,7 @@ private void Wnd_MouseMove(object sender, MouseEventArgs e)
{
curMPos = MousePosition;

Point mouseDelta = new Point(curMPos.X - preMPos.X, curMPos.Y - preMPos.Y);
Point mouseDelta = new(curMPos.X - preMPos.X, curMPos.Y - preMPos.Y);

preMPos = curMPos;

Expand All @@ -168,20 +180,20 @@ private void QuitOption_Click(object sender, EventArgs e)

private void HelpOption_Click(object sender, EventArgs e)
{
//MessageBox.Show((DeviceDpi * ClientSize.Width).ToString());
HelpWnd helpWnd = new HelpWnd();
helpWnd.label5.Text = currentVersion;
helpWnd.ShowDialog();
//MessageBox.Show("Insert time and press ENTER to start the timer.\nBackspace to clear time input.\nPress and hold left click to move the window.\nGood luck on your project!" + $"\n{currentVersion}", "Help", MessageBoxButtons.OK, MessageBoxIcon.None);
}

private void UpOption_Click(object sender, EventArgs e)
{
ScaleWindow(50);
ScaleWindow(WndSclAmount);
}

private void DownOption_Click(object sender, EventArgs e)
{
ScaleWindow(-50);
ScaleWindow(-WndSclAmount);
}

private void DefuseOption_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -253,18 +265,16 @@ private void HideAction()
Hide();
}

int RoundTo50(int number)
int RoundToN(int number, int N)
{
return (number + 25) / 50 * 50;
return (number + (N / 2)) / N * N;
}

int minSize, maxSize;
int minWndSize, maxWndSize;
private void ScaleWindow(int scaleAmount)
{
int newSize = Width + scaleAmount;
minSize = RoundTo50(Screen.PrimaryScreen.Bounds.Height / 4);
maxSize = RoundTo50(Screen.PrimaryScreen.Bounds.Height / 2);
newSize = Math.Max(minSize, Math.Min(maxSize, newSize));
newSize = Math.Max(minWndSize, Math.Min(maxWndSize, newSize));
ClientSize = new Size(newSize, newSize);
}

Expand Down

0 comments on commit 4ab9f2e

Please sign in to comment.