private void ValueTextBox_TextChanged(object sender, EventArgs e) { if (FieldsCombo.SelectedItem == null) { return; } TemplateTag tag = (TemplateTag)FieldsCombo.SelectedItem; if (tag.FieldType == ProfileFieldType.Text) { string fieldName = tag.Name; if (fieldName == "MOTD") { fieldName = "MOTD-" + MainView.GetProjectID().ToString(); } TextFields[fieldName] = ValueTextBox.Text; } if (tag.FieldType == ProfileFieldType.File) { FileFields[tag.Name] = ValueTextBox.Text; } }
private void FieldsCombo_SelectedIndexChanged(object sender, EventArgs e) { if (FieldsCombo.SelectedItem == null) { return; } TemplateTag tag = (TemplateTag)FieldsCombo.SelectedItem; if (tag.FieldType == ProfileFieldType.Text) { LinkBrowse.Enabled = false; ValueTextBox.ReadOnly = false; } else { LinkBrowse.Enabled = true; ValueTextBox.ReadOnly = true; } // set value text if (tag.FieldType == ProfileFieldType.Text) { string fieldName = tag.Name; if (fieldName == "MOTD") { fieldName = "MOTD-" + MainView.GetProjectID().ToString(); } if (TextFields.ContainsKey(fieldName)) { ValueTextBox.Text = TextFields[fieldName]; } else { ValueTextBox.Text = ""; } } else if (tag.FieldType == ProfileFieldType.File && FileFields.ContainsKey(tag.Name)) { ValueTextBox.Text = FileFields[tag.Name]; } else { ValueTextBox.Text = "Click Browse to select a file"; } ValueTextBox_TextChanged(null, null); }
private void LinkBrowse_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (FieldsCombo.SelectedItem == null) { return; } TemplateTag tag = (TemplateTag)FieldsCombo.SelectedItem; OpenFileDialog open = new OpenFileDialog(); open.Multiselect = true; open.Title = "Browse for File"; open.Filter = "All files (*.*)|*.*"; if (open.ShowDialog() == DialogResult.OK) { ValueTextBox.Text = open.FileName; FileFields[tag.Name] = open.FileName; } }