Skip to content

Commit

Permalink
make window stay on top and only allow one instance to run
Browse files Browse the repository at this point in the history
  • Loading branch information
fffelix-jan committed Feb 6, 2021
1 parent cc42bac commit 8173f5c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
8 changes: 5 additions & 3 deletions HAACHAMA/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public Form1()

private void Form1_Load(object sender, EventArgs e)
{
TopMost = true;
InitTimer();
InitSuperColourChanger();
System.IO.Stream stream = Properties.Resources.haachama;
Expand Down Expand Up @@ -62,9 +63,10 @@ void tmr_Tick(object sender, EventArgs e)
{
AudioManager.SetMasterVolumeMute(false);
AudioManager.SetMasterVolume(100);
Show();
BringToFront();
Activate();
this.Show();
this.BringToFront();
this.Activate();
this.Focus();
}

void superColourChanger_Tick(object sender, EventArgs e)
Expand Down
14 changes: 7 additions & 7 deletions HAACHAMA/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ static class Program
[STAThread]
static void Main()
{
bool result;
var mutex = new System.Threading.Mutex(true, "UniqueAppId", out result);
if (!result)
{
return;
}

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var form = new Form1();
Application.Run(form);


//for (; ; ) {
// form.Show();
// form.BringToFront();
// form.Activate();
//}
}
}
}

0 comments on commit 8173f5c

Please sign in to comment.