public void Refresh() { ResultNodes.Clear(); int nodeCounter = 0; this.Entries = (this.ScopeNode as VMDNSZoneEntryNode).CurrentZone.ListRecords(); foreach (var record in this.Entries) { var resultNode = new ResultNode { DisplayName = record.Name }; resultNode.ImageIndex = (int)VMDNSTreeImageIndex.Record; resultNode.Tag = nodeCounter++; resultNode.SubItemDisplayNames.Add(VMDNSUtilityService.GetRecordNameFromType((RecordType)record.Type)); this.ResultNodes.Add(resultNode); } this.Sort(0); this.DescriptionBarText = this.ResultNodes.Count.ToString(); }
void DoValidateControls() { switch (zoneType) { case (int)VmDnsZoneType.FORWARD: if (!VMDNSUtilityService.IsValidIPAddress(HostIPForwardZone.StringValue)) { throw new Exception(VMDNSConstants.IP_VALIDATE); } if (string.IsNullOrWhiteSpace(HostNameForwardZone.StringValue) || string.IsNullOrWhiteSpace(ZoneNameForwardZone.StringValue)) { throw new Exception("One or more required fields are empty"); } break; case (int)VmDnsZoneType.REVERSE: if (string.IsNullOrWhiteSpace(HostNameReverseZone.StringValue) || string.IsNullOrWhiteSpace(NetworkIDReverseZone.StringValue) || string.IsNullOrWhiteSpace(NoBitsReverseZone.StringValue)) { throw new Exception("One or more required fields are empty"); } break; default: break; } }
public NSObject ObjectValueForTableColumn(NSTableView table, NSTableColumn col, int row) { NSString value = NSString.Empty; try { if (Entries != null) { VmDnsRecord record = Entries[row]; switch (col.Identifier) { case VMDNSConstants.RECORD_NAME: value = (NSString)record.Name; break; case VMDNSConstants.RECORD_TYPE: value = (NSString)VMDNSUtilityService.GetRecordNameFromType((RecordType)record.Type); break; } } } catch (Exception) { value = NSString.Empty; } return(value); }
partial void Search(Foundation.NSObject sender) { UIErrorHelper.CheckedExec(delegate() { DoValidateControls(); RecordName = RecordNameField.StringValue; RecordType = VMDNSUtilityService.GetRecordType(RecordTypeOptionsField.TitleOfSelectedItem); ZoneName = ZoneNameField.StringValue; parent.Close(); }); }
protected override void DoValidateControls() { if (!VMDNSUtilityService.IsValidIPAddress(HostIPField.StringValue)) { throw new Exception(VMDNSConstants.IP_VALIDATE); } if (string.IsNullOrWhiteSpace(HostNameField.StringValue)) { throw new ArgumentNullException(VMIdentityConstants.EMPTY_FIELD); } }
protected override void DoValidateControls() { if (!VMDNSUtilityService.IsValidIPAddress(AddRecordFrm.ARecordHostIPText.Text)) { throw new Exception(VMDNSConstants.IP_VALIDATE); } if (string.IsNullOrWhiteSpace(AddRecordFrm.ARecordHostNameText.Text)) { throw new ArgumentNullException(MMCUIConstants.VALUES_EMPTY); } }
public void AddRecord(object sender, EventArgs args) { ChooseRecordTypeController cwc = new ChooseRecordTypeController(CurrentZone.Name); nint ret = NSApplication.SharedApplication.RunModalForWindow(cwc.Window); if (ret == (nint)VMIdentityConstants.DIALOGOK) { RecordType recordType = VMDNSUtilityService.GetRecordType(cwc.RecordType); AddNewRecordController awc = new AddNewRecordController(recordType); nint retVal = NSApplication.SharedApplication.RunModalForWindow(awc.Window); if (retVal == VMIdentityConstants.DIALOGOK) { AddRecordToZone(awc.Record); } } }
public void AddRecord() { var frm = new ChooseRecordType(CurrentZone.Name); if (SnapIn.Console.ShowDialog(frm) == DialogResult.OK) { RecordType recordType = VMDNSUtilityService.GetRecordType(frm.RecordType); var frmAdd = new AddNewRecord(recordType); if (SnapIn.Console.ShowDialog(frmAdd) == DialogResult.OK) { AddRecordToZone(frmAdd.Record); } } }
public override void AwakeFromNib() { base.AwakeFromNib(); InitialiseViewControllers(recordType); this.Window.Title += " - " + VMDNSUtilityService.GetRecordNameFromType(recordType); //if view properties mode, set ui controls to initialise with record data and remove add button. also make the ui controls not editable. if (isViewMode && recordControllerObject != null) { this.Window.Title = "Record Properties"; recordControllerObject.SetUIFieldsFromRecordData(Record); AddButton.Hidden = true; recordControllerObject.SetUIFieldsEditability(false); } else { this.Close(); NSApplication.SharedApplication.StopModalWithCode(0); } }