public void FillForwarders() { UIErrorHelper.CheckedExec(delegate() { Forwarders = ServerDTO.DNSClient.GetForwarders().ToList(); }); }
protected override void OnInitialize(AsyncStatus status) { base.OnInitialize(status); this.Columns[0].Title = VMDirSchemaConstants.VMDIRSCHEMA_NAME; this.Columns[0].SetWidth(130); this.Columns.Add(new MmcListViewColumn(VMDirSchemaConstants.VMDIRSCHEMA_ATTR_SYNTAX, 130)); this.Columns.Add(new MmcListViewColumn(VMDirSchemaConstants.VMDIRSCHEMA_DESC, 130)); this.Mode = MmcListViewMode.Report; (this.ScopeNode as VMDirSchemaAttributeBaseNode).ListView = this; UIErrorHelper.CheckedExec(delegate() { Refresh(); }); }
partial void OnExport(NSObject sender) { if (!ValidateExport()) { return; } UIErrorHelper.CheckedExec(delegate { StringBuilder sb = new StringBuilder(); var start = 0; var end = _resultList.Count; if (ScopeComboBox.SelectedIndex == (int)ExportScope.CURR_PAGE) { start = (_currPage - 1) * _pageSize; end = _currPage * _pageSize > _resultList.Count ? _resultList.Count : _currPage * _pageSize; } HashSet <string> attrToExport = new HashSet <string>(); if (AllReturnAttrCheckBox.State == NSCellStateValue.On) { foreach (var item in _returnedAttrList) { attrToExport.Add(item); } } else { foreach (var item in _attrToExportDs.attrList) { attrToExport.Add(item); } } foreach (var item in attrToExport) { sb.Append(item + ","); } sb.Append(Environment.NewLine); for (var i = start; i < end; i++) { foreach (var item in attrToExport) { sb.Append("\""); if (_resultList[i].NodeProperties.ContainsKey(item)) { foreach (var val in _resultList[i].NodeProperties[item].Values) { sb.Append(val.StringValue + " "); } } sb.Append("\""); sb.Append(","); } sb.Append(Environment.NewLine); } if (FileIOUtil.WriteAllTextToFile(sb.ToString(), "Export Result", new string[] { "csv" })) { UIErrorHelper.ShowInformation(VMDirConstants.STAT_RES_EXPO_SUCC); } }); }
public override VmDnsRecord GetRecordDataFromUIFields() { VmDnsRecord addressRecord = null; UIErrorHelper.CheckedExec(delegate() { DoValidateControls(); var data = new VMDNS_SOA_DATA(); data.pNamePrimaryServer = AddRecordFrm.SOARecordPrimaryServerText.Text; data.pNameAdministrator = AddRecordFrm.SOARecordAdministratorText.Text; var record = new VMDNS_RECORD_SOA(); record.data = data; record.common.iClass = 1; record.common.pszName = AddRecordFrm.SOARecordNameText.Text; record.common.type = (UInt16)RecordType.VMDNS_RR_TYPE_SOA; addressRecord = new VmDnsRecordSOA(record); }); return(addressRecord); }
public void ShowAddWindow() { SelectObjectClassWindowController swc = new SelectObjectClassWindowController(ServerDTO.Connection.SchemaManager); nint result = NSApplication.SharedApplication.RunModalForWindow(swc.Window); if (result == (nint)VMIdentityConstants.DIALOGOK) { CreateObjectWindowController cwc = new CreateObjectWindowController(swc.SelectedObject.Name, ServerDTO, Dn); nint res = NSApplication.SharedApplication.RunModalForWindow(cwc.Window); if (res == (nint)VMIdentityConstants.DIALOGOK) { UIErrorHelper.CheckedExec(delegate() { var attr = cwc._properties.Select(x => Utilities.MakeAttribute(x)).ToArray(); string newdn = cwc.Rdn + "," + Dn; ServerDTO.Connection.AddObject(newdn, attr); UIErrorHelper.ShowInformation(VMDirConstants.STAT_OBJ_ADD_SUCC); var oc = Utilities.GetObjectClassList(ServerDTO, newdn, LdapScope.SCOPE_BASE); this.Children.Insert(0, new DirectoryNode(newdn, oc, ServerDTO, this)); //ReloadChildren(); RefreshProperties(); NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadOutlineView", this); NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadTableView", this); }); } swc.Dispose(); } }
protected override void OnInitialize(AsyncStatus status) { base.OnInitialize(status); this.Columns[0].Title = VMDNSConstants.RECORD_NAME; this.Columns[0].SetWidth(130); this.Columns.Add(new MmcListViewColumn(VMDNSConstants.RECORD_TYPE, 130)); this.Mode = MmcListViewMode.Report; this.SelectionData.EnabledStandardVerbs = StandardVerbs.Delete | StandardVerbs.Refresh; (this.ScopeNode as VMDNSZoneEntryNode).ListView = this; UIErrorHelper.CheckedExec(delegate() { Refresh(); }); }
partial void OnAddZone(Foundation.NSObject sender) { UIErrorHelper.CheckedExec(delegate() { DoValidateControls(); switch (zoneType) { case (int)VmDnsZoneType.FORWARD: ZoneInfo.pszName = ZoneNameForwardZone.StringValue; ZoneInfo.pszRName = AdminEmailForwardZone.StringValue; ZoneInfo.pszPrimaryDnsSrvName = HostNameForwardZone.StringValue; ZoneInfo.dwZoneType = (UInt32)VmDnsZoneType.FORWARD; break; case (int)VmDnsZoneType.REVERSE: ZoneInfo.pszRName = AdminEmailReverseZone.StringValue; ZoneInfo.pszName = HostNameReverseZone.StringValue; ZoneInfo.pszPrimaryDnsSrvName = NetworkIDReverseZone.StringValue + "\\" + NoBitsReverseZone.StringValue; ZoneInfo.dwZoneType = (UInt32)VmDnsZoneType.REVERSE; break; } this.Close(); NSApplication.SharedApplication.StopModalWithCode(VMIdentityConstants.DIALOGOK); }); }
public void UpdateStoreInfo(string storename) { UIErrorHelper.CheckedExec(delegate() { if (storename != null) { string storePass = ""; using (var session = new VecsStoreSession(ServerDTO.VecsClient, storename, storePass)) { // update store info if (StoresInfo.ContainsKey(storename)) { StoresInfo [storename] = new CertBagItem() { PrivateKeys = session.GetPrivateKeys().Concat(session.GetEncryptedPrivateKeys()).ToList(), SecretKeys = session.GetSecretKeys().ToList(), Certs = session.GetCertificates().ToList() }; CalculateKeyInfo(); } else { StoresInfo.Add(storename, new CertBagItem() { PrivateKeys = session.GetPrivateKeys().Concat(session.GetEncryptedPrivateKeys()).ToList(), SecretKeys = session.GetSecretKeys().ToList(), Certs = session.GetCertificates().ToList() }); NoStores++; } } } }); }
public void RefreshChildren() { UIErrorHelper.CheckedExec(delegate() { this.Children.Clear(); this.objectClasses.Clear(); objectClassManager = this.ServerNode.ServerDTO.Connection.SchemaManager.GetObjectClassManager(); var data = objectClassManager.Data; foreach (var entry in data) { objectClasses.Add(new VMDirSchemaClassEntryNode(this.ServerNode, entry.Value)); } objectClasses = objectClasses.OrderBy(o => o.DisplayName).ToList(); this.Children.AddRange(objectClasses.ToArray()); }); }
public override VmDnsRecord GetRecordDataFromUIFields() { VmDnsRecord addressRecord = null; UIErrorHelper.CheckedExec(delegate() { DoValidateControls(); var data = new VMDNS_A_DATA(); data.IpAddress = (UInt32)IPAddress.NetworkToHostOrder( (int)IPAddress.Parse(AddRecordFrm.ARecordHostIPText.Text).Address); VMDNS_RECORD_A record = new VMDNS_RECORD_A(); record.data = data; record.common.iClass = 1; record.common.pszName = AddRecordFrm.ARecordHostNameText.Text; record.common.type = (UInt16)RecordType.VMDNS_RR_TYPE_A; addressRecord = new VmDnsRecordA(record); }); return(addressRecord); }
public void RemoveStoreInfo(string storename) { UIErrorHelper.CheckedExec(delegate() { StoresInfo.Remove(storename); CalculateKeyInfo(); }); }
protected override void OnInitialize(AsyncStatus status) { base.OnInitialize(status); this.Columns[0].Title = VMDNSConstants.ZONE_NAME; this.Columns[0].SetWidth(130); this.Columns.Add(new MmcListViewColumn(VMDNSConstants.DNS_NAME, 130)); this.Columns.Add(new MmcListViewColumn(VMDNSConstants.ADMIN_EMAIL, 130)); this.Mode = MmcListViewMode.Report; (this.ScopeNode as VMDNSZonesBaseNode).ListView = this; UIErrorHelper.CheckedExec(delegate() { Refresh(); }); }
private void OK_Click(object sender, EventArgs e) { UIErrorHelper.CheckedExec(delegate() { DoValidateControls(); ZoneInfo = new VMDNS_ZONE_INFO() { pszName = HostNameText.Text, pszRName = AdminEmailText.Text, pszPrimaryDnsSrvName = NetworkIDText.Text + "\\" + NetworkIDLengthText.Text, dwZoneType = (uint)VmDnsZoneType.FORWARD }; this.Close(); this.DialogResult = DialogResult.OK; }); }
public override VmDnsRecord GetRecordDataFromUIFields() { VmDnsRecord addressRecord = null; UIErrorHelper.CheckedExec(delegate() { DoValidateControls(); var data = new VMDNS_SRV_DATA(); data.pNameTarget = AddRecordFrm.SRVRecordTargetHostText.Text; data.wPriority = Convert.ToUInt16(AddRecordFrm.SRVRecordPriorityText.Text); data.wWeight = Convert.ToUInt16(AddRecordFrm.SRVRecordWeightText.Text); data.wPort = Convert.ToUInt16(AddRecordFrm.SRVPortText.Text); var record = new VMDNS_RECORD_SRV(); record.data = data; record.common.iClass = 1; record.common.pszName = "_" + AddRecordFrm.SRVRecordServiceCombo.Text + "._" + AddRecordFrm.SRVRecordProtocolCombo.Text; record.common.type = (UInt16)RecordType.VMDNS_RR_TYPE_SRV; addressRecord = new VmDnsRecordSRV(record); }); return(addressRecord); }
/// <summary> /// Alter the display of the cell text. /// </summary> /// <param name="tableView">Table view.</param> /// <param name="cell">Cell.</param> /// <param name="tableColumn">Table column.</param> /// <param name="row">Row.</param> public override void WillDisplayCell(NSTableView tableView, NSObject cell, NSTableColumn tableColumn, nint row) { UIErrorHelper.CheckedExec(delegate() { if (cell is NSBrowserCell) { NSBrowserCell browserCell = cell as NSBrowserCell; if (browserCell != null) { browserCell.Leaf = true; if (tableColumn.Identifier == Constants.TableColumnIconId) { browserCell.Image = NSImage.ImageNamed(Constants.ServiceImage); } } } else if (cell is NSTextFieldCell) { NSTextFieldCell textCell = cell as NSTextFieldCell; // Apply the text color code to the status column text if (textCell != null && tableColumn.Identifier == Constants.ServiceTableColumnStatusId) { var item = _controller.GetService((int)row); { // Color Code -> Heartbeat IN-ACTIVE: Red | Heartbeat ACTIVE: GREEN | No Heartbeat: Black textCell.TextColor = !item.Alive ? NSColor.Red : NSColor.FromSrgb((nfloat)3.0 / 255, (nfloat)161 / 255, (nfloat)27 / 255, 1); } } } }); }
private void EditButton_Click(object sender, EventArgs e) { if (this.EditButton.Text == VMDNSConstants.EDIT) { this.EditButton.Text = VMDNSConstants.UPDATE; ToggleUIControlsState(true); } else { UIErrorHelper.CheckedExec(delegate() { DoValidateControls(); SetZoneValuesFromUIFields(); //close dialog and return }); } }
partial void OnStoreQueryToolBarItem(NSObject sender) { UIErrorHelper.CheckedExec(delegate() { var data = GetQuery(); if (data == null) { return; } using (var ms = new MemoryStream()) { var xmlSerializer = new XmlSerializer(data.GetType()); xmlSerializer.Serialize(ms, data); var save = NSSavePanel.SavePanel; save.AllowedFileTypes = new string[] { "xml" }; save.Title = "Store Query"; nint result = save.RunModal(); if (result == (int)1) { string path = save.Url.Path; File.WriteAllBytes(path, ms.ToArray()); UIErrorHelper.ShowInformation(VMDirConstants.STAT_QUERY_STORE_SUCC); } } }); }
public override VmDnsRecord GetRecordDataFromUIFields() { VmDnsRecord addressRecord = null; UIErrorHelper.CheckedExec(delegate() { DoValidateControls(); var data = new VMDNS_AAAA_DATA(); var addr = IPAddress.Parse(AddRecordFrm.AAAARecordHostIP.Text); data.Ip6Address.bytes = addr.GetAddressBytes(); var record = new VMDNS_RECORD_AAAA(); record.common.iClass = 1; record.common.pszName = AddRecordFrm.AAAARecordHostNameText.Text; record.common.type = (UInt16)RecordType.VMDNS_RR_TYPE_AAAA; record.data = data; addressRecord = new VmDnsRecordAAAA(record); }); return(addressRecord); }
public void ShowRootCertificate() { UIErrorHelper.CheckedExec(delegate() { var cert = ServerDTO.VMCAClient.GetRootCertificate(); CertificateService.DisplayX509Certificate2(this, cert); }); }
private void MoveForwarderUp(object sender, EventArgs e) { int selectedRow = (int)this.ForwardersList.SelectedIndex; if (selectedRow > 0) { UIErrorHelper.CheckedExec(delegate() { //TODO - revisit and cleanup when https://bugzilla.eng.vmware.com/show_bug.cgi?id=1541111 is fixed string temp = ServerNode.Forwarders[selectedRow]; //ServerNode.ServerDTO.DNSClient.DeleteForwarder(selectedRow); ServerNode.Forwarders.RemoveAt(selectedRow); //ServerNode.ServerDTO.DNSClient.InsertForwarder(temp, selectedRow - 1); ServerNode.Forwarders.Insert(selectedRow - 1, temp); }); //Verify if forwarders is updated } }
public void AddSecretKey(object sender, EventArgs args) { UIErrorHelper.CheckedExec(delegate() { AddSecretKeyWindowController cwc = new AddSecretKeyWindowController(); NSApplication.SharedApplication.BeginSheet(cwc.Window, VMCertStoreSnapInEnvironment.Instance.mainWindow, () => { }); nint result = NSApplication.SharedApplication.RunModalForWindow(cwc.Window); try { if (result == (nint)VMIdentityConstants.DIALOGOK) { var dto = cwc.SecretKeyDTO; string storeName = (string)Tag; string storePass = ""; using (var session = new VecsStoreSession(ServerNode.ServerDTO.VecsClient, storeName, storePass)) { session.AddSecretKeyEntry(dto.Alias, dto.SecretKey, dto.Password, null); } ServerNode.UpdateStoreInfo(storeName); NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadTableView", this); } } finally { VMCertStoreSnapInEnvironment.Instance.mainWindow.EndSheet(cwc.Window); cwc.Dispose(); } }); }
private void AddButton_Click_1(object sender, EventArgs e) { UIErrorHelper.CheckedExec(delegate() { if (this.AddButton.Text == VMwareMMCIDP.UI.Common.Utilities.MMCUIConstants.EDIT) { SetUIToolsEditability(); this.AddButton.Text = VMwareMMCIDP.UI.Common.Utilities.MMCUIConstants.UPDATE; } else if (UIErrorHelper.ShowConfirm(VMwareMMCIDP.UI.Common.Utilities.MMCUIConstants.CONFIRM) == DialogResult.Yes) { DoValidateControls(); FillDTOWithUIControls(); this.Close(); this.DialogResult = DialogResult.OK; } }); }
private void GetPage() { List <DirectoryNode> lst = new List <DirectoryNode>(); UIErrorHelper.CheckedExec(delegate { ServerDTO.Connection.PagedSearch(qdto, ServerDTO.PageSize, cookie, morePages, delegate(ILdapMessage ldMsg, IntPtr ck, bool moreP, List <ILdapEntry> entries) { cookie = ck; morePages = moreP; totalCount += entries.Count(); pageNumber++; foreach (var entry in entries) { var ocList = new List <string>(entry.getAttributeValues(VMDirConstants.ATTR_OBJECT_CLASS).Select(x => x.StringValue).ToArray()); var node = new DirectoryNode(entry.getDN(), ocList, ServerDTO, this); //node.NodeProperties = ServerDTO.Connection.GetEntryProperties(entry); lst.Add(node); } }); isChildrenLoaded = true; this.Children.AddRange(lst.ToArray()); NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadOutlineView", this); }); }
public void RefreshTableViewsBasedOnSelection(nint row) { UIErrorHelper.CheckedExec(delegate() { if (row >= (nint)0) { NSObject item = splitViewController.MainOutlineView.ItemAtRow((int)row); NSTableView table = splitViewController.MainTableView; RemoveTableColumns(); if (item is VMDNSForwardZonesNode || item is VMDNSReverseZonesNode) { DisplayZoneDetails(item); } else if (item is VMDNSZoneEntryNode) { DisplayRecordDetails(item); } else { //Display root node children NSTableColumn col = new NSTableColumn(VMIdentityConstants.NAME_FIELD); col.HeaderCell.Title = VMIdentityConstants.NAME_FIELD; col.DataCell = new NSBrowserCell(); col.Width = 160; table.AddColumn(col); VMDNSRootScopeNode node = item as VMDNSRootScopeNode; splitViewController.MainTableView.DataSource = new NodesListView(node.Children, null); } table.ReloadData(); } }); }
public virtual void PerformDelete() { ConfirmationDialogController cwc = new ConfirmationDialogController("Are you sure?"); nint result = NSApplication.SharedApplication.RunModalForWindow(cwc.Window); if (result == (nint)VMIdentityConstants.DIALOGOK) { UIErrorHelper.CheckedExec(delegate() { ServerDTO.Connection.DeleteObject(Dn); ScopeNode node = this.Parent; if (node != null) { node.Children.Remove(this); if (node is DirectoryNode) { (node as DirectoryNode).ReloadChildren(); } NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadOutlineView", node); NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadTableView", node); UIErrorHelper.ShowInformation(VMDirConstants.STAT_OBJ_DEL_SUCC); } else { UIErrorHelper.ShowInformation(VMDirConstants.STAT_BASE_OBJ_DEL_SUCC); } }); } }
public void OnQueryRecordPopoverClosed(NSNotification notification) { if (QueryRecordPopover != null && fwc != null) { if (!string.IsNullOrWhiteSpace(fwc.RecordName) && !string.IsNullOrWhiteSpace(fwc.ZoneName)) { UIErrorHelper.CheckedExec(delegate() { int row = (int)splitViewController.MainOutlineView.SelectedRow; NSObject item = splitViewController.MainOutlineView.ItemAtRow(row); if (item is VMDNSZoneEntryNode) { var zone = (item as VMDNSZoneEntryNode).CurrentZone; if (zone != null) { IList <VmDnsRecord> records = zone.QueryRecords( fwc.RecordName, fwc.RecordType, 0); splitViewController.MainTableView.DataSource = new DnsRecordListView(item as VMDNSZoneEntryNode, records); splitViewController.MainTableView.ReloadData(); } } }); } } }
public override VmDnsRecord GetRecordDataFromUIFields() { VmDnsRecord addressRecord = null; UIErrorHelper.CheckedExec(delegate() { DoValidateControls(); var data = new VMDNS_PTR_DATA(); data.hostName = AddRecordFrm.CNameRecordHostNameText.Text; var record = new VMDNS_RECORD_CNAME(); record.data = data; record.common.iClass = 1; record.common.pszName = AddRecordFrm.CNameRecordNameText.Text; record.common.type = (UInt16)RecordType.VMDNS_RR_TYPE_CNAME; addressRecord = new VmDnsRecordCNAME(record); }); return(addressRecord); }
/// <summary> /// Objects the value for table column. /// </summary> /// <returns>The value for table column.</returns> /// <param name="table">Table.</param> /// <param name="col">Col.</param> /// <param name="row">Row.</param> public NSObject ObjectValueForTableColumn(NSTableView table, NSTableColumn col, int row) { var value = (NSString)string.Empty; UIErrorHelper.CheckedExec(delegate() { if (Entries != null) { var obj = (FilterCriteriaDto)(this.Entries [row]); switch (col.Identifier) { case Constants.FilterCriteriaTableColumnId: value = (NSString)obj.Column; break; case Constants.FilterCriteriaTableColumnOpearatorId: value = (NSString)EnumHelper.GetDescription(obj.Operator); break; case Constants.FilterCriteriaTableColumnValueId: value = (NSString)obj.Value; break; default: break; } } }); return(value); }
/// <summary> /// Objects the value for table column. /// </summary> /// <returns>The value for table column.</returns> /// <param name="table">Table.</param> /// <param name="col">Col.</param> /// <param name="row">Row.</param> public NSObject ObjectValueForTableColumn(NSTableView table, NSTableColumn col, int row) { var value = (NSString)string.Empty; UIErrorHelper.CheckedExec(delegate() { if (Entries != null) { var obj = (this.Entries [row]) as NodeDto; switch (col.Identifier) { case Constants.PscTableColumnNameId: value = (NSString)obj.Name; break; case Constants.PscTableColumnStatusId: value = (NSString)(obj.Active ? Constants.Active : Constants.InActive); break; case Constants.PscTableColumnSitenameId: value = (NSString)obj.Sitename; break; default: break; } } }); return(value); }
public void FillReverseZones() { UIErrorHelper.CheckedExec(delegate() { ReverseZones = ServerDTO.DNSClient.ListZones(VmDnsZoneType.REVERSE).ToList(); }); }