Exemple #1
0
        private void fill_RightPanel(AppEntry entry)
        {
            lbl_rightpanel_title.Text = entry.Name;

            webBrowser1.DocumentText = "<html><body style='background-color:black;'></body></html>";
            new YoutubeProvider().Run(entry.Name + " review");

            if (entry.Screenshot1 == null && entry.Screenshot2 == null & entry.Screenshot3 == null)
            {
                var results = ImagesProvider.googleSearch(entry.Name + " screenshot");

                entry.Screenshot1 = Tools.GetByteFromUrl(results[0].Link);
                entry.Screenshot2 = Tools.GetByteFromUrl(results[1].Link);
                entry.Screenshot3 = Tools.GetByteFromUrl(results[2].Link);

                DbController.ModifyEntry(entry);
            }

            if (entry.Screenshot1 != null)
            {
                pic_rightpanel_1.Image = Tools.GetImageFromByte(entry.Screenshot1);
            }
            if (entry.Screenshot2 != null)
            {
                pic_rightpanel_2.Image = Tools.GetImageFromByte(entry.Screenshot2);
            }
            if (entry.Screenshot3 != null)
            {
                pic_rightpanel_3.Image = Tools.GetImageFromByte(entry.Screenshot3);
            }
        }
Exemple #2
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (txt_id.Text == "")
            {
                AppEntry newApp = new AppEntry();
                newApp.Name     = txt_name.Text;
                newApp.Path     = txt_path.Text;
                newApp.Category = txt_category.Text;

                if (pic_image.Image != null)
                {
                    newApp.Image2 = Tools.GetByteFromImage(pic_image.Image);
                }
                if (pic_screenshot1.Image != null)
                {
                    newApp.Screenshot1 = Tools.GetByteFromImage(pic_screenshot1.Image);
                }
                if (pic_screenshot2.Image != null)
                {
                    newApp.Screenshot2 = Tools.GetByteFromImage(pic_screenshot2.Image);
                }
                if (pic_screenshot3.Image != null)
                {
                    newApp.Screenshot3 = Tools.GetByteFromImage(pic_screenshot3.Image);
                }

                DbController.AddEntry(newApp);

                (System.Windows.Forms.Application.OpenForms["AppEntryDetailsForm"] as AppEntryDetailsForm).Close();
                (System.Windows.Forms.Application.OpenForms["Form1"] as Form1).ShowAppEntries();
            }
            else
            {
                AppEntry modifyApp = DbController.GetEntry(Convert.ToInt32(txt_id.Text));
                modifyApp.Name     = txt_name.Text;
                modifyApp.Path     = txt_path.Text;
                modifyApp.Category = txt_category.Text;

                if (pic_image.Image != null & image_isModified)
                {
                    modifyApp.Image2 = Tools.GetByteFromImage(pic_image.Image);
                }
                if (pic_screenshot1.Image != null && screenshot1_isModified)
                {
                    modifyApp.Screenshot1 = Tools.GetByteFromImage(pic_screenshot1.Image);
                }
                if (pic_screenshot2.Image != null && screenshot2_isModified)
                {
                    modifyApp.Screenshot2 = Tools.GetByteFromImage(pic_screenshot2.Image);
                }
                if (pic_screenshot3.Image != null && screenshot3_isModified)
                {
                    modifyApp.Screenshot3 = Tools.GetByteFromImage(pic_screenshot3.Image);
                }

                DbController.ModifyEntry(modifyApp);
                (System.Windows.Forms.Application.OpenForms["AppEntryDetailsForm"] as AppEntryDetailsForm).Close();
                (System.Windows.Forms.Application.OpenForms["Form1"] as Form1).ShowAppEntries();
            }
        }