public EditorHost(string cml, string type) { InitializeComponent(); _editorType = type; AcmeOptions acmeOptions = new AcmeOptions(null); var used1D = SimulateGetUsed1DLabels(cml); MessageFromWpf.Text = ""; SystemHelper helper = new SystemHelper(); var telemetry = new TelemetryWriter(true, helper); switch (_editorType) { case "ACME": Editor acmeEditor = new Editor(); acmeEditor.EditorOptions = acmeOptions; acmeEditor.InitializeComponent(); elementHost1.Child = acmeEditor; // Configure Control acmeEditor.ShowFeedback = false; acmeEditor.TopLeft = new Point(Left, Top); acmeEditor.Telemetry = telemetry; acmeEditor.SetProperties(cml, used1D, acmeOptions); acmeEditor.OnFeedbackChange += AcmeEditorOnFeedbackChange; break; case "LABELS": LabelsEditor labelsEditor = new LabelsEditor(acmeOptions); labelsEditor.InitializeComponent(); elementHost1.Child = labelsEditor; // Configure Control labelsEditor.TopLeft = new Point(Left, Top); labelsEditor.Used1D = used1D; labelsEditor.PopulateTreeView(cml); break; default: CmlEditor cmlEditor = new CmlEditor(); cmlEditor.InitializeComponent(); elementHost1.Child = cmlEditor; // Configure Control cmlEditor.Cml = cml; break; } }
public EditorHost(string cml, string type) { InitializeComponent(); _editorType = type; var appdata = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var settingsPath = Path.Combine(appdata, "Chem4Word.V3"); var used1D = SimulateGetUsed1DLabels(cml); MessageFromWpf.Text = ""; switch (_editorType) { case "ACME": Options options = new Options(); options.SettingsFile = Path.Combine(settingsPath, "Chem4Word.Editor.ACME.json"); Editor acmeEditor = new Editor(); acmeEditor.InitializeComponent(); elementHost1.Child = acmeEditor; // Configure Control acmeEditor.ShowFeedback = false; SystemHelper helper = new SystemHelper(); acmeEditor.Telemetry = new TelemetryWriter(true, helper); acmeEditor.SetProperties(cml, used1D, options); acmeEditor.OnFeedbackChange += AcmeEditorOnFeedbackChange; break; case "LABELS": LabelsEditor labelsEditor = new LabelsEditor(); labelsEditor.InitializeComponent(); elementHost1.Child = labelsEditor; // Configure Control labelsEditor.Used1D = used1D; labelsEditor.PopulateTreeView(cml); break; default: CmlEditor cmlEditor = new CmlEditor(); cmlEditor.InitializeComponent(); elementHost1.Child = cmlEditor; // Configure Control cmlEditor.Cml = cml; break; } }