[Odsdotnet-commit] SF.net SVN: odsdotnet: [17] trunk/OdsClient
Status: Alpha
Brought to you by:
geniusj
|
From: <ge...@us...> - 2006-08-05 02:51:59
|
Revision: 17 Author: geniusj Date: 2006-08-04 19:51:53 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/odsdotnet/?rev=17&view=rev Log Message: ----------- Rudimentary hosts/domains listing support. Uses a TreeView. Not bad, but needs to be faster. That'll come next. Modified Paths: -------------- trunk/OdsClient/HostsController.Designer.cs trunk/OdsClient/HostsController.cs trunk/OdsClient/HostsController.resx trunk/OdsClient/ODSController.cs Modified: trunk/OdsClient/HostsController.Designer.cs =================================================================== --- trunk/OdsClient/HostsController.Designer.cs 2006-08-05 02:51:39 UTC (rev 16) +++ trunk/OdsClient/HostsController.Designer.cs 2006-08-05 02:51:53 UTC (rev 17) @@ -29,56 +29,166 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.button1 = new System.Windows.Forms.Button(); - this.hostsListBox = new System.Windows.Forms.ListBox(); + this.doneButton = new System.Windows.Forms.Button(); + this.odsHostsView = new System.Windows.Forms.TreeView(); this.odsRRBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.hostnameField = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.typeComboBox = new System.Windows.Forms.ComboBox(); + this.label3 = new System.Windows.Forms.Label(); + this.ttlField = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.targetField = new System.Windows.Forms.TextBox(); + this.updateHostsButton = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.odsRRBindingSource)).BeginInit(); this.SuspendLayout(); // - // button1 + // doneButton // - this.button1.Location = new System.Drawing.Point(211, 328); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); - this.button1.TabIndex = 2; - this.button1.Text = "Done"; - this.button1.UseVisualStyleBackColor = true; + this.doneButton.Location = new System.Drawing.Point(274, 328); + this.doneButton.Name = "doneButton"; + this.doneButton.Size = new System.Drawing.Size(75, 23); + this.doneButton.TabIndex = 2; + this.doneButton.Text = "Done"; + this.doneButton.UseVisualStyleBackColor = true; + this.doneButton.Click += new System.EventHandler(this.doneButton_click); // - // hostsListBox + // odsHostsView // - this.hostsListBox.DataSource = this.odsRRBindingSource; - this.hostsListBox.DisplayMember = "Record"; - this.hostsListBox.FormattingEnabled = true; - this.hostsListBox.Location = new System.Drawing.Point(12, 12); - this.hostsListBox.Name = "hostsListBox"; - this.hostsListBox.Size = new System.Drawing.Size(471, 303); - this.hostsListBox.TabIndex = 3; - this.hostsListBox.ValueMember = "Host"; + this.odsHostsView.Location = new System.Drawing.Point(13, 13); + this.odsHostsView.Name = "odsHostsView"; + this.odsHostsView.Size = new System.Drawing.Size(360, 309); + this.odsHostsView.TabIndex = 3; + this.odsHostsView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.odsHostsView_AfterSelect); // // odsRRBindingSource // this.odsRRBindingSource.DataSource = typeof(Ods.OdsRR); // + // hostnameField + // + this.hostnameField.Location = new System.Drawing.Point(379, 29); + this.hostnameField.MaxLength = 32; + this.hostnameField.Name = "hostnameField"; + this.hostnameField.Size = new System.Drawing.Size(231, 20); + this.hostnameField.TabIndex = 4; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(376, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(58, 13); + this.label1.TabIndex = 5; + this.label1.Text = "Hostname:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(376, 52); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(34, 13); + this.label2.TabIndex = 6; + this.label2.Text = "Type:"; + // + // typeComboBox + // + this.typeComboBox.FormattingEnabled = true; + this.typeComboBox.Items.AddRange(new object[] { + "A", + "CNAME", + "MX", + "NS", + "PTR", + "TXT", + "URL"}); + this.typeComboBox.Location = new System.Drawing.Point(379, 68); + this.typeComboBox.Name = "typeComboBox"; + this.typeComboBox.Size = new System.Drawing.Size(86, 21); + this.typeComboBox.TabIndex = 7; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(472, 52); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(30, 13); + this.label3.TabIndex = 8; + this.label3.Text = "TTL:"; + // + // ttlField + // + this.ttlField.Location = new System.Drawing.Point(475, 68); + this.ttlField.MaxLength = 6; + this.ttlField.Name = "ttlField"; + this.ttlField.Size = new System.Drawing.Size(135, 20); + this.ttlField.TabIndex = 9; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(376, 92); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(41, 13); + this.label4.TabIndex = 10; + this.label4.Text = "Target:"; + // + // targetField + // + this.targetField.Location = new System.Drawing.Point(379, 108); + this.targetField.Name = "targetField"; + this.targetField.Size = new System.Drawing.Size(231, 20); + this.targetField.TabIndex = 11; + // + // updateHostsButton + // + this.updateHostsButton.Location = new System.Drawing.Point(380, 145); + this.updateHostsButton.Name = "updateHostsButton"; + this.updateHostsButton.Size = new System.Drawing.Size(230, 29); + this.updateHostsButton.TabIndex = 12; + this.updateHostsButton.Text = "Update"; + this.updateHostsButton.UseVisualStyleBackColor = true; + // // HostsController // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(495, 359); - this.Controls.Add(this.hostsListBox); - this.Controls.Add(this.button1); + this.ClientSize = new System.Drawing.Size(622, 360); + this.Controls.Add(this.updateHostsButton); + this.Controls.Add(this.targetField); + this.Controls.Add(this.label4); + this.Controls.Add(this.ttlField); + this.Controls.Add(this.label3); + this.Controls.Add(this.typeComboBox); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.hostnameField); + this.Controls.Add(this.odsHostsView); + this.Controls.Add(this.doneButton); this.Name = "HostsController"; this.Text = "Hosts"; this.Load += new System.EventHandler(this.HostsController_Load); ((System.ComponentModel.ISupportInitialize)(this.odsRRBindingSource)).EndInit(); this.ResumeLayout(false); + this.PerformLayout(); } #endregion - private System.Windows.Forms.Button button1; - private System.Windows.Forms.ListBox hostsListBox; + private System.Windows.Forms.Button doneButton; private System.Windows.Forms.BindingSource odsRRBindingSource; + private System.Windows.Forms.TreeView odsHostsView; + private System.Windows.Forms.TextBox hostnameField; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ComboBox typeComboBox; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox ttlField; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox targetField; + private System.Windows.Forms.Button updateHostsButton; } Modified: trunk/OdsClient/HostsController.cs =================================================================== --- trunk/OdsClient/HostsController.cs 2006-08-05 02:51:39 UTC (rev 16) +++ trunk/OdsClient/HostsController.cs 2006-08-05 02:51:53 UTC (rev 17) @@ -11,33 +11,63 @@ { public partial class HostsController : Form { - private ArrayList hosts; + private ArrayList domains; public HostsController() { InitializeComponent(); - this.hosts = new ArrayList(); + this.domains = new ArrayList(); } - public HostsController(ArrayList hosts) + public HostsController(ArrayList domains) { InitializeComponent(); - this.hosts = hosts; + this.domains = domains; } private void HostsController_Load(object sender, EventArgs e) { - foreach (OdsRR host in this.hosts) + TreeNode rootDomainsNode, rootHostsNode, domainNode, hostNode, hostNodeClone; + + rootDomainsNode = odsHostsView.Nodes.Add("Domains"); + rootHostsNode = odsHostsView.Nodes.Add("Hosts"); + foreach (OdsDomain domain in this.domains) { - try + domainNode = rootDomainsNode.Nodes.Add(domain.DomainName); + foreach (OdsRR host in domain.Hosts) { - odsRRBindingSource.Add(host); + hostNode = new TreeNode(host.ToString()); + hostNode.Tag = host; + hostNodeClone = (TreeNode)hostNode.Clone(); + domainNode.Nodes.Add(hostNode); + rootHostsNode.Nodes.Add(hostNodeClone); } - catch (Exception ex) - { - System.Console.WriteLine(ex.Message); - } } } + + private void doneButton_click(object sender, EventArgs e) + { + this.Close(); + } + + private void odsHostsView_AfterSelect(object sender, TreeViewEventArgs e) + { + OdsRR host; + host = (OdsRR)e.Node.Tag; + + if (host != null) + { + hostnameField.Text = host.Host; + typeComboBox.SelectedIndex = typeComboBox.FindStringExact(host.RRType); + ttlField.Text = host.TTL; + targetField.Text = host.Target; + } + else + { + hostnameField.Text = ""; + ttlField.Text = ""; + targetField.Text = ""; + } + } } } \ No newline at end of file Modified: trunk/OdsClient/HostsController.resx =================================================================== --- trunk/OdsClient/HostsController.resx 2006-08-05 02:51:39 UTC (rev 16) +++ trunk/OdsClient/HostsController.resx 2006-08-05 02:51:53 UTC (rev 17) @@ -118,9 +118,6 @@ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <metadata name="odsRRBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>17, 17</value> + <value>16, 16</value> </metadata> - <metadata name="odsRRBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>17, 17</value> - </metadata> </root> \ No newline at end of file Modified: trunk/OdsClient/ODSController.cs =================================================================== --- trunk/OdsClient/ODSController.cs 2006-08-05 02:51:39 UTC (rev 16) +++ trunk/OdsClient/ODSController.cs 2006-08-05 02:51:53 UTC (rev 17) @@ -67,7 +67,7 @@ private void editHostsButton_Click(object sender, EventArgs e) { OdsConnection odsconn; - ArrayList hosts; + ArrayList domains; HostsController hc; if (ValidateForm()) @@ -79,15 +79,13 @@ usernameField.Text, passwordField.Text); - hosts = odsconn.GetRRList(); - hc = new HostsController(hosts); - hc.Visible = true; + domains = odsconn.GetRRListByDomain(); + hc = new HostsController(domains); + hc.Show(); } catch (OdsServerException ex) { - odsStatusLabel.Text = ex.Message; - hc = new HostsController(); - hc.Show(); + MessageBox.Show(ex.Message); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |