mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Ready for Review - [Mouse Without Borders] - refactoring "Common" classes (Part 3) - #35155 (#36950)
* [MWB] - refactoring MachineInf from Common.MachineStuff.cs into MachineInf.cs - #35155 * [MWB] - fixing references to MachineInf - #35155 * [MWB] - cleaning up MachineInf.cs - #35155 * [MWB] - moving MyRectangle from Common.MachineStuff.cs into MyRectangle.cs - #35155 * [MWB] - cleaning up MyRectangle.cs - #35155 * [MWB] - moving Common.MachineStuff.cs to MachineStuff.cs - #35155 * [MWB] - fixing references to MachineStuff - #35155 * [MWB] - cleaning up MachineStuff.cs - #35155 * [MWB] - cleaning up MachineStuff.cs - #35155 * [MWB] - moving Common.DragDrop.cs to DragDrop.cs - #35155 * [MWB] - fixing references to DragDrop - #35155 * [MWB] - fixing unit test - #35155 * [MWB] - cleaning up DragDrop.cs - #35155 * [MWB] - cleaning up DragDrop.cs - #35155
This commit is contained in:
@@ -76,8 +76,8 @@ namespace MouseWithoutBorders
|
||||
return;
|
||||
}
|
||||
|
||||
string[] st = new string[Common.MAX_MACHINE];
|
||||
for (int i = 0; i < Common.MAX_MACHINE; i++)
|
||||
string[] st = new string[MachineStuff.MAX_MACHINE];
|
||||
for (int i = 0; i < MachineStuff.MAX_MACHINE; i++)
|
||||
{
|
||||
if (machines[i].MachineEnabled)
|
||||
{
|
||||
@@ -98,7 +98,7 @@ namespace MouseWithoutBorders
|
||||
}
|
||||
}
|
||||
|
||||
Common.MachineMatrix = st;
|
||||
MachineStuff.MachineMatrix = st;
|
||||
Setting.Values.MatrixOneRow = matrixOneRow = !checkBoxTwoRow.Checked;
|
||||
|
||||
if (Process.GetCurrentProcess().SessionId != NativeMethods.WTSGetActiveConsoleSessionId())
|
||||
@@ -124,7 +124,7 @@ namespace MouseWithoutBorders
|
||||
Common.MMSleep(0.2);
|
||||
}
|
||||
|
||||
Common.SendMachineMatrix();
|
||||
MachineStuff.SendMachineMatrix();
|
||||
}
|
||||
|
||||
buttonOK.Enabled = true;
|
||||
@@ -150,13 +150,13 @@ namespace MouseWithoutBorders
|
||||
bool meAdded = false;
|
||||
string machineName;
|
||||
|
||||
if (Common.MachineMatrix != null && Common.MachineMatrix.Length == Common.MAX_MACHINE)
|
||||
if (MachineStuff.MachineMatrix != null && MachineStuff.MachineMatrix.Length == MachineStuff.MAX_MACHINE)
|
||||
{
|
||||
Logger.LogDebug("LoadMachines: Machine Matrix: " + Setting.Values.MachineMatrixString);
|
||||
|
||||
for (int i = 0; i < Common.MAX_MACHINE; i++)
|
||||
for (int i = 0; i < MachineStuff.MAX_MACHINE; i++)
|
||||
{
|
||||
machineName = Common.MachineMatrix[i].Trim();
|
||||
machineName = MachineStuff.MachineMatrix[i].Trim();
|
||||
machines[i].MachineName = machineName;
|
||||
|
||||
if (string.IsNullOrEmpty(machineName))
|
||||
@@ -168,7 +168,7 @@ namespace MouseWithoutBorders
|
||||
machines[i].MachineEnabled = true;
|
||||
}
|
||||
|
||||
bool found = Common.MachinePool.TryFindMachineByName(machineName, out MachineInf machineInfo);
|
||||
bool found = MachineStuff.MachinePool.TryFindMachineByName(machineName, out MachineInf machineInfo);
|
||||
if (found)
|
||||
{
|
||||
if (machineInfo.Id == Common.MachineID)
|
||||
@@ -340,7 +340,7 @@ namespace MouseWithoutBorders
|
||||
string newMachine;
|
||||
Machine unUsedMachine;
|
||||
|
||||
foreach (MachineInf inf in Common.MachinePool.ListAllMachines())
|
||||
foreach (MachineInf inf in MachineStuff.MachinePool.ListAllMachines())
|
||||
{
|
||||
bool found = false;
|
||||
unUsedMachine = null;
|
||||
@@ -519,7 +519,7 @@ namespace MouseWithoutBorders
|
||||
return true;
|
||||
}
|
||||
|
||||
private readonly Machine[] machines = new Machine[Common.MAX_MACHINE];
|
||||
private readonly Machine[] machines = new Machine[MachineStuff.MAX_MACHINE];
|
||||
private Machine dragDropMachine;
|
||||
private Machine desMachine;
|
||||
private Machine desMachineX;
|
||||
@@ -530,7 +530,7 @@ namespace MouseWithoutBorders
|
||||
|
||||
private void CreateMachines()
|
||||
{
|
||||
for (int i = 0; i < Common.MAX_MACHINE; i++)
|
||||
for (int i = 0; i < MachineStuff.MAX_MACHINE; i++)
|
||||
{
|
||||
Machine m = new();
|
||||
m.MouseDown += Machine_MouseDown;
|
||||
@@ -550,7 +550,7 @@ namespace MouseWithoutBorders
|
||||
int dx = (groupBoxMachineMatrix.Width - 40) / 4;
|
||||
int yOffset = groupBoxMachineMatrix.Height / 3;
|
||||
|
||||
for (int i = 0; i < Common.MAX_MACHINE; i++)
|
||||
for (int i = 0; i < MachineStuff.MAX_MACHINE; i++)
|
||||
{
|
||||
machines[i].Left = matrixOneRow ? 22 + (i * dx) : 22 + dx + ((i % 2) * dx);
|
||||
machines[i].Top = matrixOneRow ? yOffset : (yOffset / 2) + (i / 2 * (machines[i].Width + 2));
|
||||
@@ -649,7 +649,7 @@ namespace MouseWithoutBorders
|
||||
|
||||
desMachineX = desMachineY = desMachine;
|
||||
|
||||
for (int i = 0; i < Common.MAX_MACHINE; i++)
|
||||
for (int i = 0; i < MachineStuff.MAX_MACHINE; i++)
|
||||
{
|
||||
if (machines[i] == dragDropMachine)
|
||||
{
|
||||
@@ -703,9 +703,9 @@ namespace MouseWithoutBorders
|
||||
dragDropMachine.Top = desMachinePos.Y;
|
||||
|
||||
Machine tmp;
|
||||
for (int i = 0; i < Common.MAX_MACHINE - 1; i++)
|
||||
for (int i = 0; i < MachineStuff.MAX_MACHINE - 1; i++)
|
||||
{
|
||||
for (int j = 0; j < Common.MAX_MACHINE - 1 - i; j++)
|
||||
for (int j = 0; j < MachineStuff.MAX_MACHINE - 1 - i; j++)
|
||||
{
|
||||
if (machines[j + 1].Top < machines[j].Top || (machines[j + 1].Top == machines[j].Top && machines[j + 1].Left < machines[j].Left))
|
||||
{
|
||||
@@ -1041,7 +1041,7 @@ namespace MouseWithoutBorders
|
||||
{
|
||||
Setting.Values.MatrixCircle = checkBoxCircle.Checked;
|
||||
ShowUpdateMessage();
|
||||
Common.SendMachineMatrix();
|
||||
MachineStuff.SendMachineMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1187,8 +1187,8 @@ namespace MouseWithoutBorders
|
||||
ButtonCancel_Click(this, new EventArgs());
|
||||
Setting.Values.FirstRun = true;
|
||||
Setting.Values.EasyMouse = (int)EasyMouseOption.Enable;
|
||||
Common.ClearComputerMatrix();
|
||||
Common.ShowSetupForm(true);
|
||||
MachineStuff.ClearComputerMatrix();
|
||||
MachineStuff.ShowSetupForm(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user