Skip to content

Commit

Permalink
Added cleaned/fixed busy indicator for M3U & Xtream Login pages
Browse files Browse the repository at this point in the history
- Added cleaned/fixed busy indicator for M3U & Xtream Login pages
  • Loading branch information
primetime43 committed Nov 15, 2024
1 parent 26e8f57 commit 4d048ee
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 3 deletions.
73 changes: 71 additions & 2 deletions X-IPTV/Views/M3ULogin.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,79 @@
d:DesignWidth="800"
mc:Ignorable="d">

<!-- BusyIndicator Style with Cancel Button -->
<Page.Resources>
<Style x:Key="BusyIndicatorStyle" TargetType="extToolkit:BusyIndicator">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="extToolkit:BusyIndicator">
<Grid>
<!-- Background Content -->
<ContentControl Content="{TemplateBinding Content}" />

<!-- Blocking Overlay -->
<Rectangle
x:Name="overlay"
Fill="Black"
IsHitTestVisible="True"
Opacity="0.5"
Visibility="Collapsed" />

<!-- Busy Indicator Content -->
<Grid
x:Name="busyGrid"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="Collapsed">
<Rectangle Fill="White" Opacity="0.75" />
<Border
Padding="10"
Background="WhiteSmoke"
CornerRadius="10">
<StackPanel>
<TextBlock
x:Name="busyContent"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{TemplateBinding BusyContent}"
TextWrapping="Wrap" />
<ProgressBar
Width="180"
Height="15"
Margin="10,10,10,5"
VerticalAlignment="Top"
IsIndeterminate="True" />
<Button
Width="80"
Height="25"
HorizontalAlignment="Center"
Click="CancelButton_Click"
Content="Cancel" />
</StackPanel>
</Border>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<!-- Show Overlay and Busy Content When IsBusy is True -->
<Trigger Property="IsBusy" Value="True">
<Setter TargetName="overlay" Property="Visibility" Value="Visible" />
<Setter TargetName="busyGrid" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Page.Resources>

<extToolkit:BusyIndicator
x:Name="busy_ind"
BusyContent="Authenticating..."
IsBusy="False">
IsBusy="False"
Style="{StaticResource BusyIndicatorStyle}">
<extToolkit:BusyIndicator.BusyContent>
Authenticating...
</extToolkit:BusyIndicator.BusyContent>


<Grid Background="#333333">
<!-- Define consistent row and column sizes -->
Expand Down
7 changes: 7 additions & 0 deletions X-IPTV/Views/M3ULogin.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,12 @@ private void OpenUsersFolderBtn_Click(object sender, RoutedEventArgs e)
Xceed.Wpf.Toolkit.MessageBox.Show($"Failed to open the users folder. Error: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}

private void CancelButton_Click(object sender, RoutedEventArgs e)
{
// Stop the ongoing process
busy_ind.IsBusy = false;
MessageBox.Show("Operation canceled by the user.", "Canceled", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
}
15 changes: 14 additions & 1 deletion X-IPTV/Views/XtreamLogin.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,24 @@
mc:Ignorable="d">

<Page.Resources>
<!-- BusyIndicator Style with Cancel Button -->
<!-- BusyIndicator Style with Blocking Overlay -->
<Style x:Key="BusyIndicatorStyle" TargetType="extToolkit:BusyIndicator">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="extToolkit:BusyIndicator">
<Grid>
<!-- Background Content -->
<ContentControl Content="{TemplateBinding Content}" />

<!-- Blocking Overlay -->
<Rectangle
x:Name="overlay"
Fill="Black"
IsHitTestVisible="True"
Opacity="0.5"
Visibility="Collapsed" />

<!-- Busy Indicator Content -->
<Grid
x:Name="busyGrid"
HorizontalAlignment="Center"
Expand Down Expand Up @@ -54,7 +65,9 @@
</Grid>
</Grid>
<ControlTemplate.Triggers>
<!-- Show Overlay and Busy Content When IsBusy is True -->
<Trigger Property="IsBusy" Value="True">
<Setter TargetName="overlay" Property="Visibility" Value="Visible" />
<Setter TargetName="busyGrid" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
Expand Down

0 comments on commit 4d048ee

Please sign in to comment.