Beispiel #1
0
        private void loadMenu()
        {
            currentFullFolder    = Path.Combine(baseFolder, currentFolder);
            currentFullImageFile = Path.Combine(baseFolder, currentFolder + ".jpg");
            currentFullURLFile   = Path.Combine(baseFolder, currentFolder + ".url");

            btnUp.Enabled = (currentFolder != "");

            try
            {
                // DOSSIER
                if (Directory.Exists(currentFullFolder))
                {
                    string[] pFiles  = Directory.GetFiles(currentFullFolder, "*.jpg", SearchOption.TopDirectoryOnly).Where(file => file.ToLower().EndsWith("jpg")).ToArray();
                    int      nbFiles = pFiles.Count();
                    if (nbFiles > 6)
                    {
                        nbFiles = 6;
                    }

                    foreach (PictureBox pctb in pictureBoxes)
                    {
                        pctb.Image = null;
                    }

                    foreach (Label lbl in labels)
                    {
                        //lbl.Text = "";
                        lbl.Visible = false;
                    }

                    for (int i = 0; i < nbFiles; i++)
                    {
                        this.pictureBoxes[i].Image = ImageHelper.getImage(pFiles[i], iThumbSizeWidth, iThumbSizeHeight);
                        this.pictureBoxes[i].Tag   = Path.GetFileNameWithoutExtension(pFiles[i]);
                        labels[i].Text             = this.pictureBoxes[i].Tag.ToString().ToUpper();
                        labels[i].Visible          = true;

                        // Si correspond à dossier
                        if (Directory.Exists(pFiles[i].Replace(".jpg", "")))
                        {
                            labels[i].BackColor = Color.LightYellow;
                        }
                        else
                        {
                            labels[i].BackColor = Color.LightGray;
                        }
                        // this.pictureBoxes[i].Tag = Path.GetFileName(pFiles[i]);
                    }
                }
                // URL
                else if (File.Exists(currentFullURLFile))
                {
                    frmWeb frm = new frmWeb();
                    //frm.pictureBox1.Image = Image.FromFile(currentFullFile);

                    currentFolder = Path.GetDirectoryName(currentFolder);

                    string url = File.ReadLines(currentFullURLFile).FirstOrDefault();

                    frm.giveInfos(url);

                    frm.Show();
                }
                // IMAGE
                else if (File.Exists(currentFullImageFile))
                {
                    frmFull frm = new frmFull();
                    //frm.pictureBox1.Image = Image.FromFile(currentFullFile);

                    currentFolder = Path.GetDirectoryName(currentFolder);

                    string[] psachemins = new string[6];
                    for (int i = 0; i < 6; i++)
                    {
                        if (this.pictureBoxes[i].Tag != null)
                        {
                            psachemins[i] = Path.Combine(baseFolder, currentFolder, this.pictureBoxes[i].Tag.ToString() + ".jpg");
                        }
                        ;
                        // this.pictureBoxes[i].Tag = Path.GetFileName(pFiles[i]);
                    }

                    frm.giveInfos(lastPctClicked, psachemins);

                    frm.Show();
                }
                else
                {
                    currentFolder = "";
                    loadMenu();
                }
            }
            catch (IOException e)
            {
                lblStatus.Text = "!D";
            }
        }
Beispiel #2
0
        private void lblStatus_Click(object sender, EventArgs e)
        {
            Form frm = new frmWeb();

            frm.Show();
        }