Example #1
0
        private void Main_Load(object sender, EventArgs e)
        {
            Thread autoUpdateThread = new Thread(() => autoUpdate());

            if (AllUserConfig.firstTimeAppRunning)
            {
                LanguageSelection languageSelectionForm = new LanguageSelection();
                languageSelectionForm.ShowDialog();
            }
            if (AllUserConfig.lang == "mk")
            {
                AllUserConfig.languageRM = new ResourceManager("YTDownloader.language_mk", Assembly.GetExecutingAssembly());
                menuPicture.Image        = Properties.Resources.MenuMkd;
            }
            else
            {
                menuPicture.Image = Properties.Resources.MenuEng;
            }
            Text = AllUserConfig.languageRM.GetString("ProgramTitle");
            MaxNumOfSimVideos.changeNumber(AllUserConfig.maxSimDownloads);
            activityTab           = new ActivityTab();
            downloadTab           = new DownloadTab();
            activityTab.MdiParent = this;
            downloadTab.MdiParent = this;
            activityTab.Show();
            activityTab.Location = new Point(0, 161);
            downloadTab.Show();
            downloadTab.Location     = new Point(0, 161);
            btnDownloadTab.TabStop   = false;
            btnDownloadTab.FlatStyle = FlatStyle.Flat;
            btnDownloadTab.FlatAppearance.BorderSize  = 0;
            btnDownloadTab.FlatAppearance.BorderColor = Color.FromArgb(0, 255, 255, 255);
            btnDownloadTab.Text      = AllUserConfig.languageRM.GetString("downloadTab");
            btnActivityTab.TabStop   = false;
            btnActivityTab.FlatStyle = FlatStyle.Flat;
            btnActivityTab.FlatAppearance.BorderSize  = 0;
            btnActivityTab.FlatAppearance.BorderColor = Color.FromArgb(0, 255, 255, 255);
            btnActivityTab.BackColor = Color.DarkGray;
            btnActivityTab.Text      = AllUserConfig.languageRM.GetString("activityTab");
            btnDownloadTab.FlatAppearance.MouseOverBackColor = DefaultBackColor;
            btnActivityTab.FlatAppearance.MouseOverBackColor = Color.FromArgb(152, 152, 152);

            autoUpdateThread.Start();
        }
Example #2
0
        private void Settings_Load(object sender, EventArgs e)
        {
            lblCannotChangeSetting.Visible = false;
            lblCannotChangeSetting.Text    = AllUserConfig.languageRM.GetString("lblCannotChangeSetting");
            ActivityTab temporary = Application.OpenForms["ActivityTab"] as ActivityTab;

            if (temporary.noOngoingDownloads())
            {
                lblMaxSimDownloads.Enabled = true;
                numericDownloads.Enabled   = true;
            }
            else
            {
                lblMaxSimDownloads.Enabled     = false;
                numericDownloads.Enabled       = false;
                lblCannotChangeSetting.Visible = true;
            }
            Text                      = AllUserConfig.languageRM.GetString("Settings");
            lblLanguage.Text          = AllUserConfig.languageRM.GetString("LanguageLabel");
            lblMaxSimDownloads.Text   = AllUserConfig.languageRM.GetString("MaxSimDownLabel");
            lblRestartProgram.Text    = AllUserConfig.languageRM.GetString("lblRestartProgram");
            lblDownloadsWarning1.Text = AllUserConfig.languageRM.GetString("lblDownloadsWarning1");
            lblDownloadsWarning2.Text = AllUserConfig.languageRM.GetString("lblDownloadsWarning2");
            cbLanguage.Items.Add("English");
            cbLanguage.Items.Add("Македонски");
            if (AllUserConfig.lang == "mk")
            {
                cbLanguage.SelectedIndex = 1;
                cbSelectedIndex          = 1;
            }
            else
            {
                cbLanguage.SelectedIndex = 0;
                cbSelectedIndex          = 0;
            }
            numericDownloads.Value       = AllUserConfig.maxSimDownloads;
            simDownloadsNumber           = AllUserConfig.maxSimDownloads;
            lblDownloadsWarning1.Visible = false;
            lblDownloadsWarning2.Visible = false;
            lblRestartProgram.Visible    = false;
        }
        private void btnDownload_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(AllUserConfig.downloadLocation))
            {
                MessageBox.Show(AllUserConfig.languageRM.GetString("directoryDoesntExist"));
                return;
            }
            Button activityTabButton = Application.OpenForms["Main"].Controls["btnActivityTab"] as Button;
            Button downloadTabButton = Application.OpenForms["Main"].Controls["btnDownloadTab"] as Button;

            activityTabButton.BackColor = DefaultBackColor;
            activityTabButton.FlatAppearance.MouseOverBackColor = DefaultBackColor;
            downloadTabButton.BackColor = Color.DarkGray;
            downloadTabButton.FlatAppearance.MouseOverBackColor = Color.FromArgb(152, 152, 152);
            ActivityTab activityTab = Application.OpenForms["ActivityTab"] as ActivityTab;

            activityTab.Activate();
            ActivityTab tempForm = Application.OpenForms["ActivityTab"] as ActivityTab;
            Trim        trim     = new Trim(tbStartTime.Text, tbEndTime.Text);
            string      format;

            switch (ddQualitySelection.SelectedIndex)
            {
            case 1: format = "best"; break;

            case 2: format = "2160p"; break;

            case 3: format = "1440p"; break;

            case 4: format = "1080p"; break;

            case 5: format = "720p"; break;

            case 6: format = "480p"; break;

            case 7: format = "360p"; break;

            case 8: format = "240p"; break;

            case 9: format = "144p"; break;

            case 11: format = "mp3"; break;

            default: format = "best"; break;
            }
            if (cb60fps.Enabled && cb60fps.Checked && format != "best")
            {
                format = format + "60";
            }
            else if ((cb60fps.Enabled && cb60fps.Checked && format == "best"))
            {
                format = "p60";
            }
            if (trim.isValid())
            {
                tempForm.startAddingVideos(IdExtractor.GetIdsAndTypes(tbLinks.Text), llDownloadLocation.Text, format, trim);
            }
            else
            {
                tempForm.startAddingVideos(IdExtractor.GetIdsAndTypes(tbLinks.Text), llDownloadLocation.Text, format, null);
            }
            tbLinks.Text     = "";
            tbStartTime.Text = "00:00:00";
            tbEndTime.Text   = "00:00:00";
        }