Skip to content

Commit

Permalink
Fixed selection bug between tabs.
Browse files Browse the repository at this point in the history
  • Loading branch information
krisdb2009 committed Jan 11, 2019
1 parent dfa62cb commit df45dca
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 37 deletions.
19 changes: 12 additions & 7 deletions SuperADD/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public partial class Main : Form
private int spookyCount = 5;
private int autoRunIndex = -1;
private bool autoRunContinue = false;
private string currentCreateSelectedOU = "";

List<char> invalidNameCharacters = new List<char> {
' ', '{', '|', '}', '~', '[', '\\', ']', '^', '\'', ':', ';', '<', '=', '>',
Expand Down Expand Up @@ -107,7 +108,7 @@ public Main(int autoIndex = -1, bool autoContinue = false)
foreach (XElement ou in Config.Current.Element("OrganizationalUnits").Elements("OrganizationalUnit"))
{
OUList.Items.Add(ou.Element("Name").Value);
dirlookOUList.Items.Add(ou.Element("Name").Value);
dirLookOUList.Items.Add(ou.Element("Name").Value);
}

foreach (XElement descItem in Config.Current.Element("DescriptionItems").Elements("DescriptionItem"))
Expand Down Expand Up @@ -196,7 +197,7 @@ private async void retrieveCurrentlySelectedOUList()

private void currentlySelectedOUListUpdated()
{
if (tabControl.SelectedTab == compSearchPage)
if (tabControl.SelectedTab == dirLookTab)
{
string filter = directorySearchTb.Text;
computerLookList.BeginUpdate();
Expand All @@ -210,7 +211,7 @@ private void currentlySelectedOUListUpdated()
}
computerLookList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
computerLookList.EndUpdate();
dirlookOUList.Enabled = true;
dirLookOUList.Enabled = true;
}
else if (tabControl.SelectedTab == compNameTab)
{
Expand Down Expand Up @@ -322,7 +323,7 @@ private async void createComputer()
showMsg("Adding computer to Active Directory...", loadImg, dismissable: false);
Dictionary<string, string> postData = new Dictionary<string, string>();
postData.Add("domain", adDomainName);
postData.Add("basedn", currentlySelectedOU);
postData.Add("basedn", currentCreateSelectedOU);
postData.Add("username", adUserName);
postData.Add("password", adPassword);
postData.Add("function", "update");
Expand Down Expand Up @@ -381,7 +382,7 @@ private void setTSVariables(bool joinDomain = true, bool exitSuperADD = true)
tsEnv["DOMAINADMIN"] = tsEnv["USERID"];
tsEnv["DOMAINADMINDOMAIN"] = tsEnv["USERDOMAIN"];
tsEnv["DOMAINADMINPASSWORD"] = tsEnv["USERPASSWORD"];
tsEnv["MACHINEOBJECTOU"] = currentlySelectedOU;
tsEnv["MACHINEOBJECTOU"] = currentCreateSelectedOU;
tsEnv["JOINWORKGROUP"] = "";
}
else
Expand Down Expand Up @@ -409,7 +410,7 @@ private void directorySearchTb_TextChanged(object sender, EventArgs e)

private void computerLookList_DoubleClick(object sender, EventArgs e)
{
OUList.SelectedIndex = dirlookOUList.SelectedIndex;
OUList.SelectedIndex = dirLookOUList.SelectedIndex;
nameTextBox.Text = computerLookList.SelectedItems[0].Text;
descTextBox.Text = computerLookList.SelectedItems[0].SubItems[1].Text;
computerOverwriteConfirmed = true;
Expand Down Expand Up @@ -441,10 +442,14 @@ private void OUList_SelectedIndexChanged(object sender, EventArgs e)
if (elm.Element("Name").Value == (string)lv.SelectedItem)
{
currentlySelectedOU = elm.Element("DistinguishedName").Value;
if(lv == OUList)
{
currentCreateSelectedOU = elm.Element("DistinguishedName").Value;
}
break;
}
}
if ((lv == OUList && tabControl.SelectedTab == compNameTab) || lv == dirlookOUList)
if ((lv == OUList && tabControl.SelectedTab == compNameTab) || lv == dirLookOUList)
{
lv.Enabled = false;
retrieveCurrentlySelectedOUList();
Expand Down
54 changes: 27 additions & 27 deletions SuperADD/MainForm.Designer.cs

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

6 changes: 3 additions & 3 deletions SuperADD/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SuperADD")]
[assembly: AssemblyTitle("Super MDT Active Directory Deploy")]
[assembly: AssemblyDescription("Super MDT Active Directory Deploy")]
[assembly: AssemblyConfiguration("Dylan Bickerstaff")]
[assembly: AssemblyCompany("Dylan Bickerstaff")]
Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.4")]
[assembly: AssemblyFileVersion("0.0.0.4")]
[assembly: AssemblyVersion("0.0.0.5")]
[assembly: AssemblyFileVersion("0.0.0.5")]

0 comments on commit df45dca

Please sign in to comment.