[MWB][Enterprise] Add new policies and improve settings UI for the Transfer File setting (#33571)

## Summary of the Pull Request

### Improve settings page for TransferFile setting
The TransferFile setting depends on ShareClipboard setting. This is now
visually shown.

**Before the change:**

![image](https://github.com/microsoft/PowerToys/assets/61519853/735ad7bd-4f45-4914-8bbc-bc47170a9b47)
**After the change**

![image](https://github.com/microsoft/PowerToys/assets/61519853/78fb74c3-29a0-4779-8f0c-9df6c4161be1)


### New policies are added for MWB
Name | Supported states | Id | Behavior
------------ | ------------- | ------------ | -------------
Clipboard sharing enabled | disabled | MwbClipboardSharingEnabled |
Disables the feature if set to disabled.
File transfer enabled | disabled | MwbFileTransferEnabled | Disables the
feature if set to disabled.
Original user interface enabled | disabled | MwbUseOriginalUserInterface
| Disables the feature if set to disabled. |
Disallow blocking screensaver on other machines | enabled |
MwbDisallowBlockingScreensaver | Disables the feature if set to enabled.
|
Connect only in same subnet | enabled & disabled | MwbSameSubnetOnly |
Enables the feature if set to enabled.<br />Disables the feature if set
to disabled. |
Validate remote machine IP Address | enabled & disabled |
MwbValidateRemoteIp | Enables the feature if set to enabled.<br
/>Disables the feature if set to disabled.
Disable user defined IP Address mapping rules | enabled |
MwbDisableUserDefinedIpMappingRules | If enabled the user can't define
IP Address mapping rules.
Predefined IP Address mappings | enabled with multi-line text value |
MwbPolicyDefinedIpMappingRules | Allows admins to force define IP
Address mapping rules.

#### User Interface screenshots

![image](https://github.com/microsoft/PowerToys/assets/61519853/3d8a46c5-13f3-4a47-80a1-c0d242d8541c)

![image](https://github.com/microsoft/PowerToys/assets/61519853/44f4dc60-5106-45bf-9bb4-aa0bde9ef6fa)

![image](https://github.com/microsoft/PowerToys/assets/61519853/569be956-e889-442c-bdc9-e319ad3c19e3)
This commit is contained in:
Heiko
2024-07-22 16:49:45 +02:00
committed by GitHub
parent ca97e01d59
commit 16a1fb7981
15 changed files with 782 additions and 25 deletions

View File

@@ -1,6 +1,7 @@
using System.Windows.Forms;
using System.Collections.Generic;
using System.Drawing;
using Windows.UI.Notifications;
namespace MouseWithoutBorders
{
@@ -88,6 +89,8 @@ namespace MouseWithoutBorders
this.linkLabelReConfigure = new System.Windows.Forms.LinkLabel();
this.tabControlSetting = new System.Windows.Forms.TabControl();
this.tabPageAdvancedSettings = new System.Windows.Forms.TabPage();
this.groupBoxName2IPPolicyList = new System.Windows.Forms.GroupBox();
this.textBoxMachineName2IPPolicyList = new System.Windows.Forms.TextBox();
this.pictureBoxMouseWithoutBorders = new System.Windows.Forms.PictureBox();
this.groupBoxDNS = new System.Windows.Forms.GroupBox();
this.textBoxMachineName2IP = new System.Windows.Forms.TextBox();
@@ -103,6 +106,7 @@ namespace MouseWithoutBorders
this.groupBoxMachineMatrix.SuspendLayout();
this.tabControlSetting.SuspendLayout();
this.tabPageAdvancedSettings.SuspendLayout();
this.groupBoxName2IPPolicyList.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxMouseWithoutBorders)).BeginInit();
this.groupBoxDNS.SuspendLayout();
this.SuspendLayout();
@@ -977,6 +981,7 @@ namespace MouseWithoutBorders
// tabPageAdvancedSettings
//
this.tabPageAdvancedSettings.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(246)))), ((int)(((byte)(245)))), ((int)(((byte)(242)))));
this.tabPageAdvancedSettings.Controls.Add(this.groupBoxName2IPPolicyList);
this.tabPageAdvancedSettings.Controls.Add(this.pictureBoxMouseWithoutBorders);
this.tabPageAdvancedSettings.Controls.Add(this.groupBoxDNS);
this.tabPageAdvancedSettings.Controls.Add(this.textBoxDNS);
@@ -986,6 +991,33 @@ namespace MouseWithoutBorders
this.tabPageAdvancedSettings.Size = new System.Drawing.Size(563, 362);
this.tabPageAdvancedSettings.TabIndex = 2;
this.tabPageAdvancedSettings.Text = "IP Mappings";
//
// groupBoxName2IPPolicyList
//
this.groupBoxName2IPPolicyList.Controls.Add(this.textBoxMachineName2IPPolicyList);
this.groupBoxName2IPPolicyList.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBoxName2IPPolicyList.Location = new System.Drawing.Point(3, 241);
this.groupBoxName2IPPolicyList.Name = "groupBoxName2IPPolicyList";
this.groupBoxName2IPPolicyList.Size = new System.Drawing.Size(357, 150);
this.groupBoxName2IPPolicyList.TabIndex = 1;
this.groupBoxName2IPPolicyList.TabStop = false;
this.groupBoxName2IPPolicyList.Text = " Policy defined machine name to IP address mappings [Managed]";
this.groupBoxName2IPPolicyList.ForeColor = Color.DimGray;
this.groupBoxName2IPPolicyList.Visible = false;
//
// textBoxMachineName2IPPolicyList
//
this.textBoxMachineName2IPPolicyList.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBoxMachineName2IPPolicyList.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBoxMachineName2IPPolicyList.Location = new System.Drawing.Point(3, 172); // 3,172
this.textBoxMachineName2IPPolicyList.MaxLength = 1024;
this.textBoxMachineName2IPPolicyList.Multiline = true;
this.textBoxMachineName2IPPolicyList.Name = "textBoxMachineName2IPPolicyList";
this.textBoxMachineName2IPPolicyList.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBoxMachineName2IPPolicyList.Size = new System.Drawing.Size(351, 131);
this.textBoxMachineName2IPPolicyList.TabIndex = 1;
this.textBoxMachineName2IPPolicyList.ReadOnly = true;
this.textBoxMachineName2IPPolicyList.Visible = false;
//
// pictureBoxMouseWithoutBorders
//
@@ -1098,12 +1130,13 @@ namespace MouseWithoutBorders
this.tabControlSetting.ResumeLayout(false);
this.tabPageAdvancedSettings.ResumeLayout(false);
this.tabPageAdvancedSettings.PerformLayout();
this.groupBoxName2IPPolicyList.ResumeLayout(false);
this.groupBoxName2IPPolicyList.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxMouseWithoutBorders)).EndInit();
this.groupBoxDNS.ResumeLayout(false);
this.groupBoxDNS.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
@@ -1140,6 +1173,8 @@ namespace MouseWithoutBorders
private GroupBox groupBoxDNS;
private TextBox textBoxDNS;
private TextBox textBoxMachineName2IP;
private GroupBox groupBoxName2IPPolicyList;
private TextBox textBoxMachineName2IPPolicyList;
private PictureBox pictureBoxMouseWithoutBorders;
private GroupBox groupBoxOtherOptions;
private CheckBox checkBoxDrawMouse;

View File

@@ -853,6 +853,56 @@ namespace MouseWithoutBorders
comboBoxEasyMouse.Text = Setting.Values.HotKeyToggleEasyMouse == 0 ? "Disable" : new string(new char[] { (char)Setting.Values.HotKeyToggleEasyMouse });
#endif
// Apply policy configuration on UI elements
// Has to be the last action
if (Setting.Values.ShareClipboardIsGpoConfigured)
{
checkBoxShareClipboard.Enabled = false;
checkBoxShareClipboard.Text += " [Managed]";
// transfer file setting depends on clipboard sharing
checkBoxTransferFile.Enabled = false;
}
if (Setting.Values.TransferFileIsGpoConfigured)
{
checkBoxTransferFile.Enabled = false;
checkBoxTransferFile.Text += " [Managed]";
}
if (Setting.Values.BlockScreenSaverIsGpoConfigured)
{
checkBoxBlockScreenSaver.Enabled = false;
checkBoxBlockScreenSaver.Text += " [Managed]";
}
if (Setting.Values.SameSubNetOnlyIsGpoConfigured)
{
checkBoxSameSubNet.Enabled = false;
checkBoxSameSubNet.Text += " [Managed]";
}
if (Setting.Values.ReverseLookupIsGpoConfigured)
{
checkBoxReverseLookup.Enabled = false;
checkBoxReverseLookup.Text += " [Managed]";
}
if (Setting.Values.Name2IpIsGpoConfigured)
{
textBoxMachineName2IP.Enabled = false;
groupBoxDNS.ForeColor = Color.DimGray;
groupBoxDNS.Text += " [Managed]";
}
if (Setting.Values.Name2IpPolicyListIsGpoConfigured)
{
pictureBoxMouseWithoutBorders.Visible = false;
groupBoxName2IPPolicyList.Visible = true;
textBoxMachineName2IPPolicyList.Visible = true;
textBoxMachineName2IPPolicyList.Text = Setting.Values.Name2IpPolicyList;
}
}
private void RadioButton_CheckedChanged(object sender, EventArgs e)