예제 #1
0
        private void OpenFile(DevComponents.AdvTree.Node pNode)
        {
            string filepath = pNode.Name;

            if (File.Exists(filepath))
            {
                if (filepath.ToLower().EndsWith(".xls"))
                {
                    SysCommon.ModPublicFun.OpenExcelFile(filepath);
                }
                if (filepath.ToLower().EndsWith(".mxd"))
                {
                    GeoPageLayout.FrmPageLayout fmPageLayout = new GeoPageLayout.FrmPageLayout(filepath);
                    fmPageLayout.WriteLog = WriteLog;//ygc 2012-9-12 是否写日志
                    fmPageLayout.ShowDialog();
                }
            }
            else
            {
                if (Directory.Exists(filepath))
                {
                    System.Diagnostics.Process.Start("explorer.exe", filepath);
                }
            }
        }
예제 #2
0
        public override void OnClick()
        {
            if (_hook.ResultsTree == null)
            {
                return;
            }
            TreeNode selectNode = _hook.ResultsTree.SelectedNode;

            if (selectNode != null)
            {
                string strPath = (selectNode.Tag as Dictionary <string, string>)["Path"].ToString().Trim();
                if (File.Exists(strPath))
                {
                    //当打开的成果为mxd时,打开方式不同
                    if (Path.GetExtension(strPath) != ".mxd")
                    {
                        try
                        {
                            System.Diagnostics.Process.Start(strPath);
                        }
                        catch
                        {
                            MessageBox.Show("请安装该类型成果文件相关的软件", "提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                    else
                    {
                        IMapDocument pMapDoc = new MapDocumentClass();
                        pMapDoc.Open(strPath, "");
                        GeoPageLayout.FrmPageLayout pFrmPageLayout = new GeoPageLayout.FrmPageLayout(pMapDoc.PageLayout);
                        pFrmPageLayout.WriteLog = WriteLog;//ygc 2012-9-12 是否写日志
                        pFrmPageLayout.ShowDialog();
                    }
                }
                else
                {
                    MessageBox.Show(Path.GetFileName(strPath) + "成果文件已被删除", "提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }