/// <summary> /// Constructor /// </summary> public CannedTextEditorComponentControl(CannedTextEditorComponent component) : base(component) { InitializeComponent(); _component = component; _groups.Enabled = !_component.IsReadOnly; _category.Enabled = !_component.IsReadOnly; _name.ReadOnly = _component.IsReadOnly; _text.ReadOnly = _component.IsReadOnly; _typeGroupBox.Enabled = !_component.IsReadOnly && _component.CanChangeType; _radioGroup.Checked = _component.IsEditingGroup; _radioPersonal.DataBindings.Add("Checked", _component, "IsEditingPersonal", true, DataSourceUpdateMode.OnPropertyChanged); _groups.DataSource = _component.StaffGroupChoices; _groups.Format += delegate(object sender, ListControlConvertEventArgs args) { args.Value = _component.FormatStaffGroup(args.ListItem); }; _groups.DataBindings.Add("Visible", _component, "IsEditingGroup", true, DataSourceUpdateMode.OnPropertyChanged); _groups.DataBindings.Add("Value", _component, "StaffGroup", true, DataSourceUpdateMode.OnPropertyChanged); _category.DataSource = _component.CategoryChoices; _name.DataBindings.Add("Value", _component, "Name", true, DataSourceUpdateMode.OnPropertyChanged); _category.DataBindings.Add("Text", _component, "Category", true, DataSourceUpdateMode.OnPropertyChanged); _text.DataBindings.Add("Value", _component, "Text", true, DataSourceUpdateMode.OnPropertyChanged); _acceptButton.DataBindings.Add("Enabled", _component, "AcceptEnabled", true, DataSourceUpdateMode.OnPropertyChanged); }
/// <summary> /// Constructor /// </summary> public CannedTextEditorComponentControl(CannedTextEditorComponent component) :base(component) { InitializeComponent(); _component = component; _groups.Enabled = !_component.IsReadOnly; _category.Enabled = !_component.IsReadOnly; _name.ReadOnly = _component.IsReadOnly; _text.ReadOnly = _component.IsReadOnly; _typeGroupBox.Enabled = !_component.IsReadOnly && _component.CanChangeType; _radioGroup.Checked = _component.IsEditingGroup; _radioPersonal.DataBindings.Add("Checked", _component, "IsEditingPersonal", true, DataSourceUpdateMode.OnPropertyChanged); _groups.DataSource = _component.StaffGroupChoices; _groups.Format += delegate(object sender, ListControlConvertEventArgs args) { args.Value = _component.FormatStaffGroup(args.ListItem); }; _groups.DataBindings.Add("Visible", _component, "IsEditingGroup", true, DataSourceUpdateMode.OnPropertyChanged); _groups.DataBindings.Add("Value", _component, "StaffGroup", true, DataSourceUpdateMode.OnPropertyChanged); _category.DataSource = _component.CategoryChoices; _name.DataBindings.Add("Value", _component, "Name", true, DataSourceUpdateMode.OnPropertyChanged); _category.DataBindings.Add("Text", _component, "Category", true, DataSourceUpdateMode.OnPropertyChanged); _text.DataBindings.Add("Value", _component, "Text", true, DataSourceUpdateMode.OnPropertyChanged); _acceptButton.DataBindings.Add("Enabled", _component, "AcceptEnabled", true, DataSourceUpdateMode.OnPropertyChanged); }
public void SetComponent(IApplicationComponent component) { _component = (CannedTextEditorComponent)component; }