public void OnClickManageAttributes(object sender, EventArgs e) { UIErrorHelper.CheckedExec(delegate() { var optionalProps = GetCurrentOptionalProperties(); if (!_properties.ContainsKey("objectClass")) { throw new Exception("Unable to fetch data for the object specified. Please ensure the user has access."); } var oc = _properties["objectClass"].Value; string cn = ""; if (oc is string) { cn = oc.ToString(); } else if (oc is LdapValue[]) { LdapValue[] val = oc as LdapValue[]; cn = val[(val.Count() - 1)].StringValue; //Get the most derived object class } ManagePropertiesWindowController awc = new ManagePropertiesWindowController(cn, optionalProps, serverDTO); nint result = NSApplication.SharedApplication.RunModalForWindow(awc.Window); if (result == (nint)VMIdentityConstants.DIALOGOK) { var retainList = awc.OptionalAttributes.Intersect(optionalProps); var removeList = optionalProps.Except(retainList).ToList(); foreach (var item in removeList) { _properties.Remove(item.Key); } var addList = awc.OptionalAttributes.Except(retainList); foreach (var item in addList) { var dto = serverDTO.Connection.SchemaManager.GetAttributeType(item.Key); _properties.Add(item.Key, new VMDirBagItem { Description = dto.Description, IsReadOnly = dto.ReadOnly, Value = null }); } ds.FillData(); this.LdapAttributesTableView.ReloadData(); } }); }
private void OnClickManageAttributesButton(object sender, EventArgs e) { try { var optionalProps = GetCurrentOptionalProperties(); if (!_properties.ContainsKey("objectClass")) { throw new Exception("Unable to fetch data for the object specified. Please ensure the user has access."); } var oc = _properties ["objectClass"].Value; string cn = ""; if (oc is string) { cn = oc.ToString(); } else if (oc is List <string> ) { cn = (oc as List <string>) [0]; } ManagePropertiesWindowController awc = new ManagePropertiesWindowController(_objectClass, optionalProps, _serverDTO); nint result = NSApplication.SharedApplication.RunModalForWindow(awc.Window); if (result == (nint)VMIdentityConstants.DIALOGOK) { var retainList = awc.OptionalAttributes.Intersect(optionalProps); var removeList = optionalProps.Except(retainList).ToList(); foreach (var item in removeList) { _properties.Remove(item.Key); } var addList = awc.OptionalAttributes.Except(retainList); foreach (var item in addList) { var dto = _serverDTO.Connection.SchemaManager.GetAttributeType(item.Key); _properties.Add(item.Key, new VMDirBagItem { Description = dto.Description, IsReadOnly = dto.ReadOnly, Value = null }); } this.PropertiesTableView.ReloadData(); } } catch (Exception ex) { UIErrorHelper.ShowAlert("", ex.Message); } }
private void OnClickManageAttributesButton (object sender, EventArgs e) { try { var optionalProps = GetCurrentOptionalProperties (); if (!_properties.ContainsKey ("objectClass")) throw new Exception ("Unable to fetch data for the object specified. Please ensure the user has access."); var oc = _properties ["objectClass"].Value; string cn = ""; if (oc is string) cn = oc.ToString (); else if (oc is List<string>) cn = (oc as List<string>) [0]; ManagePropertiesWindowController awc = new ManagePropertiesWindowController (_objectClass, optionalProps, _serverDTO); nint result = NSApplication.SharedApplication.RunModalForWindow (awc.Window); if (result == (nint)VMIdentityConstants.DIALOGOK) { var retainList = awc.OptionalAttributes.Intersect (optionalProps); var removeList = optionalProps.Except (retainList).ToList (); foreach (var item in removeList) _properties.Remove (item.Key); var addList = awc.OptionalAttributes.Except (retainList); foreach (var item in addList) { var dto = _serverDTO.Connection.SchemaManager.GetAttributeType (item.Key); _properties.Add (item.Key, new VMDirBagItem { Description = dto.Description, IsReadOnly = dto.ReadOnly, Value = null }); } this.PropertiesTableView.ReloadData (); } } catch (Exception ex) { UIErrorHelper.ShowAlert ("", ex.Message); } }
public void OnClickManageAttributes (object sender, EventArgs e) { UIErrorHelper.CheckedExec (delegate() { var optionalProps = GetCurrentOptionalProperties (); if (!_properties.ContainsKey ("objectClass")) throw new Exception ("Unable to fetch data for the object specified. Please ensure the user has access."); var oc = _properties ["objectClass"].Value; string cn = ""; if (oc is string) cn = oc.ToString (); else if (oc is LdapValue[]) { LdapValue[] val = oc as LdapValue[]; cn = val [(val.Count () - 1)].StringValue; //Get the most derived object class } ManagePropertiesWindowController awc = new ManagePropertiesWindowController (cn, optionalProps, serverDTO); nint result = NSApplication.SharedApplication.RunModalForWindow (awc.Window); if (result == (nint)VMIdentityConstants.DIALOGOK) { var retainList = awc.OptionalAttributes.Intersect (optionalProps); var removeList = optionalProps.Except (retainList).ToList (); foreach (var item in removeList) _properties.Remove (item.Key); var addList = awc.OptionalAttributes.Except (retainList); foreach (var item in addList) { var dto = serverDTO.Connection.SchemaManager.GetAttributeType (item.Key); _properties.Add (item.Key, new VMDirBagItem { Description = dto.Description, IsReadOnly = dto.ReadOnly, Value = null }); } ds.FillData (); this.LdapAttributesTableView.ReloadData (); } }); }