public RevertForm(string file, DraftTableForm mainForm)
        {
            InitializeComponent();

            this.file = file;

            string filename = System.IO.Path.GetFileName(file);

            string path = Path.GetDirectoryName(file);

            string backupPath = Path.Combine(path, "Backup");

            var files = Directory.GetFiles(backupPath, "*.dt", SearchOption.TopDirectoryOnly);

            foreach (var f in files)
            {
                if (FileUtils.BackupMatchesFilename(f, filename))
                {
                    table.Add(new RevertTableItem(filename, file, f));
                }
            }

            table.Sort((x, y) => x.date.CompareTo(y.date));

            this.mainForm = mainForm;

            this.listBox1.DataSource = table;
        }
Exemple #2
0
        public ThumbnailPanel()
        {
            InitializeComponent();

            this.AutoScroll     = true;
            this.AllowDrop      = true;
            this.DoubleBuffered = true;

            // List of Image
            ImageList = new List <Image>();
            FileList  = new List <string>();

            // Set DragDrop Event
            this.DragDrop  += new DragEventHandler(ThumbnailViewerControl_DragDrop);
            this.DragEnter += new DragEventHandler(ThumbnailViewerControl_DragEnter);

            folderMode = false;
            fileMode   = true;
            parentForm = null;
        }
Exemple #3
0
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            if (draftTableForm != null && !draftTableForm.IsDisposed)
            {
                if (!draftTableForm.Visible)
                {
                    draftTableForm.Show();
                }

                Restore(draftTableForm);

                return(Result.Success);
            }

            draftTableForm = new DraftTableForm();

            draftTableForm.Show();

            draftTableForm.LoadFolder("");
            draftTableForm.LoadDraftTableFoldersThumbnails();

            return(Result.Success);
        }
Exemple #4
0
        public Thumbnail(Image image, String filename, bool import, string backupFile, DraftTableForm mainForm)
        {
            InitializeComponent();


            bool cadMode = FileUtils.CadExtensions.Contains(Path.GetExtension(filename).ToUpperInvariant());

            Replace.Visible = cadMode;

            this.pictureBox1.Image  = image;
            this.pictureBox1.Paint += thumbnail_paint;

            this.filename = filename;

            string fileExt = Path.GetExtension(filename).Substring(1);

            if (fileExt == null)
            {
                fileExt = "";
            }

            if (Path.GetFileNameWithoutExtension(filename).StartsWith("file") && fileExt == ".3dm")
            {
                pictureBox1.BackColor = Color.ForestGreen;
                labelKey.Text         = "Key";
            }
            else if (Path.GetFileNameWithoutExtension(filename).StartsWith("part") && fileExt == ".3dm")
            {
                pictureBox1.BackColor = Color.Purple;
                labelKey.Text         = "Part";
            }
            else if (fileExt.CompareTo(".gh") == 0)
            {
                pictureBox1.BackColor = Color.GreenYellow;
                labelKey.Text         = "GH";
            }
            else if (fileExt.CompareTo(".py") == 0)
            {
                pictureBox1.BackColor = Color.Purple;
                labelKey.Text         = "PY";
            }
            else if (fileExt.CompareTo(".rvb") == 0)
            {
                pictureBox1.BackColor = Color.RosyBrown;
                labelKey.Text         = "RVB";
            }
            else if (fileExt.CompareTo(".txt") == 0)
            {
                pictureBox1.BackColor = Color.Tomato;
                labelKey.Text         = "TXT";
            }
            else if (fileExt.CompareTo(".3dm") == 0)
            {
                pictureBox1.BackColor = Color.Black;
                labelKey.Text         = "3dm";
            }
            else
            {
                pictureBox1.BackColor = Color.Black;
                labelKey.Text         = fileExt;
            }

            this.import = import;

            if (!string.IsNullOrWhiteSpace(backupFile))
            {
                backupFiles.Add(backupFile);
            }
            else
            {
            }

            this.mainForm = mainForm;

            string ext = Path.GetExtension(filename).ToUpper();

            bool txtFile = (ext.CompareTo(".RVB") == 0 || ext.CompareTo(".PY") == 0 || ext.CompareTo(".TXT") == 0);

            ContextMenu cm = new ContextMenu();

            cm.MenuItems.Add(Path.GetFileNameWithoutExtension(filename));
            cm.MenuItems.Add("Delete", new EventHandler(menu_deleteClicked));
            cm.MenuItems.Add("Set Folder Icon", new EventHandler(menu_FolderIcon));
            cm.MenuItems.Add("Revert", new EventHandler(menu_revertClicked));
            cm.MenuItems.Add("Rename", new EventHandler(menu_renameClicked));

            if (txtFile)
            {
                cm.MenuItems.Add("Open In Notepad", new EventHandler(menu_openInNotepad));
                //cm.MenuItems.Add("Edit", new EventHandler(menu_Edit));
            }

            cm.MenuItems.Add("Backup", new EventHandler(menu_backupClicked));

            if (cadMode)
            {
                if (!import)
                {
                    cm.MenuItems.Add("Import", new EventHandler(menu_importClicked));
                }
                else
                {
                    cm.MenuItems.Add("Open", new EventHandler(menu_openClicked));
                }
            }

            pictureBox1.ContextMenu = cm;
        }