Пример #1
0
        private void menuItemModifyConfiguration_Click(object sender, System.EventArgs e)
        {
            System.ComponentModel.Design.CollectionEditor ce = new System.ComponentModel.Design.CollectionEditor(this.configurations.GetType());
            Syncfusion.ComponentModel.WindowsFormsEditorServiceContainer esc = new Syncfusion.ComponentModel.WindowsFormsEditorServiceContainer(null);
            PropertyDescriptor pd = TypeDescriptor.GetProperties(this)["Configurations"];

            Syncfusion.ComponentModel.TypeDescriptorContext tdc = new Syncfusion.ComponentModel.TypeDescriptorContext(this, pd);
            tdc.ServiceProvider = esc;

            ce.EditValue(tdc, esc, Configurations);
            InitializeSelectMenu();
        }
Пример #2
0
        /// <summary>
        /// Display the Grid Base Style dialog
        /// </summary>
        internal DialogResult _ShowGridBaseStylesDialog(object instance, string propertyName, IServiceProvider provider, Type type)
        {
            System.ComponentModel.Design.CollectionEditor ce = new System.ComponentModel.Design.CollectionEditor(type);
            Syncfusion.ComponentModel.WindowsFormsEditorServiceContainer esc = new Syncfusion.ComponentModel.WindowsFormsEditorServiceContainer(provider);
            PropertyDescriptor pd = TypeDescriptor.GetProperties(instance)[propertyName];

            Syncfusion.ComponentModel.TypeDescriptorContext tdc = new Syncfusion.ComponentModel.TypeDescriptorContext(instance, pd);
            tdc.ServiceProvider = esc;

            ce.EditValue(tdc, esc, pd.GetValue(instance));

            return(esc.DialogResult);
        }
Пример #3
0
        //used to edit the custom styles into the GridGroupingControl
        private void buttonAdv5_Click(object sender, EventArgs e)
        {
            System.ComponentModel.Design.CollectionEditor ce = new System.ComponentModel.Design.CollectionEditor(this.tableRecordFieldStyles.GetType());
            Syncfusion.ComponentModel.WindowsFormsEditorServiceContainer esc = new Syncfusion.ComponentModel.WindowsFormsEditorServiceContainer(null);
            PropertyDescriptor pd = TypeDescriptor.GetProperties(this)["TableRecordFieldStyles"];

            Syncfusion.ComponentModel.TypeDescriptorContext tdc = new Syncfusion.ComponentModel.TypeDescriptorContext(this, pd);
            tdc.ServiceProvider = esc;

            ce.EditValue(tdc, esc, tableRecordFieldStyles);

            this.gridGroupingControl1.Refresh();
        }
Пример #4
0
        private void comboBoxAdv1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxAdv1.SelectedItem == null)
            {
                return;
            }

            switch (comboBoxAdv1.SelectedItem.ToString())
            {
            case "Modify":
                System.ComponentModel.Design.CollectionEditor ce = new System.ComponentModel.Design.CollectionEditor(this.configurations.GetType());
                Syncfusion.ComponentModel.WindowsFormsEditorServiceContainer esc = new Syncfusion.ComponentModel.WindowsFormsEditorServiceContainer(null);
                PropertyDescriptor pd = TypeDescriptor.GetProperties(this)["Configurations"];
                Syncfusion.ComponentModel.TypeDescriptorContext tdc = new Syncfusion.ComponentModel.TypeDescriptorContext(this, pd);
                tdc.ServiceProvider = esc;

                ce.EditValue(tdc, esc, Configurations);
                InitializeSelectMenu();
                break;

            case "Save to":
                try
                {
                    FileDialog dlg = new SaveFileDialog();
                    dlg.DefaultExt = "xml";
                    dlg.Filter     = "Files(*.xml)|*.Xml";
                    dlg.FileName   = "Untitled";
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        XmlTextWriter xw = new XmlTextWriter(dlg.FileName, System.Text.Encoding.UTF8);
                        xw.Formatting = Formatting.Indented;
                        ConfigCollectionSerializer.Serialize(xw, configurations);
                        stream = new System.IO.MemoryStream();
                        this.gridGroupingControl1.WriteXmlSchema(new XmlTextWriter(stream, null));

                        xw.Close();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                break;

            case "Open":
                try
                {
                    FileDialog dlg = new OpenFileDialog();
                    dlg.DefaultExt = "xml";
                    dlg.Filter     = "Files(*.xml)|*.Xml";
                    dlg.FileName   = "Untitled";
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        XmlTextReader xr = new XmlTextReader(dlg.FileName);
                        this.configurations = (ConfigCollection)ConfigCollectionSerializer.Deserialize(xr);
                        if (stream != null)
                        {
                            System.IO.MemoryStream stream2 = new System.IO.MemoryStream(stream.ToArray());
                            this.gridGroupingControl1.ApplyXmlSchema(new XmlTextReader(stream2));
                        }
                        xr.Close();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                break;

            case "Exit":
                Application.Exit();
                break;
            }
        }