Skip to content

Commit

Permalink
Only one set button
Browse files Browse the repository at this point in the history
  • Loading branch information
silenzzz committed Jul 23, 2020
1 parent e8f0385 commit cdca98d
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 28 deletions.
31 changes: 9 additions & 22 deletions Form1.Designer.cs

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

53 changes: 49 additions & 4 deletions Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public partial class MainForm : Form

private bool ballonShowed = false;

private State.WINDOW_STATE newState;

public MainForm()
{
InitializeComponent();
Expand Down Expand Up @@ -187,8 +189,16 @@ private void ButtonSetTop_Click(object sender, EventArgs e)
ShowSelectProcessMessageBox();
return;
}
SetWindowState(State.WINDOW_STATE.TOP);
logForm.AddAction(new TopStateAction(listBoxProcesses.SelectedItem as Process, State.WINDOW_STATE.TOP));
SetWindowState(newState);
if (newState == State.WINDOW_STATE.TOP)
{
logForm.AddAction(new TopStateAction(listBoxProcesses.SelectedItem as Process, State.WINDOW_STATE.TOP));
} else
{
logForm.AddAction(new TopStateAction(listBoxProcesses.SelectedItem as Process, State.WINDOW_STATE.UNTOP));
}
newState = newState == State.WINDOW_STATE.TOP ? State.WINDOW_STATE.UNTOP : State.WINDOW_STATE.TOP;
RefreshTopButton();
}

private void ButtonUnsetTop_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -227,7 +237,8 @@ private void ButtonSettings_Click(object sender, EventArgs e)
if (settingsForm.showWindowTitles)
{
listBoxProcesses.DisplayMember = "MainWindowTitle";
} else
}
else
{
listBoxProcesses.DisplayMember = "ProcessName";
}
Expand Down Expand Up @@ -329,9 +340,43 @@ private void ButtonProperties_Click(object sender, EventArgs e)

private void ButtonLog_Click(object sender, EventArgs e)
{
logForm.ShowDialogWithTopMostState(TopMost);
logForm.ShowDialogWithTopMostState(State.IsTopMost(Process.GetCurrentProcess()));
UpdateProcesses();
RefreshTopButton();
}


private void ListBoxProcesses_Click(object sender, EventArgs e)
{
if (listBoxProcesses.SelectedIndex == -1)
{
ShowSelectProcessMessageBox();
return;
}

var proc = listBoxProcesses.SelectedItem as Process;
if (!State.IsTopMost(proc))
{
newState = State.WINDOW_STATE.TOP;
}
else
{
newState = State.WINDOW_STATE.UNTOP;
}
RefreshTopButton();
}

private void RefreshTopButton()
{
if (newState == State.WINDOW_STATE.TOP)
{
buttonSetTop.Text = "Set top";
}
else
{
buttonSetTop.Text = "Unset top";
}
}

#endregion
}
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.1.4")]
[assembly: AssemblyFileVersion("1.6.1.4")]
[assembly: AssemblyVersion("1.6.2.0")]
[assembly: AssemblyFileVersion("1.6.2.0")]
[assembly: NeutralResourcesLanguage("en")]

0 comments on commit cdca98d

Please sign in to comment.