mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Merge branch 'develop' into move_component_check
This commit is contained in:
39
mRemoteV1/Tools/ADhelper.cs
Normal file
39
mRemoteV1/Tools/ADhelper.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.DirectoryServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace mRemoteNG.Tools
|
||||
{
|
||||
public class ADhelper
|
||||
{
|
||||
private DirectoryEntry _dEntry;
|
||||
|
||||
public ADhelper(string domain)
|
||||
{
|
||||
Children = new Hashtable();
|
||||
Domain = domain;
|
||||
}
|
||||
|
||||
public Hashtable Children { get; }
|
||||
|
||||
private string Domain { get; }
|
||||
|
||||
public void GetChildEntries(string adPath = "")
|
||||
{
|
||||
_dEntry = adPath.Length <= 0
|
||||
? Domain.Length <= 0 ? new DirectoryEntry() : new DirectoryEntry("LDAP://" + Domain)
|
||||
: new DirectoryEntry(adPath);
|
||||
try
|
||||
{
|
||||
foreach (DirectoryEntry child in _dEntry.Children)
|
||||
Children.Add(child.Name, child.Path);
|
||||
}
|
||||
catch (COMException ex)
|
||||
{
|
||||
if (ex.Message.ToLower().Equals("the server is not operational"))
|
||||
throw new Exception("Could not find AD Server", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
73
mRemoteV1/UI/Controls/AdTree.Designer.cs
generated
Normal file
73
mRemoteV1/UI/Controls/AdTree.Designer.cs
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
namespace mRemoteNG.UI.Controls
|
||||
{
|
||||
partial class AdTree
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AdTree));
|
||||
this.tvActiveDirectory = new System.Windows.Forms.TreeView();
|
||||
this.ImglTree = new System.Windows.Forms.ImageList(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tvActiveDirectory
|
||||
//
|
||||
this.tvActiveDirectory.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tvActiveDirectory.Location = new System.Drawing.Point(0, 0);
|
||||
this.tvActiveDirectory.Name = "tvActiveDirectory";
|
||||
this.tvActiveDirectory.Size = new System.Drawing.Size(800, 450);
|
||||
this.tvActiveDirectory.TabIndex = 0;
|
||||
this.tvActiveDirectory.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(this.TvActiveDirectory_AfterExpand);
|
||||
this.tvActiveDirectory.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.TvActiveDirectory_AfterSelect);
|
||||
//
|
||||
// ImglTree
|
||||
//
|
||||
this.ImglTree.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ImglTree.ImageStream")));
|
||||
this.ImglTree.TransparentColor = System.Drawing.Color.Transparent;
|
||||
this.ImglTree.Images.SetKeyName(0, "Root.png");
|
||||
this.ImglTree.Images.SetKeyName(1, "OU.png");
|
||||
this.ImglTree.Images.SetKeyName(2, "Folder.png");
|
||||
this.ImglTree.Images.SetKeyName(3, "Question.png");
|
||||
//
|
||||
// AdTree
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.Controls.Add(this.tvActiveDirectory);
|
||||
this.Name = "AdTree";
|
||||
this.Size = new System.Drawing.Size(800, 450);
|
||||
this.Load += new System.EventHandler(this.AdTree_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TreeView tvActiveDirectory;
|
||||
private System.Windows.Forms.ImageList ImglTree;
|
||||
}
|
||||
}
|
||||
123
mRemoteV1/UI/Controls/AdTree.cs
Normal file
123
mRemoteV1/UI/Controls/AdTree.cs
Normal file
@@ -0,0 +1,123 @@
|
||||
using mRemoteNG.Tools;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace mRemoteNG.UI.Controls
|
||||
{
|
||||
public partial class AdTree : UserControl
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public AdTree()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public event AdPathChangedEventHandler AdPathChanged;
|
||||
|
||||
public delegate void AdPathChangedEventHandler(object sender);
|
||||
|
||||
public string AdPath { get; set; }
|
||||
|
||||
public string Domain
|
||||
{
|
||||
private get => string.IsNullOrEmpty(_domain) == false ? _domain : Environment.UserDomainName;
|
||||
set => _domain = value;
|
||||
}
|
||||
|
||||
public object SelectedNode { get; internal set; }
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private string _domain;
|
||||
|
||||
private void TvActiveDirectory_AfterExpand(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (TreeNode node in e.Node.Nodes)
|
||||
AddTreeNodes(node);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
private void TvActiveDirectory_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
AdPath = e.Node.Tag.ToString();
|
||||
var pathChangedEvent = AdPathChanged;
|
||||
pathChangedEvent?.Invoke(this);
|
||||
}
|
||||
|
||||
private void AdTree_Load(object sender, EventArgs e)
|
||||
{
|
||||
tvActiveDirectory.Nodes.Clear();
|
||||
var treeNode = new TreeNode(Domain) { Tag = "" };
|
||||
tvActiveDirectory.Nodes.Add(treeNode);
|
||||
AddTreeNodes(treeNode);
|
||||
tvActiveDirectory.Nodes[0].Expand();
|
||||
}
|
||||
|
||||
private void AddTreeNodes(TreeNode tNode)
|
||||
{
|
||||
var adhelper = new ADhelper(Domain);
|
||||
adhelper.GetChildEntries(tNode.Tag.ToString());
|
||||
var enumerator = adhelper.Children.GetEnumerator();
|
||||
tvActiveDirectory.BeginUpdate();
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
var flag1 = false;
|
||||
if (enumerator.Key == null) continue;
|
||||
var node1 = new TreeNode(enumerator.Key.ToString().Substring(3))
|
||||
{
|
||||
Tag = RuntimeHelpers.GetObjectValue(enumerator.Value)
|
||||
};
|
||||
if (!enumerator.Key.ToString().Substring(0, 2).Equals("CN") ||
|
||||
enumerator.Key.ToString().Equals("CN=Computers") ||
|
||||
enumerator.Key.ToString().Equals("CN=Users"))
|
||||
flag1 = true;
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
var flag2 = false;
|
||||
try
|
||||
{
|
||||
foreach (TreeNode node2 in tNode.Nodes)
|
||||
{
|
||||
if (!node2.Text.Equals(node1.Text)) continue;
|
||||
flag2 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
|
||||
if (!flag2)
|
||||
tNode.Nodes.Add(node1);
|
||||
}
|
||||
|
||||
var imageIndex = GetImageIndex(enumerator.Key.ToString().Substring(0, 2));
|
||||
node1.ImageIndex = imageIndex;
|
||||
node1.SelectedImageIndex = imageIndex;
|
||||
}
|
||||
|
||||
tvActiveDirectory.EndUpdate();
|
||||
}
|
||||
|
||||
private static int GetImageIndex(string objType)
|
||||
{
|
||||
if (objType.Equals("CN"))
|
||||
return 2;
|
||||
return objType.Equals("OU") ? 1 : 3;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
183
mRemoteV1/UI/Controls/AdTree.resx
Normal file
183
mRemoteV1/UI/Controls/AdTree.resx
Normal file
@@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ImglTree.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="ImglTree.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZ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9AG8AfQBAAHxBRwB8QkAAfEFHAHxDAAB8wG0AbsB8gHwAbsCtAGLAfAFAALzB/8B9AHw
|
||||
Af8mAAH/AfACtAGRAbQBCQH/BwAB/wLzAfQB9gH/AfQB8wH0Af8jAAFCAU0BPgcAAT4DAAEoAwABQAMA
|
||||
ASADAAEBAQABAQYAAQEWAAP/gQAB4AEHAf8BDwT/AcABAwH4AQ8E/wGAAQMB4AEDAQABAQEAAQEBwAED
|
||||
AcABAQEAAQEBAAEBAcABAwGAAgABAQEAAQEBgAEBAwABAQEAAQEFAAEBAQABAQUAAQEBAAEBBQABAQEA
|
||||
AQEFAAEBAQABAQUAAQEBAAEBBQABAQEAAQEBgAEBAwAB/wEAAf8BwAEDAYACAQH/AQEB/wHgAQcBwAED
|
||||
BP8B8AEPAeABBwT/Cw==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,10 +1,7 @@
|
||||
|
||||
|
||||
using mRemoteNG.Themes;
|
||||
|
||||
namespace mRemoteNG.UI.Window
|
||||
{
|
||||
public partial class ActiveDirectoryImportWindow : BaseWindow
|
||||
public partial class ActiveDirectoryImportWindow
|
||||
{
|
||||
#region Windows Form Designer generated code
|
||||
private void InitializeComponent()
|
||||
@@ -13,7 +10,7 @@ namespace mRemoteNG.UI.Window
|
||||
this.txtDomain = new mRemoteNG.UI.Controls.Base.NGTextBox();
|
||||
this.lblDomain = new mRemoteNG.UI.Controls.Base.NGLabel();
|
||||
this.btnChangeDomain = new mRemoteNG.UI.Controls.Base.NGButton();
|
||||
this.ActiveDirectoryTree = new ADTree.ADtree();
|
||||
this.activeDirectoryTree = new mRemoteNG.UI.Controls.AdTree();
|
||||
this.btnClose = new mRemoteNG.UI.Controls.Base.NGButton();
|
||||
this.chkSubOU = new mRemoteNG.UI.Controls.Base.NGCheckBox();
|
||||
this.SuspendLayout();
|
||||
@@ -28,7 +25,7 @@ namespace mRemoteNG.UI.Window
|
||||
this.btnImport.TabIndex = 4;
|
||||
this.btnImport.Text = "&Import";
|
||||
this.btnImport.UseVisualStyleBackColor = true;
|
||||
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
|
||||
this.btnImport.Click += new System.EventHandler(this.BtnImport_Click);
|
||||
//
|
||||
// txtDomain
|
||||
//
|
||||
@@ -39,7 +36,7 @@ namespace mRemoteNG.UI.Window
|
||||
this.txtDomain.Name = "txtDomain";
|
||||
this.txtDomain.Size = new System.Drawing.Size(406, 22);
|
||||
this.txtDomain.TabIndex = 1;
|
||||
this.txtDomain.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtDomain_KeyDown);
|
||||
this.txtDomain.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TxtDomain_KeyDown);
|
||||
//
|
||||
// lblDomain
|
||||
//
|
||||
@@ -60,23 +57,22 @@ namespace mRemoteNG.UI.Window
|
||||
this.btnChangeDomain.TabIndex = 2;
|
||||
this.btnChangeDomain.Text = "Change";
|
||||
this.btnChangeDomain.UseVisualStyleBackColor = true;
|
||||
this.btnChangeDomain.Click += new System.EventHandler(this.btnChangeDomain_Click);
|
||||
this.btnChangeDomain.Click += new System.EventHandler(this.BtnChangeDomain_Click);
|
||||
//
|
||||
// ActiveDirectoryTree
|
||||
//
|
||||
this.ActiveDirectoryTree.AdPath = null;
|
||||
this.ActiveDirectoryTree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
this.activeDirectoryTree.AdPath = null;
|
||||
this.activeDirectoryTree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ActiveDirectoryTree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.ActiveDirectoryTree.Domain = "";
|
||||
this.ActiveDirectoryTree.Location = new System.Drawing.Point(12, 52);
|
||||
this.ActiveDirectoryTree.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.ActiveDirectoryTree.Name = "ActiveDirectoryTree";
|
||||
this.ActiveDirectoryTree.SelectedNode = null;
|
||||
this.ActiveDirectoryTree.Size = new System.Drawing.Size(510, 285);
|
||||
this.ActiveDirectoryTree.TabIndex = 3;
|
||||
this.ActiveDirectoryTree.AdPathChanged += new ADTree.ADtree.AdPathChangedEventHandler(this.ActiveDirectoryTree_ADPathChanged);
|
||||
this.activeDirectoryTree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.activeDirectoryTree.Location = new System.Drawing.Point(12, 52);
|
||||
this.activeDirectoryTree.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.activeDirectoryTree.Name = "ActiveDirectoryTree";
|
||||
this.activeDirectoryTree.SelectedNode = null;
|
||||
this.activeDirectoryTree.Size = new System.Drawing.Size(510, 285);
|
||||
this.activeDirectoryTree.TabIndex = 3;
|
||||
this.activeDirectoryTree.AdPathChanged += new mRemoteNG.UI.Controls.AdTree.AdPathChangedEventHandler(this.ActiveDirectoryTree_ADPathChanged);
|
||||
//
|
||||
// btnClose
|
||||
//
|
||||
@@ -88,7 +84,7 @@ namespace mRemoteNG.UI.Window
|
||||
this.btnClose.TabIndex = 5;
|
||||
this.btnClose.Text = "Close";
|
||||
this.btnClose.UseVisualStyleBackColor = true;
|
||||
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
|
||||
this.btnClose.Click += new System.EventHandler(this.BtnClose_Click);
|
||||
//
|
||||
// chkSubOU
|
||||
//
|
||||
@@ -112,7 +108,7 @@ namespace mRemoteNG.UI.Window
|
||||
this.ClientSize = new System.Drawing.Size(534, 381);
|
||||
this.Controls.Add(this.chkSubOU);
|
||||
this.Controls.Add(this.btnClose);
|
||||
this.Controls.Add(this.ActiveDirectoryTree);
|
||||
this.Controls.Add(this.activeDirectoryTree);
|
||||
this.Controls.Add(this.lblDomain);
|
||||
this.Controls.Add(this.txtDomain);
|
||||
this.Controls.Add(this.btnChangeDomain);
|
||||
@@ -122,7 +118,6 @@ namespace mRemoteNG.UI.Window
|
||||
this.Name = "ActiveDirectoryImportWindow";
|
||||
this.TabText = "Active Directory Import";
|
||||
this.Text = "Active Directory Import";
|
||||
this.Load += new System.EventHandler(this.ADImport_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -131,7 +126,7 @@ namespace mRemoteNG.UI.Window
|
||||
private Controls.Base.NGTextBox txtDomain;
|
||||
private Controls.Base.NGLabel lblDomain;
|
||||
private Controls.Base.NGButton btnChangeDomain;
|
||||
private ADTree.ADtree ActiveDirectoryTree;
|
||||
private mRemoteNG.UI.Controls.AdTree activeDirectoryTree;
|
||||
#endregion
|
||||
|
||||
private Controls.Base.NGButton btnClose;
|
||||
|
||||
@@ -8,47 +8,37 @@ using mRemoteNG.Themes;
|
||||
|
||||
namespace mRemoteNG.UI.Window
|
||||
{
|
||||
public partial class ActiveDirectoryImportWindow
|
||||
public partial class ActiveDirectoryImportWindow : BaseWindow
|
||||
{
|
||||
private string _currentDomain;
|
||||
|
||||
public ActiveDirectoryImportWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
FontOverrider.FontOverride(this);
|
||||
WindowType = WindowType.ActiveDirectoryImport;
|
||||
DockPnl = new DockContent();
|
||||
_currentDomain = Environment.UserDomainName;
|
||||
InitializeComponent();
|
||||
FontOverrider.FontOverride(this);
|
||||
ApplyTheme();
|
||||
}
|
||||
|
||||
private new void ApplyTheme()
|
||||
{
|
||||
base.ApplyTheme();
|
||||
if (ActiveDirectoryTree.Controls.Count < 1) return;
|
||||
if (!(ActiveDirectoryTree.Controls[0] is TreeView tv)) return;
|
||||
var tm = ThemeManager.getInstance();
|
||||
if (!tm.ActiveAndExtended) return;
|
||||
tv.BackColor = tm.ActiveTheme.ExtendedPalette.getColor("List_Background");
|
||||
tv.ForeColor = tm.ActiveTheme.ExtendedPalette.getColor("List_Item_Foreground");
|
||||
ApplyLanguage();
|
||||
txtDomain.Text = _currentDomain;
|
||||
EnableDisableImportButton();
|
||||
// Domain doesn't refresh on load, so it defaults to DOMAIN without this...
|
||||
_currentDomain = Environment.UserDomainName;
|
||||
ChangeDomain();
|
||||
}
|
||||
|
||||
#region Private Methods
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
private void ADImport_Load(object sender, EventArgs e)
|
||||
private new void ApplyTheme()
|
||||
{
|
||||
ApplyLanguage();
|
||||
txtDomain.Text = _currentDomain;
|
||||
ActiveDirectoryTree.Domain = _currentDomain;
|
||||
EnableDisableImportButton();
|
||||
|
||||
// Domain doesn't refresh on load, so it defaults to DOMAIN without this...
|
||||
ChangeDomain();
|
||||
if (!ThemeManager.getInstance().ThemingActive) return;
|
||||
base.ApplyTheme();
|
||||
if (!ThemeManager.getInstance().ActiveAndExtended) return;
|
||||
activeDirectoryTree.BackColor = ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("List_Background");
|
||||
activeDirectoryTree.ForeColor = ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("List_Item_Foreground");
|
||||
}
|
||||
|
||||
private void btnImport_Click(object sender, EventArgs e)
|
||||
private void BtnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
var selectedNode = Windows.TreeForm.SelectedNode;
|
||||
ContainerInfo importDestination;
|
||||
@@ -57,37 +47,26 @@ namespace mRemoteNG.UI.Window
|
||||
else
|
||||
importDestination = Runtime.ConnectionsService.ConnectionTreeModel.RootNodes.First();
|
||||
|
||||
Import.ImportFromActiveDirectory(ActiveDirectoryTree.AdPath, importDestination, chkSubOU.Checked);
|
||||
Import.ImportFromActiveDirectory(activeDirectoryTree.AdPath, importDestination, chkSubOU.Checked);
|
||||
}
|
||||
|
||||
/*
|
||||
private static void txtDomain_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
e.IsInputKey = true;
|
||||
}
|
||||
*/
|
||||
|
||||
private void txtDomain_KeyDown(object sender, KeyEventArgs e)
|
||||
private void TxtDomain_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode != Keys.Enter) return;
|
||||
ChangeDomain();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
|
||||
private void btnChangeDomain_Click(object sender, EventArgs e)
|
||||
private void BtnChangeDomain_Click(object sender, EventArgs e)
|
||||
{
|
||||
ChangeDomain();
|
||||
}
|
||||
|
||||
// ReSharper disable once UnusedParameter.Local
|
||||
private void ActiveDirectoryTree_ADPathChanged(object sender)
|
||||
{
|
||||
EnableDisableImportButton();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void ApplyLanguage()
|
||||
{
|
||||
btnImport.Text = Language.strButtonImport;
|
||||
@@ -100,20 +79,19 @@ namespace mRemoteNG.UI.Window
|
||||
private void ChangeDomain()
|
||||
{
|
||||
_currentDomain = txtDomain.Text;
|
||||
ActiveDirectoryTree.Domain = _currentDomain;
|
||||
ActiveDirectoryTree.Refresh();
|
||||
activeDirectoryTree.Domain = _currentDomain;
|
||||
activeDirectoryTree.Refresh();
|
||||
}
|
||||
|
||||
private void EnableDisableImportButton()
|
||||
{
|
||||
btnImport.Enabled = !string.IsNullOrEmpty(ActiveDirectoryTree.AdPath);
|
||||
btnImport.Enabled = !string.IsNullOrEmpty(activeDirectoryTree.AdPath);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void btnClose_Click(object sender, EventArgs e)
|
||||
private void BtnClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -48,9 +48,6 @@
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ADTree">
|
||||
<HintPath>References\ADTree.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.6.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
|
||||
<HintPath>..\packages\BouncyCastle.1.8.6.1\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -347,6 +344,7 @@
|
||||
<Compile Include="Themes\MremoteNGThemeBase.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Tools\ADhelper.cs" />
|
||||
<Compile Include="Tools\Attributes\UsedInAllProtocolsExceptAttribute.cs" />
|
||||
<Compile Include="Tools\Clipboard\WindowsClipboard.cs" />
|
||||
<Compile Include="Tools\CustomCollections\IFullyNotifiableList.cs" />
|
||||
@@ -439,6 +437,12 @@
|
||||
<Compile Include="Tree\Root\RootNodeTypeEnum.cs" />
|
||||
<Compile Include="Tree\ClickHandlers\SwitchToConnectionClickHandler.cs" />
|
||||
<Compile Include="Tree\ClickHandlers\TreeNodeCompositeClickHandler.cs" />
|
||||
<Compile Include="UI\Controls\AdTree.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\Controls\AdTree.Designer.cs">
|
||||
<DependentUpon>AdTree.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Controls\Base\NGButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -902,6 +906,9 @@
|
||||
<LastGenOutput>ColorMapTheme.Designer.cs</LastGenOutput>
|
||||
<CustomToolNamespace>mRemoteNG</CustomToolNamespace>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\Controls\AdTree.resx">
|
||||
<DependentUpon>AdTree.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\Controls\Base\NGButton.resx">
|
||||
<DependentUpon>NGButton.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Reference in New Issue
Block a user