protected virtual MASMFormattingEditor CreateLogDataEditor() { MASMFormattingEditor editor = new MASMFormattingEditor { Text = "Serial Port Data Editor", }; editor.AvailableProperties = () => { return(new List <string>(new MASM().UpdateOnce().GetPropertiesList())); }; editor.Items.AddRange(this.Server.Settings.DataFormatter.FormattingItems); InputField globalPrefixField = new InputField { Text = this.Server.Settings.DataFormatter.GlobalPrefix }; InputField globalPostfixField = new InputField { Text = this.Server.Settings.DataFormatter.GlobalPostfix }; InputField decimalSeparatorField = new InputField { Text = this.Server.Settings.DataFormatter.DecimalSeparator }; Dropdown encodingField = new Dropdown { }; encodingField.FromEnum(this.Server.Settings.Encoding); InputField endOfLineCharField = new InputField { Text = this.Server.Settings.EndOfLineChar }; PropertyContainer globalPrefixProperty = new PropertyContainer { Text = "Global Prefix" }; PropertyContainer globalPostfixProperty = new PropertyContainer { Text = "Global Postfix" }; PropertyContainer decimalSeparatorProperty = new PropertyContainer { Text = "Decimal Separator" }; PropertyContainer encodingProperty = new PropertyContainer { Text = "Encoding" }; PropertyContainer endOfLineCharProperty = new PropertyContainer { Text = "End Of Line Character" }; globalPrefixProperty.Controls.Add(globalPrefixField); globalPostfixProperty.Controls.Add(globalPostfixField); decimalSeparatorProperty.Controls.Add(decimalSeparatorField); encodingProperty.Controls.Add(encodingField); endOfLineCharProperty.Controls.Add(endOfLineCharField); editor.AdditionalProperties.Add(globalPrefixProperty); editor.AdditionalProperties.Add(globalPostfixProperty); editor.AdditionalProperties.Add(decimalSeparatorProperty); editor.AdditionalProperties.Add(encodingProperty); editor.AdditionalProperties.Add(endOfLineCharProperty); editor.Apply += (object sender, EventArgs e) => { if (editor.Items.Count != this.Server.Settings.DataFormatter.FormattingItems.Count) { this.Server.Settings.DataFormatter.FormattingItems.Clear(); this.Server.Settings.DataFormatter.FormattingItems.AddRange(editor.Items); } else { for (int i = 0; i < editor.Items.Count; i++) { this.Server.Settings.DataFormatter.FormattingItems[i] = editor.Items[i]; } } this.Server.Settings.DataFormatter.GlobalPrefix = globalPrefixField.Text; this.Server.Settings.DataFormatter.GlobalPostfix = globalPostfixField.Text; this.Server.Settings.DataFormatter.DecimalSeparator = decimalSeparatorField.Text; this.Server.Settings.Encoding = encodingField.ToEnum(SerialPortEncoding.UTF8); this.Server.Settings.EndOfLineChar = endOfLineCharField.Text; editor.Dispose(); }; editor.Cancel += (object sender, EventArgs e) => { editor.Dispose(); }; return(editor); }