private void btn_configure_Click(object sender, EventArgs e) { Configure confDlg = new Configure(); Cursor.Current = Cursors.WaitCursor; try { cbox_extensionSelector_SelectedIndexChanged(null, null); confDlg.AddControl(control); control.Size = confDlg.Size; // Simulate serialization by SIEE and by OCC confDlg.Settings = (SIEESettings)SIEESerializer.Clone(settings); string xmlString = Serializer.SerializeToXmlString(settings, System.Text.Encoding.Unicode); if (Properties.Settings.Default.ConfigSize.Width != 0) { confDlg.Size = Properties.Settings.Default.ConfigSize; } if (confDlg.MyShowDialog() == DialogResult.OK) { settings = confDlg.Settings; try { schema = settings.CreateSchema(); schema.MakeFieldnamesOCCCompliant(); verifySchema(schema); lbl_message.Text = "Settings and schema"; lbl_location.Text = description.GetLocation(settings); richTextBox_settings.Text = settings.ToString() + Environment.NewLine + "---------------" + Environment.NewLine + schema.ToString(data: false) + Environment.NewLine + "---------------" + Environment.NewLine + "Location = " + description.GetLocation(settings); btn_export.Enabled = false; btn_capture.Enabled = true; lbl_status.Text = "Configuration ready"; } catch (Exception e1) { MessageBox.Show("Error loading configuration\n" + e1.Message); } Properties.Settings.Default.ConfigSize = confDlg.Size; saveCurrentSettings(); } } finally { Cursor.Current = Cursors.Default; } }
public void t08_SIEESerializer() { // Create fieldlist SIEEFieldlist fieldlist = new SIEEFieldlist(); fieldlist.Add(new SIEEField { Name = "Field_1", ExternalId = "Ext_1" }); fieldlist.Add(new SIEEField { Name = "Field_2", ExternalId = "Ext_2" }); SIEETableField tf = new SIEETableField { Name = "Table", ExternalId = "Ext_Table" }; tf.Columns.Add(new SIEEField { Name = "TabField_1", ExternalId = "TabExt_1" }); tf.Columns.Add(new SIEEField { Name = "TabField_2", ExternalId = "TabExt_2" }); fieldlist.Add(tf); // Serialize string s1 = SIEESerializer.ObjectToString(fieldlist); // Deserialize SIEEFieldlist f1 = (SIEEFieldlist)SIEESerializer.StringToObject(s1); // Serialize the newly created field list string s2 = SIEESerializer.ObjectToString(f1); // final compare string txt1 = fieldlist.ToString(data: false); string txt2 = f1.ToString(data: false); Assert.AreEqual(s1, s2); }