private void PopulateThemePropertyPanel(PropertiesForm form, ThemeNode node) { Debug.Assert(node.Data != null, "TMNode node has no no data object"); Debug.Assert(node.Metadata != null, "TMNode node has no metadata object"); form.themeName.DataBindings.Clear(); form.themeFile.DataBindings.Clear(); form.themeMetadata.DataBindings.Clear(); form.themeTags.DataBindings.Clear(); form.themeSummary.DataBindings.Clear(); form.themeDescription.DataBindings.Clear(); form.themePubDate.DataBindings.Clear(); form.themeDataType.DataBindings.Clear(); form.themeDataSource.DataBindings.Clear(); form.themeName.DataBindings.Add(new Binding("Text", node, "Name")); form.themeFile.DataBindings.Add(new Binding("Text", node.Data, "Path")); form.themeDataType.DataBindings.Add(new Binding("Text", node.Data, "Type")); form.themeDataSource.DataBindings.Add(new Binding("Text", node.Data, "DataSource")); form.themeMetadata.DataBindings.Add(new Binding("Text", node.Metadata, "Path")); form.themeTags.DataBindings.Add(new Binding("Text", node, "Tags")); form.themeSummary.DataBindings.Add(new Binding("Text", node, "Summary")); form.themeDescription.DataBindings.Add(new Binding("Text", node, "Description")); form.themePubDate.DataBindings.Add(new Binding("Value", node, "PubDate")); if (node is SubThemeNode) { form.themeName.Enabled = false; form.themeFile.Enabled = false; form.themeDataType.Enabled = false; form.reloadThemeButton.Visible = false; form.themeFileButton.Visible = false; } else { form.themeName.Enabled = true; form.themeFile.Enabled = true; form.themeDataType.Enabled = true; form.reloadThemeButton.Visible = true; form.themeFileButton.Visible = true; } }
private void PopulateCategoryPropertyPanel(PropertiesForm form, CategoryNode node) { Debug.Assert(node.Metadata != null, "TMNode node has no metadata object"); form.categoryName.DataBindings.Clear(); form.categoryMetadata.DataBindings.Clear(); form.categoryDescription.DataBindings.Clear(); form.categoryName.DataBindings.Add(new Binding("Text", node, "Name")); form.categoryMetadata.DataBindings.Add(new Binding("Text", node.Metadata, "Path")); form.categoryDescription.DataBindings.Add(new Binding("Text", node, "Description")); }
private void PopulateThemeListPropertyPanel(PropertiesForm form, ThemeListNode node) { Debug.Assert(node.Author != null, "Themelist node has no author object"); Debug.Assert(node.Metadata != null, "TMNode node has no metadata object"); form.themelistFile.Text = node.FilePath; form.themelistName.DataBindings.Clear(); form.themelistMetadata.DataBindings.Clear(); form.themelistDescription.DataBindings.Clear(); form.themelistName.DataBindings.Add(new Binding("Text", node, "Name")); form.themelistMetadata.DataBindings.Add(new Binding("Text", node.Metadata, "Path")); form.themelistDescription.DataBindings.Add(new Binding("Text", node, "Description")); if (node.Author != null) { string value; node.Author.TryGetValue("Name", out value); form.themelistAuthorName.Text = value; node.Author.TryGetValue("Title", out value); form.themelistAuthorTitle.Text = value; node.Author.TryGetValue("Organization", out value); form.themelistAuthorOrg.Text = value; node.Author.TryGetValue("Address1", out value); form.themelistAuthorAddress1.Text = value; node.Author.TryGetValue("Address2", out value); form.themelistAuthorAddress2.Text = value; node.Author.TryGetValue("Phone", out value); form.themelistAuthorPhone.Text = value; node.Author.TryGetValue("Email", out value); form.themelistAuthorEmail.Text = value; } }
private void DisplayPropertyPanel(Control.ControlCollection controls, TmNode node) { controls.Clear(); if (node == null) return; if (propertiesForm == null) propertiesForm = new PropertiesForm().CommonInit(); if (node is ThemeListNode) { AddPropertyPanelToForm(controls, propertiesForm.themelistPanel, node.IsReadOnly); PopulateThemeListPropertyPanel(propertiesForm, (ThemeListNode)node); } if (node is CategoryNode) { AddPropertyPanelToForm(controls, propertiesForm.categoryPanel, node.IsReadOnly); PopulateCategoryPropertyPanel(propertiesForm, (CategoryNode)node); } if (node is ThemeNode || node is SubThemeNode) { AddPropertyPanelToForm(controls, propertiesForm.themePanel, node.IsReadOnly); PopulateThemePropertyPanel(propertiesForm, (ThemeNode)node); } }
private void PopulateCategoryPropertyPanel(PropertiesForm form, TmNode node) { Debug.Assert(node.Data != null, "TMNode node has no no data object"); Debug.Assert(node.Metadata != null, "TMNode node has no metadata object"); form.categoryName.DataBindings.Clear(); form.categoryMetadata.DataBindings.Clear(); form.categoryDescription.DataBindings.Clear(); //form.categoryAge.DataBindings.Clear(); //form.categoryHide.DataBindings.Clear(); form.categoryName.DataBindings.Add(new Binding("Text", node, "Name")); form.categoryMetadata.DataBindings.Add(new Binding("Text", node.Metadata, "Path")); form.categoryDescription.DataBindings.Add(new Binding("Text", node, "Description")); //form.categoryAge.DataBindings.Add(new Binding("Text", node, "DaysSinceNewestPublication")); //form.categoryHide.DataBindings.Add(new Binding("Checked", node, "IsHidden")); }
private void PopulateThemeListPropertyPanel(PropertiesForm form, TmNode node) { //FIXME node.Metadata and node.Data may not exists // ?? create a dummy property that will act as a proxy until the object is created // ?? monitor events and provide a proxy during event handlers // ?? always create a metadata and data object Debug.Assert(node.Author != null, "Themelist node has no author object"); Debug.Assert(node.Data != null, "TMNode node has no no data object"); Debug.Assert(node.Metadata != null, "TMNode node has no metadata object"); form.themelistName.DataBindings.Clear(); form.themelistFile.DataBindings.Clear(); form.themelistMetadata.DataBindings.Clear(); form.themelistDescription.DataBindings.Clear(); //form.themelistAge.DataBindings.Clear(); form.themelistName.DataBindings.Add(new Binding("Text", node, "Name")); form.themelistFile.DataBindings.Add(new Binding("Text", node.Data, "Path")); form.themelistMetadata.DataBindings.Add(new Binding("Text", node.Metadata, "Path")); form.themelistDescription.DataBindings.Add(new Binding("Text", node, "Description")); //form.themelistAge.DataBindings.Add(new Binding("Text", node, "DaysSinceNewestPublication")); /* DataGridViewComboBoxColumn authorAttributes = form.authorDataGridView.Columns["Attribute"] as DataGridViewComboBoxColumn; if (authorAttributes != null) authorAttributes.Items.AddRange(ThemeListAuthor.DefaultKeys); if (node.HasAuthor) { BindingSource _bindingSource = new BindingSource(); form.authorDataGridView.DataSource = _bindingSource; _bindingSource.DataSource = from row in node.Author select new { Attribute = row.Key, Value = row.Value }; //form.authorDataGridView.DataSource = node.Author ; } */ if (node.Author != null) { string value; node.Author.TryGetValue("Name", out value); form.themelistAuthorName.Text = value; node.Author.TryGetValue("Title", out value); form.themelistAuthorTitle.Text = value; node.Author.TryGetValue("Organization", out value); form.themelistAuthorOrg.Text = value; node.Author.TryGetValue("Address1", out value); form.themelistAuthorAddress1.Text = value; node.Author.TryGetValue("Address2", out value); form.themelistAuthorAddress2.Text = value; node.Author.TryGetValue("Phone", out value); form.themelistAuthorPhone.Text = value; node.Author.TryGetValue("Email", out value); form.themelistAuthorEmail.Text = value; } }