private void Exit_Click(object sender, RoutedEventArgs e) { GlobalConsts.SaveConsts(); GlobalConsts.LoadPage(GlobalConsts.MainPage.Load()); }
private void Tile_Click(object sender, RoutedEventArgs e) { GlobalConsts.LoadFlyoutPage(new DownloadSettingsControl()); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); GlobalConsts.LoadConsts(); GlobalConsts.CreateTempFolder(); }
private void CheckBox_Unchecked(object sender, RoutedEventArgs e) { GlobalConsts.CheckForSubscriptionUpdates = CheckForSubscriptionUpdatesCheckBox.IsChecked.Value; GlobalConsts.SaveConsts(); }
private void LanguageComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { GlobalConsts.ChangeLanguage((string)LanguageComboBox.SelectedItem); FlowDirection = (FlowDirection)FindResource("FlowDirection"); }
private void SubscriptionsButton_Click(object sender, RoutedEventArgs e) { GlobalConsts.LoadPage(new SubscriptionsPage()); }
private async Task AddSubscriptionPanel(Subscription sub) { var channel = await sub.GetChannel(); _ = Dispatcher.InvokeAsync(() => { int row = SubscriptionsGrid.RowDefinitions.Count; RowDefinition rowDefinition = new RowDefinition { Height = GridLength.Auto, }; SubscriptionsGrid.RowDefinitions.Add(rowDefinition); Image logo = new Image { MaxWidth = 120, MaxHeight = 120, Width = 98, Height = 98, Margin = new Thickness(2), Source = new BitmapImage(new Uri(channel.LogoUrl)), VerticalAlignment = VerticalAlignment.Top }; Grid.SetColumn(logo, 0); Grid.SetRow(logo, row); SubscriptionsGrid.Children.Add(logo); TextBlock description = new TextBlock { Height = 40, Width = double.NaN, FontSize = 14, VerticalAlignment = VerticalAlignment.Top }; description.Inlines.Add(string.Concat(FindResource("PlaylistTitle"), channel.Title, "\n")); description.Inlines.Add(string.Concat(FindResource("LastVideoDownloadDate"), sub.LatestVideoDownloaded.ToLocalTime().ToShortDateString())); Grid.SetColumn(description, 1); Grid.SetRow(description, row); SubscriptionsGrid.Children.Add(description); StackPanel buttonsPanel = new StackPanel { VerticalAlignment = VerticalAlignment.Center }; Grid.SetColumn(buttonsPanel, 2); Grid.SetRow(buttonsPanel, row); SubscriptionsGrid.Children.Add(buttonsPanel); Tile settingsButton = new Tile { Height = double.NaN, Width = double.NaN, Margin = new Thickness(2.5), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }, removeButton = new Tile { Height = double.NaN, Width = double.NaN, Margin = new Thickness(2.5), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; removeButton.Click += (s, e) => { rowDefinition.Height = new GridLength(0); Subscriptions.Remove(Subscriptions.FirstOrDefault(x => x.ChannelId.Equals(sub.ChannelId))); }; settingsButton.Click += (s, e) => { GlobalConsts.LoadFlyoutPage(new SubscriptionSettings(sub)); }; buttonsPanel.Children.Add(settingsButton); buttonsPanel.Children.Add(removeButton); WrapPanel settingsButtonWrapPanel = new WrapPanel(), removeButtonWrapPanel = new WrapPanel(); //Settings button PackIconModern settingsButtonIcon = new PackIconModern { Kind = PackIconModernKind.Cogs, Width = 35, Height = 35, Margin = new Thickness(5) }; TextBlock settingsButtonTextBlock = new TextBlock { Text = $"{FindResource("Settings")}", VerticalAlignment = VerticalAlignment.Center, FontSize = 16, Margin = new Thickness(2.5, 5, 7.5, 5) }; settingsButtonWrapPanel.Children.Add(settingsButtonIcon); settingsButtonWrapPanel.Children.Add(settingsButtonTextBlock); settingsButton.Content = settingsButtonWrapPanel; //Remove button PackIconModern removeButtonIcon = new PackIconModern { Kind = PackIconModernKind.Close, Width = 35, Height = 35, Margin = new Thickness(5) }; TextBlock removeButtonTextBlock = new TextBlock { Text = $"{FindResource("Remove")}", VerticalAlignment = VerticalAlignment.Center, FontSize = 16, Margin = new Thickness(2.5, 5, 7.5, 5) }; removeButtonWrapPanel.Children.Add(removeButtonIcon); removeButtonWrapPanel.Children.Add(removeButtonTextBlock); removeButton.Content = removeButtonWrapPanel; GridScrollViewer.Height = GlobalConsts.Current.ActualHeight - 300; GridScrollViewer.UpdateLayout(); }); }
private void Help_Click(object sender, RoutedEventArgs e) { GlobalConsts.LoadPage(new Help()); }
private void Home_Click(object sender, RoutedEventArgs e) { GlobalConsts.LoadPage(GlobalConsts.MainPage.Load()); }
private void About_Click(object sender, RoutedEventArgs e) { GlobalConsts.LoadPage(new About()); }
private void Settings_Click(object sender, RoutedEventArgs e) { GlobalConsts.LoadPage(new Settings()); }
private void SaveButton_Click(object sender, RoutedEventArgs e) { bool convert = ConvertCheckBox.IsChecked.Value; bool preferQuality = PreferCheckBox.IsChecked.Value; bool setBitrate = BitrateCheckBox.IsChecked.Value; var vq = VideoQuality.High720; string type = "mp3"; string bitrate = null; bool audioOnly = AudioOnlyCheckBox.IsChecked.Value; bool preferHighestFPS = PreferHighestFPSCheckBox.IsChecked.Value; bool downloadCaptions = CaptionsCheckBox.IsChecked.Value; bool playlistDirectories = UniquePlaylistDirectoryCheckBox.IsChecked.Value; string captionsLanguage = Languages.FirstOrDefault(x => x.Value.Equals((string)CaptionsLanguagesComboBox.SelectedItem, StringComparison.OrdinalIgnoreCase)).Key; bool subset = PlaylistIndexCheckBox.IsChecked.Value; bool openDestinationFolder = OpenDestinationFolderCheckBox.IsChecked.Value; bool tagAudioFile = TagAudioFileCheckBox.IsChecked.Value; int startIndex = 0, endIndex = 0; if (subset) { if (!int.TryParse(PlaylistStartIndexTextBox.Text, out startIndex) || startIndex < 1) { startIndex = 0; PlaylistStartIndexTextBox.Background = GlobalConsts.ErrorBrush; } else { PlaylistStartIndexTextBox.Background = null; } if (!int.TryParse(PlaylistEndIndexTextBox.Text, out endIndex)) { endIndex = 0; PlaylistEndIndexTextBox.Background = GlobalConsts.ErrorBrush; } else { PlaylistEndIndexTextBox.Background = null; } } if (BitrateCheckBox.IsChecked.Value) { if (!string.IsNullOrWhiteSpace(BitRateTextBox.Text) && BitRateTextBox.Text.All(c => char.IsDigit(c))) { bitrate = BitRateTextBox.Text; } } if (PreferCheckBox.IsChecked.Value) { vq = Resolutions[(string)ResulotionDropDown.SelectedValue]; } if (convert) { type = (string)ExtensionsDropDown.SelectedItem; } GlobalConsts.DownloadSettings = new Objects.DownloadSettings(type, audioOnly, vq, preferHighestFPS, preferQuality, convert, setBitrate, bitrate, downloadCaptions, captionsLanguage, playlistDirectories, subset, startIndex, endIndex, openDestinationFolder, tagAudioFile); GlobalConsts.CloseFlyout(); }