forked from LvlAndFarm/Xtream-Browser
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from primetime43/dev
Dev to Main v3.0.0
- Loading branch information
Showing
19 changed files
with
1,996 additions
and
802 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<Window x:Class="X_IPTV.CategoryNav" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:X_IPTV" xmlns:extToolkit="http://schemas.xceed.com/wpf/xaml/toolkit" | ||
mc:Ignorable="d" | ||
Title="Channel Group Guide" Height="450" Width="800"> | ||
|
||
<Window.Resources> | ||
<!-- BusyIndicator Style with Cancel Button --> | ||
<Style x:Key="BusyIndicatorStyle" TargetType="extToolkit:BusyIndicator"> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="extToolkit:BusyIndicator"> | ||
<Grid> | ||
<ContentControl Content="{TemplateBinding Content}" /> | ||
<Grid x:Name="busyGrid" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed"> | ||
<Rectangle Fill="White" Opacity="0.75"/> | ||
<Border Background="WhiteSmoke" CornerRadius="10" Padding="10"> | ||
<StackPanel> | ||
<TextBlock x:Name="busyContent" Text="{TemplateBinding BusyContent}" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap"/> | ||
<ProgressBar Width="180" Height="15" IsIndeterminate="True" VerticalAlignment="Top" Margin="10,10,10,5"/> | ||
<Button Content="Cancel" Width="80" Height="25" HorizontalAlignment="Center" Click="CancelButton_Click"/> | ||
</StackPanel> | ||
</Border> | ||
</Grid> | ||
</Grid> | ||
<ControlTemplate.Triggers> | ||
<Trigger Property="IsBusy" Value="True"> | ||
<Setter TargetName="busyGrid" Property="Visibility" Value="Visible"/> | ||
</Trigger> | ||
</ControlTemplate.Triggers> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
</Window.Resources> | ||
<extToolkit:BusyIndicator x:Name="busy_ind" IsBusy="False" BusyContent="Authenticating..." Style="{StaticResource BusyIndicatorStyle}"> | ||
<Grid Background="LightGray"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="13*"/> | ||
<ColumnDefinition Width="12*"/> | ||
<ColumnDefinition Width="135*"/> | ||
</Grid.ColumnDefinitions> | ||
<Button x:Name="quitBtn" Content="Quit" Background="White" HorizontalAlignment="Left" Height="45" Margin="530,354,0,0" VerticalAlignment="Top" Width="115" Click="quitBtn_Click" Grid.Column="2"/> | ||
<Button x:Name="backToLoginBtn" Content="Back to Login" Background="White" HorizontalAlignment="Left" Height="45" Margin="390,354,0,0" VerticalAlignment="Top" Width="115" Click="backToLoginBtn_Click" Grid.Column="2"/> | ||
<ListView x:Name="listViewTest" d:ItemsSource="{d:SampleData ItemCount=5}" Grid.ColumnSpan="3" Margin="0,0,595,0" SelectionChanged="ListViewItem_Selected"> | ||
<ListView.ItemTemplate> | ||
<DataTemplate> | ||
<WrapPanel> | ||
<TextBlock Text="{Binding CategoryName}" FontWeight="Bold"/> | ||
</WrapPanel> | ||
</DataTemplate> | ||
</ListView.ItemTemplate> | ||
</ListView> | ||
<RichTextBox x:Name="userInfoTxtBox" Grid.Column="2" Margin="337,21,45,217" ScrollViewer.VerticalScrollBarVisibility="Auto"> | ||
<FlowDocument> | ||
<Paragraph> | ||
<Run Text="RichTextBox"/> | ||
</Paragraph> | ||
</FlowDocument> | ||
</RichTextBox> | ||
<Button x:Name="button" Grid.Column="2" Content="Search All Channels" Background="White" HorizontalAlignment="Left" Margin="225,354,0,0" VerticalAlignment="Top" Height="45" Width="135" Click="button_Click"/> | ||
</Grid> | ||
</extToolkit:BusyIndicator> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Threading; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Input; | ||
using Xceed.Wpf.Toolkit; | ||
using static X_IPTV.M3UPlaylist; | ||
using static X_IPTV.XtreamCodes; | ||
|
||
namespace X_IPTV | ||
{ | ||
/// <summary> | ||
/// Interaction logic for CategoryNav.xaml | ||
/// </summary> | ||
/// | ||
public partial class CategoryNav : Window | ||
{ | ||
private CancellationTokenSource cts; | ||
public CategoryNav() | ||
{ | ||
InitializeComponent(); | ||
loadCategories();//loads the categories into the listbox view | ||
if(Instance.XtreamCodesChecked) | ||
loadUserInfo();//displays the user's info in the text box | ||
else | ||
userInfoTxtBox.Visibility = Visibility.Collapsed; | ||
} | ||
|
||
private void loadCategories() | ||
{ | ||
if (Instance.XtreamCodesChecked) | ||
{ | ||
var groups = Instance.XtreamCategoryList.OrderBy(x => x.CategoryName).ToList(); | ||
listViewTest.ItemsSource = groups; | ||
} | ||
else if (Instance.M3uChecked) | ||
{ | ||
var groups = Instance.M3UCategoryList.OrderBy(x => x.CategoryName).ToList(); | ||
listViewTest.ItemsSource = groups; | ||
} | ||
} | ||
|
||
private void loadUserInfo() | ||
{ | ||
if (Instance.XtreamCodesChecked) | ||
{ | ||
userInfoTxtBox.Document.Blocks.Clear(); | ||
|
||
userInfoTxtBox.AppendText("user_info:\r"); | ||
foreach (PropertyInfo ce in typeof(User_Info).GetProperties()) | ||
{ | ||
if (ce.Name == "exp_date" || ce.Name == "created_at") | ||
userInfoTxtBox.AppendText(ce.Name + ": " + ChannelOptions.convertUnixToRealTIme(Convert.ToInt32(ce.GetValue(Instance.PlayerInfo.user_info))) + "\r"); | ||
else if (ce.Name == "allowed_output_formats") | ||
{ | ||
userInfoTxtBox.AppendText(ce.Name + ": "); | ||
string[] formats = (string[])ce.GetValue(Instance.PlayerInfo.user_info); | ||
for (int i = 0; i < formats.Length; i++) | ||
{ | ||
userInfoTxtBox.AppendText(formats[i]); | ||
if (i < formats.Length - 1) | ||
userInfoTxtBox.AppendText(", "); | ||
} | ||
userInfoTxtBox.AppendText("\r"); | ||
} | ||
else | ||
userInfoTxtBox.AppendText(ce.Name + ": " + ce.GetValue(Instance.PlayerInfo.user_info) + "\r"); | ||
} | ||
|
||
userInfoTxtBox.AppendText("\rserver_info:\r"); | ||
foreach (PropertyInfo ce in typeof(Server_Info).GetProperties()) | ||
{ | ||
userInfoTxtBox.AppendText(ce.Name + ": " + ce.GetValue(Instance.PlayerInfo.server_info) + "\r"); | ||
} | ||
} | ||
} | ||
|
||
|
||
private void quitBtn_Click(object sender, RoutedEventArgs e) | ||
{ | ||
Environment.Exit(1); | ||
} | ||
|
||
private void backToLoginBtn_Click(object sender, RoutedEventArgs e) | ||
{ | ||
UserLogin.ReturnToLogin = true; | ||
this.Close(); | ||
} | ||
|
||
private void ListViewItem_Selected(object sender, SelectionChangedEventArgs e) | ||
{ | ||
if (e.AddedItems.Count > 0) | ||
{ | ||
if (Instance.XtreamCodesChecked) | ||
{ | ||
var selectedItem = e.AddedItems[0] as XtreamCategory; | ||
|
||
if (selectedItem != null) | ||
{ | ||
string selectedText = selectedItem.CategoryName; | ||
loadSelectedCategory(selectedText); | ||
} | ||
} | ||
else if(Instance.M3uChecked) | ||
{ | ||
var selectedItem = e.AddedItems[0] as M3UCategory; | ||
|
||
if (selectedItem != null) | ||
{ | ||
string selectedText = selectedItem.CategoryName; | ||
loadSelectedCategory(selectedText); | ||
} | ||
} | ||
else | ||
Xceed.Wpf.Toolkit.MessageBox.Show("Error with the selected category."); | ||
} | ||
} | ||
|
||
|
||
private async void loadSelectedCategory(string categoryName) | ||
{ | ||
cts = new CancellationTokenSource(); | ||
|
||
Instance.selectedCategory = categoryName; | ||
|
||
busy_ind.IsBusy = true; | ||
if (Instance.XtreamCodesChecked) | ||
{ | ||
XtreamChannelList channelWindow = new XtreamChannelList(); | ||
if (!cts.IsCancellationRequested) | ||
{ | ||
channelWindow.ShowDialog(); | ||
this.Close(); | ||
} | ||
} | ||
else if(Instance.M3uChecked) | ||
{ | ||
// Logic for loading channels from M3U playlists | ||
var channels = Instance.M3UChannels.Where(c => c.CategoryName == categoryName).ToList(); | ||
if (channels.Count > 0) | ||
{ | ||
await M3UPlaylist.PairEPGTOChannelM3U(channels); | ||
busy_ind.IsBusy = false; | ||
|
||
M3UChannelList channelWindow = new M3UChannelList(); | ||
channelWindow.ShowDialog(); | ||
this.Close(); | ||
} | ||
else | ||
{ | ||
Xceed.Wpf.Toolkit.MessageBox.Show("No channels available in " + Instance.selectedCategory); | ||
} | ||
} | ||
} | ||
|
||
private void CancelButton_Click(object sender, RoutedEventArgs e) | ||
{ | ||
if (cts != null) | ||
{ | ||
cts.Cancel(); | ||
} | ||
busy_ind.IsBusy = false; | ||
} | ||
|
||
private void button_Click(object sender, RoutedEventArgs e) | ||
{ | ||
UniversalSearchList searchWindow = new UniversalSearchList(); | ||
searchWindow.Show(); | ||
} | ||
} | ||
} |
Oops, something went wrong.