Beispiel #1
0
        private void tsbSave_Click(object sender, EventArgs e)
        {
            string GetLayoutString(LayoutControl layout)
            {
                //删除隐藏的item,避免数据库中存储无效的item
                layout.HiddenItems.Clear();

                using (MemoryStream ms = new MemoryStream())
                    using (StreamReader sr = new StreamReader(ms))
                    {
                        layout.SaveLayoutToStream(ms);
                        ms.Position = 0;

                        return(sr.ReadToEnd());
                    }
            }

            List <ItemFormat> GetItemFormats(LayoutControl layout)
            {
                layout.HiddenItems.Clear();

                List <ItemFormat> result = new List <ItemFormat>();

                foreach (BaseLayoutItem bli in layout.Items)
                {
                    DesignLabel dl = bli as DesignLabel;
                    if (dl != null)
                    {
                        ItemFormat itemFmt = new ItemFormat();
                        itemFmt.ItemName = dl.Name;
                        itemFmt.Formats  = dl.Formats;

                        result.Add(itemFmt);
                    }
                }

                return(result);
            }

            try
            {
                if (_summaryDesign == null)
                {
                    _summaryDesign = new SummaryModuleDesign();
                }

                _summaryDesign.DBSource      = GlobalDB.DBSource;
                _summaryDesign.LayoutFormats = GetLayoutString(layoutControl1);
                _summaryDesign.ItemFormats   = GetItemFormats(layoutControl1);

                this.Close();
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
Beispiel #2
0
        public void ShowDesign(SummaryModuleDesign summaryDesign, IDBQuery dbHelper, IWin32Window owner)
        {
            _summaryDesign = summaryDesign;
            _dbHelper      = dbHelper;

            GlobalDB.DBSource = _summaryDesign.DBSource;
            GlobalDB.DBHelper = _dbHelper;

            this.ShowDialog(owner);
        }
Beispiel #3
0
        //private InfoConfig _ic = null;
        public SummaryControl()
        {
            InitializeComponent();

            InitLayoutControl();

            _summaryDesign = new SummaryModuleDesign();

            //_ic = new InfoConfig();

            //_ic.ZoomFactor = 1;
        }
Beispiel #4
0
        protected override void ReloadCustomDesign(string customContext)
        {
            if (string.IsNullOrEmpty(customContext))
            {
                return;
            }

            _summaryDesign = JsonHelper.DeserializeObject <SummaryModuleDesign>(customContext);

            if (_summaryDesign != null)
            {
                LayoutControlEx.SetLayoutString(layoutControl1, _summaryDesign.LayoutFormats);

                FillFormats(_summaryDesign.ItemFormats);

                if (this.DesignMode == false)
                {
                    _curBizData = new BizDataItem();

                    ReloadData();
                }
            }
        }