Ejemplo n.º 1
0
        static public void OpenResult(ListView list)
        {
            string currentpath = pathes[0].Substring(0, pathes[0].LastIndexOf('\\') + 1);
            string path        = list.SelectedItems[0].Text;

            currentpath = currentpath + path;
            CommonFile commonFile = new CommonFile(currentpath);
            string     content;

            content = commonFile.GetText(new HtmlFile(currentpath));
            TextEditorForm HEdit = new TextEditorForm(content, currentpath, true);

            HEdit.ShowDialog();
        }
Ejemplo n.º 2
0
        public void OpenItem(ListView list, bool left)
        {
            string path = list.SelectedItems[0].Text;
            string currentPath;

            if (left)
            {
                currentPath = String.Format(@"{0}\\{1}", currentPath1, path);
            }
            else
            {
                currentPath = String.Format(@"{0}\\{1}", currentPath2, path);
            }
            if (list.SelectedItems[0].ImageIndex == 0)
            {
                try
                {
                    Refresh(list, currentPath);
                    if (left)
                    {
                        currentPath1 = currentPath;
                    }
                    else
                    {
                        currentPath2 = currentPath;
                    }
                }
                catch (IOException ex)
                {
                    Refresh(list, currentPath1);
                }
                catch (UnauthorizedAccessException ex)
                {
                    MessageBox.Show("You haven`t access", "Error");
                }
                director.OpenReport(currentPath);
                director.BuildReport();
                reports.Add(director.GetReportItem());
            }
            else
            {
                try
                {
                    CommonFile cf = new CommonFile(currentPath);
                    string     content;
                    if (currentPath.Substring(currentPath.LastIndexOf(".") + 1) == "txt")
                    {
                        content = cf.GetText(new TxtFile(currentPath));
                        TextEditorForm TEdit = new TextEditorForm(content, currentPath, false);
                        TEdit.ShowDialog();
                    }
                    else if (currentPath.Substring(currentPath.LastIndexOf(".") + 1) == "html")
                    {
                        content = cf.GetText(new HtmlFile(currentPath));
                        TextEditorForm HEdit = new TextEditorForm(content, currentPath, false);
                        HEdit.ShowDialog();
                    }
                    else
                    {
                        Process.Start(currentPath);
                    }
                    director.OpenReport(path);
                    director.BuildReport();
                    reports.Add(director.GetReportItem());
                }
                catch (InvalidOperationException ex)
                {
                    MessageBox.Show("You haven`t access", "Error");
                }
            }
        }