private void SaveLayout(BizMainLayout bizWindow, string designKey, string layoutFmt)
        {
            //if (listView1.SelectedItems.Count <= 0)
            //{
            //    MessageBox.Show("未选择需要进行设计的窗体,不能保存布局配置。", "提示");
            //    return;
            //}

            ListViewItem[] lvis = listView1.Items.Find(designKey, false);
            if (lvis.Length <= 0)
            {
                MessageBox.Show("未选择需要进行设计的窗体,不能保存布局配置。", "提示");
                return;
            }

            WindowInfoData windowInfo = (lvis[0].Tag as WindowInfoData);

            if (windowInfo == null)
            {
                MessageBox.Show("窗体信息无效,不能保存布局配置。", "提示");
                return;
            }

            windowInfo.版本          = windowInfo.版本 + 1;
            windowInfo.窗体信息.布局配置   = layoutFmt;
            windowInfo.窗体信息.最后更新日期 = DateTime.Now;

            _rwm.UpdateWindowInfo(windowInfo);

            lvis[0].SubItems[2].Text = windowInfo.版本.ToString();
            lvis[0].SubItems[3].Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm");
        }
        private void ReadLayout(BizMainLayout bizWindow, ref string designKey, out string layoutFmt)
        {
            layoutFmt = "";

            //if (listView1.SelectedItems.Count <= 0)
            //{
            //    MessageBox.Show("未选择需要进行设计的窗体,不能读取布局配置。", "提示");
            //    return;
            //}

            ListViewItem[] lvis = listView1.Items.Find(designKey, false);
            if (lvis.Length <= 0)
            {
                MessageBox.Show("未选择需要进行设计的窗体,不能读取布局配置。", "提示");
                return;
            }

            WindowInfoData windowInfo = (lvis[0].Tag as WindowInfoData);

            if (windowInfo == null)
            {
                MessageBox.Show("窗体信息无效,不能读取布局配置。", "提示");
                return;
            }

            layoutFmt = windowInfo.窗体信息.布局配置;
        }
Exemple #3
0
        static private void StartWindow()
        {
            SplashScreenManager.ShowForm(typeof(frmSplash));
            SplashScreenManager.Default.SetWaitFormDescription("开始加载程序集文件...");

            LoadAssembaly();

            //SplashScreenManager.Default.SetWaitFormDescription("加载登录模块...");

            //SplashScreenManager.ShowForm(typeof(frmSplash));
            SplashScreenManager.Default.SetWaitFormDescription("创建主窗口程序...");

            BizMainLayout AppMain = new BizMainLayout(false);

            AppMain.OnStateSync        += StateSync;
            AppMain.OnReadWindowLayout += ReadLayout;

            SplashScreenManager.Default.SetWaitFormDescription("初始化主窗口程序...");
            AppMain.Init(_dbHelper, _loginUser, _stationInfo, null);

            SplashScreenManager.Default.SetWaitFormDescription("预加载主窗口程序...");
            AppMain.BeforeLoadAssembly();


            Application.Run(AppMain);
        }
Exemple #4
0
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            BizMainLayout bizMain = context.Instance as BizMainLayout;

            if (bizMain == null)
            {
                return(null);
            }

            List <string> names = null;

            bizMain.DoQueryParentWindowNamesEvent(out names);

            //绑定父窗体名称
            //string[] binds = new string[names.Count];
            //for (int i = 0; i < names.Count; i++)
            //{
            //    if (names[i] == bizMain.DesignWindowName) continue;
            //    binds[i] = names[i];
            //}

            names.Remove(bizMain.DesignWindowName);
            names.Insert(0, "");

            StandardValuesCollection svc = new StandardValuesCollection(names);

            return(svc);
        }
Exemple #5
0
        protected void ShowManager(BizMainLayout bizMain, DesignControlInstances dynamicControls, IWin32Window owner)
        {
            _bizMain         = bizMain;
            _dynamicControls = dynamicControls;



            this.Show(owner);

            BindControlData();
        }
        public frmDesignParent()
        {
            InitializeComponent();

            _bml = new BizMainLayout(true);

            _bml.OnStateSync             += StateSync;
            _bml.OnSaveWindowLayout      += SaveLayout;
            _bml.OnReadWindowLayout      += ReadLayout;
            _bml.OnQueryParentWindowName += QueryLinkWindow;
            _bml.OnMdiWindowChange       += MdiWindowChange;
        }
Exemple #7
0
        static public void ShowControlManager(BizMainLayout bizMain, DesignControlInstances dynamicControls)
        {
            try
            {
                if (_controlManager == null)
                {
                    _controlManager = new frmControlManager();
                }

                if (_controlManager.IsHandleCreated == false)
                {
                    _controlManager = new frmControlManager();
                }

                _controlManager.ShowManager(bizMain, dynamicControls, bizMain);
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, bizMain);
            }
        }
Exemple #8
0
        //static private void LoadAppTitle()
        //{
        //    try
        //    {
        //        Configuration ca = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
        //        bool hasKey = ca.AppSettings.Settings.AllKeys.Contains("apptitle");

        //        if (hasKey)
        //        {
        //            _appTitle = ca.AppSettings.Settings["apptitle"].Value;
        //        }
        //    }
        //    catch { }
        //}


        static private void ReadLayout(BizMainLayout bizWindow, ref string designKey, out string layoutFmt)
        {
            layoutFmt = "";

            if (_loginUser == null || _dbHelper == null)
            {
                return;
            }

            RoleWindowModel rwm = new RoleWindowModel(_dbHelper);

            WindowInfoData windowInfo = rwm.GetRoleMainWindowInfo(_loginUser.RoleId);

            if (windowInfo == null)
            {
                MessageBox.Show("窗体配置信息读取失败。", "提示");
                return;
            }

            designKey      = windowInfo.窗体ID;
            bizWindow.Name = "Win_" + windowInfo.窗体ID;
            layoutFmt      = windowInfo.窗体信息.布局配置;
        }
        private void OpenWindowDesign(string designKey, bool isMdiStyle)
        {
            ListViewItem[] lvis = listView1.Items.Find(designKey, false);
            if (lvis.Length <= 0)
            {
                MessageBox.Show("未选择需要进行设计的窗体,不能读取布局配置。", "提示");
                return;
            }

            WindowInfoData wid = (lvis[0].Tag as WindowInfoData);

            if (wid == null)
            {
                MessageBox.Show("窗体信息无效,不能读取布局配置。", "提示");
                return;
            }

            StationInfo stationInfo = new StationInfo();

            stationInfo.DBServerName   = (this.Parent.TopLevelControl as frmMainConfig).ServerName;
            stationInfo.DepartmentId   = cbxDepartment.SelectedValue.ToString();
            stationInfo.DepartmentName = cbxDepartment.Text;

            if (isMdiStyle)
            {
                frmDesignParent bmlMdi = new frmDesignParent();


                bmlMdi.SetDesignText(wid.窗体ID, wid.窗体名称);

                //配置事件
                bmlMdi.OnSaveWindowLayout      += SaveLayout;
                bmlMdi.OnReadWindowLayout      += ReadLayout;
                bmlMdi.OnQueryParentWindowName += QueryLinkWindow;
                bmlMdi.OnMdiWindowChange       += MdiWindowChange;

                bmlMdi.Init(_dbHelper, _loginUser, stationInfo, null);

                bmlMdi.Show(this);
            }
            else
            {
                BizMainLayout bmlPopup = new BizMainLayout(true);

                bmlPopup.SetDesignText(wid.窗体ID, wid.窗体名称, null, null);

                //配置事件
                bmlPopup.OnStateSync             += StateSync;
                bmlPopup.OnSaveWindowLayout      += SaveLayout;
                bmlPopup.OnReadWindowLayout      += ReadLayout;
                bmlPopup.OnQueryParentWindowName += QueryLinkWindow;
                bmlPopup.OnMdiWindowChange       += MdiWindowChange;

                bmlPopup.Init(_dbHelper, _loginUser, stationInfo, null);


                bmlPopup.BeforeLoadAssembly();


                bmlPopup.Show(this);
            }
        }
 private void ReadLayout(BizMainLayout bizWindow, ref string designKey, out string layoutFmt)
 {
     layoutFmt = "";
     OnReadWindowLayout?.Invoke(bizWindow, ref designKey, out layoutFmt);
 }
 private void SaveLayout(BizMainLayout bizWindow, string designKey, string layoutFmt)
 {
     OnSaveWindowLayout?.Invoke(bizWindow, designKey, layoutFmt);
 }