Example #1
0
        void upload()
        {
            //first check if already uploaded
            if (starred.Count == 0)
            {
                if (imgFiles[curFile].uploadedURL != null)
                {
                    Process.Start(imgFiles[curFile].uploadedURL);
                    return;
                }
            }

            if (!uploadForm.Visible)
            {
                uploadForm = new Upload();
                uploadForm.returnLinks = returnLinks;

                //create copies of the files (because the originals may be in use by Tesserax which disables FileStream)
                purgeTempDir();

                if (starred.Count > 0)
                    foreach (string starredImg in starred)
                        copyToTempDir(dir + "\\" + starredImg);
                else
                    copyToTempDir(imgFiles[curFile].path);

                uploadForm.Show();
            }
        }
Example #2
0
        private void Main_Load(object sender, EventArgs e)
        {
            uploadForm = new Upload();

            //init form options
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.Opaque, true);

            this.MouseWheel += new MouseEventHandler(Main_MouseWheel);

            this.DragEnter += Main_DragEnter;
            this.DragDrop += Main_DragDrop;

            //init fonts
            zoomDisplayFont = new Font(FontFamily.GenericSansSerif, 13);

            infoFont = new Font("Candara", 12, FontStyle.Bold);
            if (infoFont.Name != "Candara")
                infoFont = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);

            //init star-related stuff
            starred = new List<string>();

            pathLineH = TextRenderer.MeasureText("Asdf", infoFont).Height;

            //generate other UI images & brushes
            texture = genCheckeredPattern();
            xButton = genXButton();
            xpndButton = genAltCloseButton("expand");
            exitTessModeButton = genAltCloseButton("contract");

            yellowStar = Bitmap.FromFile(Application.StartupPath + "\\icons\\yellow star.png");
            yellowStarButton = Bitmap.FromFile(Application.StartupPath + "\\icons\\yellow star button.png");
            blackStar = Bitmap.FromFile(Application.StartupPath + "\\icons\\black star.png");
            miniStar = Bitmap.FromFile(Application.StartupPath + "\\icons\\mini star.png");

            thumbStripBrush = new SolidBrush(Color.FromArgb(38, 39, 37));

            //init UI buttons
            buttons = new UIButton[15];
            int i = 0;

            buttons[i++] = new UIButton("Tesserax Mode", genButton("tesserax"), -264, tesserax);
            buttons[i++] = new UIButton("Locate on Disk", genButton("locate"), -214, locateOnDisk);
            buttons[i++] = new UIButton("Zoom In", genButton("zoom"), -170, zoomIn);
            buttons[i++] = new UIButton("Zoom Out", genButton("unzoom"), -150, zoomOut);
            buttons[i++] = new UIButton("Toggle Zoom", genButton("zoom toggle"), -130, zoomToggle);
            buttons[i++] = new UIButton("Previous Picture", genButton("prev"), -102, prev);
            buttons[i++] = new UIButton("Play Slideshow", genPlayButton(), -66, play);
            buttons[i++] = new UIButton("Next Picture", genButton("next"), 70, next);
            buttons[i++] = new UIButton("Rotate Counter-Clockwise", genButton("rotate ccw"), 114, rotateCCW);
            buttons[i++] = new UIButton("Rotate Clockwise", genButton("rotate cw"), 134, rotateCW);
            buttons[i++] = new UIButton("Star", genButton("star"), 162, star);
            buttons[i++] = new UIButton("Star All", genButton("star all"), 198, starAll);
            buttons[i++] = new UIButton("Star None", genButton("star none"), 234, starNone);
            buttons[i++] = new UIButton("Comic Book Mode", genButton("comicbook"), 284, comicbook);
            buttons[i++] = new UIButton("About Tesserax", genButton("about"), 334, about);

            sideButtons = new ActionButton[8];
            i = 0;
            sideButtons[i++] = new ActionButton("Copy", genButton("copy"), -(i - 1) * 40, copy);
            sideButtons[i++] = new ActionButton("Delete", genButton("delete"), -(i - 1) * 40, delete);
            sideButtons[i++] = new ActionButton("Edit in Paint", genButton("edit"), -8 - (i - 1) * 40, edit);
            sideButtons[i++] = new ActionButton("Edit in Pixlr", genButton("pixlr"), -8 - (i - 1) * 40, pixlr);
            sideButtons[i++] = new ActionButton("Upload to Imgur", genButton("upload"), -16 - (i - 1) * 40, upload);
            sideButtons[i++] = new ActionButton("Google Search by Image", genButton("google"), -16 - (i - 1) * 40, google);
            sideButtons[i++] = new ActionButton("Search Karma Decay", genButton("karma"), -16 - (i - 1) * 40, karma);
            sideButtons[i++] = new ActionButton("Post to Reddit", genButton("reddit"), -16 - (i - 1) * 40, reddit);

            //prepare background workers
            imgLoader = new BackgroundWorker();
            imgLoader.WorkerSupportsCancellation = true;
            imgLoader.DoWork += new DoWorkEventHandler(imgLoader_DoWork);
            imgLoader.RunWorkerCompleted += new RunWorkerCompletedEventHandler(imgLoader_RunWorkerCompleted);

            assignThumbAndGifLoaders();

            //check for updates
            Updater.Update(VERSION, UPDATE_URL);
        }