public static void ShowError(string error) { MMCDlgHelper.ShowError(error); }
public void ViewDiffButtonClicked(object sender, EventArgs e) { UIErrorHelper.CheckedExecNonModal(delegate() { Button button = sender as Button; if (button.Text == VMDirSchemaConstants.DIFF_ATTRIBUTETYPE) { ParseAttrType(); if (AttrDiff == null || AttrDiff.Count == 0) { MMCDlgHelper.ShowInformation("No Diff Found"); } else { var frm = new ViewDiffWindow(this.ServerNode.ServerDTO.Server, this.CurrentNode, MetaDataDiff); frm.ShowDialog(); } } else if (button.Text == VMDirSchemaConstants.DIFF_OBJECTCLASS) { ParseObjectClass(); if (ObjectClassDiff == null || ObjectClassDiff.Count == 0) { MMCDlgHelper.ShowInformation("No Diff Found"); } else { var frm = new ViewDiffWindow(this.ServerNode.ServerDTO.Server, this.CurrentNode, MetaDataDiff); frm.ShowDialog(); } } else { ParseMetaData(); if (MetaDataDiff == null || MetaDataDiff.Count == 0) { MMCDlgHelper.ShowInformation("No Diff Found"); } else { var frm = new ViewDiffWindow(this.ServerNode.ServerDTO.Server, this.CurrentNode, MetaDataDiff); frm.ShowDialog(); } } }); }
private bool ValidateInputs() { if (string.IsNullOrEmpty(txtServer.Text)) { MMCDlgHelper.ShowWarning("Please enter a valid Server name"); return(false); } int port; if (string.IsNullOrEmpty(txtPort.Text) || !int.TryParse(txtPort.Text, out port)) { MMCDlgHelper.ShowWarning("Please enter a valid port"); return(false); } if (string.IsNullOrEmpty(txtDefaultTenant.Text)) { MMCDlgHelper.ShowWarning("Please enter a valid Default Tenant name"); return(false); } if (loginTab.SelectedTab == tabUser) { if (string.IsNullOrEmpty(txtUser.Text)) { MMCDlgHelper.ShowWarning("Enter a valid username."); return(false); } if (string.IsNullOrEmpty(txtPass.Text)) { MMCDlgHelper.ShowWarning("Enter a valid password."); return(false); } if (string.IsNullOrEmpty(txtDomainName.Text)) { MMCDlgHelper.ShowWarning("Enter a valid domain name."); return(false); } } else if (loginTab.SelectedTab == tabGssTicket) { if (string.IsNullOrEmpty(txtGssUsername.Text)) { MMCDlgHelper.ShowWarning("Enter a valid GSS username."); return(false); } if (string.IsNullOrEmpty(txtGssPassword.Text)) { MMCDlgHelper.ShowWarning("Enter a valid GSS password."); return(false); } if (string.IsNullOrEmpty(txtGssDomain.Text)) { MMCDlgHelper.ShowWarning("Enter a valid GSS domain name."); return(false); } if (string.IsNullOrEmpty(txtGssSpn.Text)) { MMCDlgHelper.ShowWarning("Enter a valid GSS SPN."); return(false); } } return(true); }
private void buttonSubmit_Click(object sender, EventArgs e) { if (_serverDTO == null || _serverDTO.Connection == null) { MMCDlgHelper.ShowWarning(VMDirConstants.WRN_RELOGIN); return; } MiscUtilsService.CheckedExec(delegate { if (_modData.Count > 0) { var finalMods = new Dictionary <string, List <string> >(); foreach (ListViewItem item in listViewProp.Items) { var key = item.SubItems[0].Text; var val = item.SubItems[1].Text; if (_modData.Contains(key)) { if (finalMods.ContainsKey(key)) { finalMods[key].Add(val); } else { finalMods.Add(key, new List <string>() { val }); } } } var frm = new SubmitModConfirm(finalMods); if (frm.ShowDialog() != DialogResult.OK) { return; } //LdapMod[] attrMods = new LdapMod[finalMods.Count]; List <AttributeModStatus> modificationStatus = new List <AttributeModStatus>(); int i = 0; foreach (var m in finalMods) { LdapMod[] ldapVal = new LdapMod[1]; var values = m.Value.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray(); Array.Resize(ref values, values.Count() + 1); ldapVal[0] = new LdapMod((int)LdapMod.mod_ops.LDAP_MOD_REPLACE, m.Key, values); try { _serverDTO.Connection.ModifyObject(_dn, ldapVal); modificationStatus.Add(new AttributeModStatus(m.Key, true, "Success")); } catch (Exception exp) { modificationStatus.Add(new AttributeModStatus(m.Key, false, exp.Message)); } i++; } var frm2 = new SubmitModStatus(modificationStatus); frm2.ShowDialog(); RefreshPropertiesView(); } }); }
public async Task DoLogin() { try { string user = string.Empty; string domain = string.Empty; if (!string.IsNullOrWhiteSpace(ServerDTO.BindDN)) { var userAndDomain = ServerDTO.BindDN.Split('@'); user = userAndDomain[0]; if (userAndDomain[1] != null) { domain = userAndDomain[1]; } } var frmLogin = new LoginForm(ServerDTO.Server, user, domain); if (SnapIn.Console.ShowDialog(frmLogin) == DialogResult.OK) { string Upn = frmLogin.UserName; ServerDTO.Server = frmLogin.Server; ServerDTO.BindDN = frmLogin.UserName + "@" + frmLogin.DomainName; ServerDTO.Password = frmLogin.Password; if (string.IsNullOrWhiteSpace(ServerDTO.BindDN) || string.IsNullOrWhiteSpace(ServerDTO.Password)) { throw new Exception(MMCUIConstants.VALUES_EMPTY); } ServerDTO.Password = frmLogin.Password; Task t = new Task(ServerConnect); t.Start(); if (await Task.WhenAny(t, Task.Delay(VMDirSchemaConstants.VMDIRSERVER_TIMEOUT)) == t) { if (ret == 1) { IsLoggedIn = true; } else { MMCDlgHelper.ShowException(new Exception(CommonConstants.INVALID_CREDENTIAL)); } } else { MMCDlgHelper.ShowException(new Exception(VMDirSchemaConstants.TIME_OUT)); } } if (IsLoggedIn) { this.DisplayName = ServerDTO.Server; this.ActionsPaneItems.Remove(LoginAction); // this.ActionsPaneItems.Add(new Microsoft.ManagementConsole.Action(VMDirSchemaConstants.COMPARE_SCHEMA, VMDirSchemaConstants.COMPARE_SCHEMA, -1, ACTION_SCHEMACOMPARE)); AddLogoutActions(); PopulateChildren(); } } catch (Exception e) { MMCDlgHelper.ShowException(e); } }