Пример #1
0
        public void Select(FileType type, string path)
        {
            CodeBox.Visible     = false;
            CodeBox.Enabled     = false;
            pictureBox1.Visible = false;
            pictureBox1.Enabled = false;
            panel1.Visible      = false;
            panel1.Enabled      = false;

            if (currentFileType == FileType.Text)
            {
                File.WriteAllText(currentFile, CodeBox.Text);
            }

            currentFile     = path;
            currentFileType = type;

            if (type == FileType.Text)
            {
                CodeBox.Visible = true;
                CodeBox.Enabled = true;
                try
                {
                    CodeBox.Text = File.ReadAllText(path);
                }
                catch
                {
                    CodeBox.Text    = "Unreadable Shit";
                    CodeBox.Enabled = false;
                }
                if (!Formatter.reformating)
                {
                    Formatter.reformat(CodeBox, this, false);
                }
            }
            if (type == FileType.Image)
            {
                pictureBox1.Visible = true;
                pictureBox1.Enabled = true;
                pictureBox1.Image   = Image.FromFile(path);
            }
            if (type == FileType.Directory)
            {
                panel1.Visible = true;
                panel1.Enabled = true;

                if (folderDisplay == null)
                {
                    folderDisplay = new FolderDisplay(panel1, FileMenu, DirectoryMenu, vScrollBar1, ImagePreview);
                }
                folderDisplay.LoadFolder(new Folder(path));
            }
        }
Пример #2
0
        public ItemDisplayer(IDragableOwner dragableOwner, FolderDisplay folderDisplay, FolderItem file,
                             ContextMenuStrip fileMenu, ContextMenuStrip directoryMenu, PictureBox preview)
        {
            SetPosition(0, 0);

            if (file is DriveFolder)
            {
                SetSize(256, 96);
            }
            else
            {
                SetSize(64, 96);
            }

            SetOwner(dragableOwner);

            this.folderDisplay = folderDisplay;
            this.file          = file;
            this.fileMenu      = fileMenu;
            this.preview       = preview;
            this.directoryMenu = directoryMenu;
        }