Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnLoadGridInfos(object sender, System.EventArgs e)
        {
            XceedUtility.SetXceedLicense();

            Form form = new Form();

            form.AutoSize        = true;
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.Controls.Add(new FlowLayoutPanel());
            form.Controls[0].Controls.Add(new TextBox());
            form.Text = "Please input gridName";
            form.Controls[0].Controls.Add(new Button());
            (form.Controls[0].Controls[1] as Button).Text         = "Ok";
            (form.Controls[0].Controls[1] as Button).DialogResult = DialogResult.OK;
            if (form.ShowDialog() == DialogResult.OK)
            {
                string gridName = (form.Controls[0].Controls[0] as TextBox).Text;
                if (string.IsNullOrEmpty(gridName))
                {
                    MessageForm.ShowError("GridName should not be null!");
                    return;
                }

                IList <GridColumnInfo> gridColumnInfos = ADInfoBll.Instance.GetGridColumnInfos(gridName);
                int x = 0, y = 0;
                foreach (GridColumnInfo columnInfo in gridColumnInfos)
                {
                    try
                    {
                        IDesignerHost           h  = (IDesignerHost)GetService(typeof(IDesignerHost));
                        DesignerTransaction     dt = h.CreateTransaction("Add IDataControl");
                        IComponentChangeService c  = (IComponentChangeService)GetService(typeof(IComponentChangeService));

                        c.OnComponentChanging(m_parentForm, null);
                        Control control = AddDataControl(h, columnInfo);
                        control.Location = new System.Drawing.Point(x, y);
                        c.OnComponentChanged(m_parentForm, null, null, null);

                        dt.Commit();

                        x += 200;
                        if (x >= 800)
                        {
                            x  = 0;
                            y += 25;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageForm.ShowError(ex.Message);
                    }
                }
            }
            form.Dispose();
        }
Esempio n. 2
0
        /// <summary>
        /// 初始化程序(设置ServiceLocator,读取IDataBuffer)
        /// </summary>
        public static void InitProgram()
        {
            if (!m_init)
            {
                m_init = true;

                //if (Microsoft.Practices.ServiceLocation.ServiceLocator.Current == null) // throw null
                {
                    if (!SystemConfiguration.LiteMode)
                    {
                        SetSpringServiceLocator();
                    }
                    else
                    {
                        SetDefaultServiceLocator();
                    }
                }

                XceedUtility.SetXceedLicense();
            }
        }