Пример #1
0
        private void SelectRecordTemplateDlg_Load(object sender, System.EventArgs e)
        {
            if (ap != null)
            {
                if (ApCfgTitle != "" && ApCfgTitle != null)
                {
                    ap.LoadFormStates(this,
                                      ApCfgTitle);
                }
                else
                {
                    Debug.Assert(true, "若要用ap保存和恢复窗口外观状态,必须先设置ApCfgTitle成员");
                }
            }

            if (dom != null)
            {
                FillList(true);
            }
            else
            {
                Debug.Assert(true, "你一定忘记了先用Initial()");
            }

            //if (this.SaveMode == false)
            //    this.checkBox_notAsk.Enabled = true;

            if (this.AutoClose == true)
            {
                API.PostMessage(this.Handle, WM_AUTO_CLOSE, 0, 0);
            }
        }
Пример #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // LoadSettings();

            this.UserDir = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
                "eloamPicture_v1");
            PathUtil.CreateDirIfNeed(this.UserDir);

            this.OutputDir = Path.Combine(this.UserDir, "pic");
            PathUtil.CreateDirIfNeed(this.OutputDir);
            this.pictureSavePath.Text = this.OutputDir;

            this.AppInfo = new ApplicationInfo(Path.Combine(this.UserDir, "eloamPicture.xml"));

            AppInfo.LoadFormStates(this,
                                   "mainformstate",
                                   FormWindowState.Maximized);

            this.BeginInvoke(new Action <object, EventArgs>(toolStripButton_preview_start_Click), this, new EventArgs());
        }
Пример #3
0
        private void SelectRecordTemplateDlg_Load(object sender, System.EventArgs e)
        {
            if (ap != null)
            {
                if (ApCfgTitle != "" && ApCfgTitle != null)
                {
                    ap.LoadFormStates(this,
                                      ApCfgTitle);
                }
                else
                {
                    Debug.Assert(true, "若要用ap保存和恢复窗口外观状态,必须先设置ApCfgTitle成员");
                }
            }

            if (dom != null)
            {
                FillList(true);
            }
            else
            {
                Debug.Assert(true, "你一定忘记了先用Initial()");
            }
        }
Пример #4
0
        private void MainFormNew_Load(object sender, EventArgs e)
        {
            Searching(false);   // 隐藏searching ToolStripLabel

            if (ApplicationDeployment.IsNetworkDeployed == true)
            {
                // MessageBox.Show(this, "network");
                DataDir = Application.LocalUserAppDataPath;
            }
            else
            {
                // MessageBox.Show(this, "no network");
                DataDir = Environment.CurrentDirectory;
            }


            this.SetMenuItemState();                 //任延华加 2006/1/5
            this.toolBarButton_stop.Enabled = false; //任延华加 2006/1/5


            // 从文件中装载创建一个ServerCollection对象
            // parameters:
            //		bIgnorFileNotFound	是否不抛出FileNotFoundException异常。
            //							如果==true,函数直接返回一个新的空ServerCollection对象
            // Exception:
            //			FileNotFoundException	文件没找到
            //			SerializationException	版本迁移时容易出现
            try
            {
                Servers = ServerCollection.Load(this.DataDir
                                                + "\\servers.bin",
                                                true);
                Servers.ownerForm = this;
            }
            catch (SerializationException ex)
            {
                MessageBox.Show(this, ex.Message);
                Servers = new ServerCollection();
                // 设置文件名,以便本次运行结束时覆盖旧文件
                Servers.FileName = this.DataDir
                                   + "\\servers.bin";
            }

            this.Servers.ServerChanged += new ServerChangedEventHandle(Servers_ServerChanged);

            string strError = "";
            int    nRet     = cfgCache.Load(this.DataDir
                                            + "\\cfgcache.xml",
                                            out strError);

            if (nRet == -1)
            {
                if (IsFirstRun == false)
                {
                    MessageBox.Show(strError + "\r\n\r\n程序稍后会尝试自动创建这个文件");
                }
            }


            cfgCache.TempDir = this.DataDir
                               + "\\cfgcache";
            cfgCache.InstantSave = true;


            // 设置窗口尺寸状态
            if (AppInfo != null)
            {
                SetFirstDefaultFont();

                MainForm.SetControlFont(this, this.DefaultFont);

                AppInfo.LoadFormStates(this,
                                       "mainformstate");
            }


            stopManager.Initial(toolBarButton_stop,
                                (object)this.toolStripStatusLabel_main,
                                (object)this.toolStripProgressBar_main);

            // 存在上次遗留的窗口
            int nLastSearchWindow = this.AppInfo.GetInt(
                "main_form",
                "last_search_window",
                1);

            if (nLastSearchWindow == 1)
            {
                MenuItem_openSearch_Click(null, null);  // 打开一个检索窗
            }

            if (IsFirstRun == true && this.Servers.Count == 0)
            {
                MessageBox.Show(this, "欢迎您安装使用dp2rms -- 资源管理。");
                ManageServers(true);
                ManagePreference();
            }
        }
Пример #5
0
        private void OpenResDlg_Load(object sender, System.EventArgs e)
        {
            if (ap != null)
            {
                if (ApCfgTitle != "" && ApCfgTitle != null)
                {
                    ap.LoadFormStates(this,
                                      ApCfgTitle);
                }
                else
                {
                    Debug.Assert(true, "若要用ap保存和恢复窗口外观状态,必须先设置ApCfgTitle成员");
                }
            }

            if (this.resTree.Servers != null)
            {
                this.resTree.Servers.ServerChanged += new ServerChangedEventHandle(Servers_ServerChanged);
            }
            // resTree.EnabledIndices = new int[] { ResTree.RESTYPE_DB };

            // 填充内容
            resTree.Fill(null);

            if (MultiSelect == true)
            {
                resTree.CheckBoxes = true;                      // 允许复选
            }

            if (this.Path != "")
            {
                ResPath respath = new ResPath(this.Path);

                // 展开到指定的节点
                if (resTree.ExpandPath(respath) == true &&
                    resTree.SelectedNode != null &&
                    EnabledIndices != null)
                {
                    // 2013/2/15
                    // 如果下一级是全部灰色的节点,则不要展开它们
                    bool bFound = false;
                    foreach (TreeNode child in resTree.SelectedNode.Nodes)
                    {
                        if (StringUtil.IsInList(child.ImageIndex, EnabledIndices) == true)
                        {
                            bFound = true;
                        }
                    }

                    if (bFound == false)
                    {
                        resTree.SelectedNode.Collapse();
                    }
                }
            }



            if (this.Paths != "")
            {
                resTree.CheckBoxes = true;                      // 允许复选

                string[] aPath = this.Paths.Split(new char[] { ';' });

                for (int i = 0; i < aPath.Length; i++)
                {
                    if (aPath[i].Trim() == "")
                    {
                        continue;
                    }

                    ResPath respath = new ResPath(aPath[i].Trim());

                    // 展开到指定的节点
                    resTree.ExpandPath(respath);

                    bool bRet = this.resTree.CheckNode(respath,
                                                       true);
                }
            }
        }
Пример #6
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            if (ApplicationDeployment.IsNetworkDeployed == true)
            {
                // MessageBox.Show(this, "network");
                DataDir = Application.LocalUserAppDataPath;
            }
            else
            {
                // MessageBox.Show(this, "no network");
                DataDir = Environment.CurrentDirectory;
            }

            // 从文件中装载创建一个ServerCollection对象
            // parameters:
            //		bIgnorFileNotFound	是否不抛出FileNotFoundException异常。
            //							如果==true,函数直接返回一个新的空ServerCollection对象
            // Exception:
            //			FileNotFoundException	文件没找到
            //			SerializationException	版本迁移时容易出现

            try
            {
                Servers = ServerCollection.Load(this.DataDir
                                                + "\\manager_servers.bin",
                                                true);
                Servers.ownerForm = this;
            }
            catch (SerializationException ex)
            {
                MessageBox.Show(this, ex.Message);
                Servers = new ServerCollection();
                // 设置文件名,以便本次运行结束时覆盖旧文件
                Servers.FileName = this.DataDir
                                   + "\\manager_servers.bin";
            }

            this.Servers.ServerChanged += new ServerChangedEventHandle(Servers_ServerChanged);

            // 从文件中装载创建一个LinkInfoCollection对象
            // parameters:
            //		bIgnorFileNotFound	是否不抛出FileNotFoundException异常。
            //							如果==true,函数直接返回一个新的空ServerCollection对象
            // Exception:
            //			FileNotFoundException	文件没找到
            //			SerializationException	版本迁移时容易出现
            try
            {
                LinkInfos = LinkInfoCollection.Load(this.DataDir
                                                    + "\\manager_linkinfos.bin",
                                                    true);
            }
            catch (SerializationException ex)
            {
                MessageBox.Show(this, ex.Message);
                LinkInfos = new LinkInfoCollection();
                // 设置文件名,以便本次运行结束时覆盖旧文件
                LinkInfos.FileName = this.DataDir
                                     + "\\manager_linkinfos.bin";
            }



            // 设置窗口尺寸状态
            if (AppInfo != null)
            {
                SetFirstDefaultFont();

                MainForm.SetControlFont(this, this.DefaultFont);

                AppInfo.LoadFormStates(this,
                                       "mainformstate");
            }

            stopManager.Initial(toolBarButton_stop,
                                this.toolStripStatusLabel_main,
                                this.toolStripProgressBar_main);
            stop = new DigitalPlatform.Stop();
            stop.Register(this.stopManager, true);              // 和容器关联

            /*
             *          this.Channels.procAskAccountInfo =
             *                  new Delegate_AskAccountInfo(this.Servers.AskAccountInfo);
             */
            this.Channels.AskAccountInfo += new AskAccountInfoEventHandle(this.Servers.OnAskAccountInfo);



            // 简单检索界面准备工作
            treeView_res.AppInfo = this.AppInfo;                // 便于treeview中popup菜单修改配置文件时保存dialog尺寸位置

            treeView_res.stopManager = this.stopManager;

            treeView_res.Servers = this.Servers;                // 引用

            treeView_res.Channels = this.Channels;              // 引用

            treeView_res.Fill(null);

            //
            LinkInfos.Channels = this.Channels;

            int    nRet     = 0;
            string strError = "";

            nRet = this.LinkInfos.Link(out strError);
            if (nRet == -1)
            {
                MessageBox.Show(this, strError);
            }
        }