Ejemplo n.º 1
0
        private void EditLabelsHost_Load(object sender, EventArgs e)
        {
            string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()";

            try
            {
                MinimumSize = new Size(900, 600);

                Left = (int)TopLeft.X;
                Top  = (int)TopLeft.Y;

                // Fix bottom panel
                int margin = Buttons.Height - Save.Bottom;
                splitContainer1.SplitterDistance = splitContainer1.Height - Save.Height - margin * 2;
                splitContainer1.FixedPanel       = FixedPanel.Panel2;
                splitContainer1.IsSplitterFixed  = true;

                var editor = new LabelsEditor(_options);
                editor.InitializeComponent();
                elementHost1.Child = editor;

                editor.TopLeft = TopLeft;
                editor.Used1D  = Used1D;
                editor.PopulateTreeView(Cml);

                Warning.Text = Message;
            }
            catch (Exception ex)
            {
                using (var form = new ReportError(Globals.Chem4WordV3.Telemetry, TopLeft, module, ex))
                {
                    form.ShowDialog();
                }
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        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;
            }
        }