Projektdateien hinzufügen.
This commit is contained in:
82
VideoBrowser/Views/AboutView.xaml
Normal file
82
VideoBrowser/Views/AboutView.xaml
Normal file
@@ -0,0 +1,82 @@
|
||||
<UserControl
|
||||
x:Class="VideoBrowser.Views.AboutView"
|
||||
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:extension="clr-namespace:VideoBrowser.Extensions"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Background="WhiteSmoke"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Resources/IconsResource.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" TargetType="Button">
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Margin" Value="2" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Border
|
||||
Margin="32"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Background="White">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="10"
|
||||
Opacity="0.3"
|
||||
ShadowDepth="3" />
|
||||
</Border.Effect>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" Background="RoyalBlue">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image
|
||||
Grid.Column="0"
|
||||
Margin="8,0,8,0"
|
||||
Source="{Binding AppIcon}" />
|
||||
<Label
|
||||
Grid.Column="1"
|
||||
Height="50"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="{Binding ApplicationName}"
|
||||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="White" />
|
||||
</Grid>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Width="500"
|
||||
Margin="24">
|
||||
<TextBlock Margin="0,0,0,4" Text="{Binding Version}" />
|
||||
<TextBlock Margin="0,0,0,4" Text="{Binding Author}" />
|
||||
<StackPanel Margin="0,0,0,4" Orientation="Horizontal">
|
||||
<Button Command="{Binding TwitterCommand}" Focusable="False">
|
||||
<Path Style="{StaticResource Twitter}" />
|
||||
</Button>
|
||||
<Button
|
||||
Margin="4,0,0,0"
|
||||
Command="{Binding LinkedInCommand}"
|
||||
Focusable="False">
|
||||
<Path Style="{StaticResource LinkedIn}" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<TextBlock>
|
||||
<Hyperlink NavigateUri="{Binding ProjectUrl}" RequestNavigate="{extension:EventBinding ProjectUrlClickedCommand}">
|
||||
<TextBlock Foreground="RoyalBlue" Text="{Binding ProjectUrl}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
22
VideoBrowser/Views/AboutView.xaml.cs
Normal file
22
VideoBrowser/Views/AboutView.xaml.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace VideoBrowser.Views
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for AboutView.xaml.
|
||||
/// </summary>
|
||||
public partial class AboutView : UserControl
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AboutView"/> class.
|
||||
/// </summary>
|
||||
public AboutView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#endregion Constructors
|
||||
}
|
||||
}
|
||||
50
VideoBrowser/Views/DownloadFlyoutView.xaml
Normal file
50
VideoBrowser/Views/DownloadFlyoutView.xaml
Normal file
@@ -0,0 +1,50 @@
|
||||
<UserControl
|
||||
x:Class="VideoBrowser.Views.DownloadFlyoutView"
|
||||
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:viewmodels="clr-namespace:VideoBrowser.ViewModels"
|
||||
d:DataContext="{d:DesignInstance viewmodels:DownloadFlyoutViewModel}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
Grid.Column="0"
|
||||
Margin="4"
|
||||
Command="{Binding ShowDownloadTabCommand}"
|
||||
Content="Show Downloads"
|
||||
ToolTip="Show download queue" />
|
||||
<ItemsControl Grid.Column="1" ItemsSource="{Binding DownloadItemModels}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid
|
||||
Width="250"
|
||||
Margin="4"
|
||||
HorizontalAlignment="Stretch">
|
||||
<Border Background="#FF555555" Opacity="0.7" />
|
||||
<StackPanel Margin="8,2,8,2">
|
||||
<TextBlock
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
Foreground="White"
|
||||
Text="{Binding Title}"
|
||||
ToolTip="{Binding Title}" />
|
||||
<TextBlock Foreground="Gainsboro" Text="{Binding Status}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
VideoBrowser/Views/DownloadFlyoutView.xaml.cs
Normal file
28
VideoBrowser/Views/DownloadFlyoutView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace VideoBrowser.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DownloadFlyoutView.xaml
|
||||
/// </summary>
|
||||
public partial class DownloadFlyoutView : UserControl
|
||||
{
|
||||
public DownloadFlyoutView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
156
VideoBrowser/Views/DownloadQueueView.xaml
Normal file
156
VideoBrowser/Views/DownloadQueueView.xaml
Normal file
@@ -0,0 +1,156 @@
|
||||
<UserControl
|
||||
x:Class="VideoBrowser.Views.DownloadQueueView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:converters="clr-namespace:VideoBrowser.Controls.CefSharpBrowser.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewmodels="clr-namespace:VideoBrowser.ViewModels"
|
||||
d:DataContext="{d:DesignInstance viewmodels:DownloadQueueViewModel}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Resources/IconsResource.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label
|
||||
Grid.Row="0"
|
||||
Height="50"
|
||||
Padding="16,5,5,5"
|
||||
VerticalContentAlignment="Center"
|
||||
Background="RoyalBlue"
|
||||
Content="Downloads"
|
||||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="White" />
|
||||
<ListBox
|
||||
Grid.Row="1"
|
||||
ItemsSource="{Binding OperationCollectionView}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Background="WhiteSmoke" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource {x:Type ListBoxItem}}" TargetType="ListBoxItem">
|
||||
<Setter Property="Width" Value="600" />
|
||||
<Setter Property="Margin" Value="8" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Border
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1"
|
||||
Opacity="0.7">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="10" ShadowDepth="3" />
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
<Grid x:Name="OperationModelGrid" Background="White">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" Grid.Column="0">
|
||||
<Image Source="{Binding Thumbnail, Converter={x:Static converters:StringToImageConverter.Instance}}" Stretch="Uniform">
|
||||
<Image.Style>
|
||||
<Style TargetType="Image">
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="Width" Value="150" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsApplicationThumbnail}" Value="True">
|
||||
<Setter Property="Margin" Value="24" />
|
||||
<Setter Property="Width" Value="32" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Image.Style>
|
||||
</Image>
|
||||
</Grid>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="4">
|
||||
<TextBlock
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
Foreground="RoyalBlue"
|
||||
Text="{Binding Title}"
|
||||
ToolTip="{Binding Title}" />
|
||||
<TextBlock Foreground="Gray" Text="{Binding Url}" />
|
||||
<TextBlock Foreground="Gray" Text="{Binding FileSize}" />
|
||||
<TextBlock Foreground="Gray" Text="{Binding Status}" />
|
||||
<StackPanel
|
||||
Margin="0,8,0,0"
|
||||
Orientation="Horizontal"
|
||||
Visibility="{Binding IsQueuedControlsVisible, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Button
|
||||
Width="50"
|
||||
Command="{Binding PauseDownloadCommand}"
|
||||
Content="{Binding PauseText}"
|
||||
ToolTip="Pause or resume download" />
|
||||
<Button
|
||||
Width="50"
|
||||
Margin="8,0,0,0"
|
||||
Command="{Binding CancelDownloadCommand}"
|
||||
Content="Cancel"
|
||||
ToolTip="Cancel downloading this file" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Margin="0,8,0,0"
|
||||
Orientation="Horizontal"
|
||||
Visibility="{Binding IsCompletedControlsVisible, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<StackPanel.Resources>
|
||||
<Style BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" TargetType="Button">
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Margin" Value="2" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<Button Command="{Binding ShowDownloadedFolderCommand}" ToolTip="Open folder of this file">
|
||||
<Path Style="{StaticResource VideoFolder}" />
|
||||
</Button>
|
||||
<Button
|
||||
Margin="8,0,0,0"
|
||||
Command="{Binding ExecuteDownloadedCommand}"
|
||||
ToolTip="Open this file with associated application"
|
||||
Visibility="{Binding IsCompletedControlsVisible, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Path Style="{StaticResource Play}" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="AliceBlue">
|
||||
<Controls:MetroProgressBar
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Value="{Binding Progress, Mode=OneWay}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
20
VideoBrowser/Views/DownloadQueueView.xaml.cs
Normal file
20
VideoBrowser/Views/DownloadQueueView.xaml.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace VideoBrowser.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DownloadQueueView.xaml
|
||||
/// </summary>
|
||||
public partial class DownloadQueueView
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DownloadQueueView"/> class.
|
||||
/// </summary>
|
||||
public DownloadQueueView()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
#endregion Constructors
|
||||
}
|
||||
}
|
||||
104
VideoBrowser/Views/MainWindow.xaml
Normal file
104
VideoBrowser/Views/MainWindow.xaml
Normal file
@@ -0,0 +1,104 @@
|
||||
<Controls:MetroWindow
|
||||
x:Class="VideoBrowser.Views.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
||||
xmlns:browserViews="clr-namespace:VideoBrowser.Controls.CefSharpBrowser.Views"
|
||||
xmlns:converters="clr-namespace:VideoBrowser.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:extension="clr-namespace:VideoBrowser.Extensions"
|
||||
xmlns:helpers="clr-namespace:VideoBrowser.Helpers"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:viewmodels="clr-namespace:VideoBrowser.ViewModels"
|
||||
xmlns:views="clr-namespace:VideoBrowser.Views"
|
||||
Title="{Binding Title}"
|
||||
Width="800"
|
||||
Height="450"
|
||||
d:DataContext="{d:DesignInstance viewmodels:MainWindowViewModel}"
|
||||
Closing="{extension:EventBinding ClosingCommand,
|
||||
CommandParameter={Binding RelativeSource={RelativeSource Self}}}"
|
||||
GlowBrush="{DynamicResource AccentColorBrush}"
|
||||
Loaded="{extension:EventBinding LoadedCommand,
|
||||
CommandParameter={Binding RelativeSource={RelativeSource Self}}}"
|
||||
mc:Ignorable="d">
|
||||
<Controls:MetroWindow.Resources>
|
||||
<helpers:BindingProxy x:Key="MainWindowViewModelProxy" DataContext="{Binding}" />
|
||||
<converters:MultiplyConverter x:Key="MultiplyConverter" />
|
||||
</Controls:MetroWindow.Resources>
|
||||
<Controls:MetroWindow.InputBindings>
|
||||
<KeyBinding Key="Esc" Command="{Binding PressEscCommand}" />
|
||||
<KeyBinding Key="F2" Command="{Binding PressF2Command}" />
|
||||
</Controls:MetroWindow.InputBindings>
|
||||
<Grid Background="WhiteSmoke">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<browserViews:WebBrowserTabControlView
|
||||
x:Name="WebBrowserTabControlView"
|
||||
Grid.Row="0"
|
||||
DataContext="{Binding WebBrowserTabControlViewModel}" />
|
||||
<Grid
|
||||
x:Name="FlyoverPlacementGrid"
|
||||
Grid.Row="1"
|
||||
DataContext="{Binding DownloadFlyoutViewModel}">
|
||||
<Grid.Height>
|
||||
<MultiBinding Converter="{StaticResource MultiplyConverter}">
|
||||
<Binding ElementName="DownloadFlyoutsControl" Path="ActualHeight" />
|
||||
<Binding Path="Tag" RelativeSource="{RelativeSource Self}" />
|
||||
</MultiBinding>
|
||||
</Grid.Height>
|
||||
<Grid.Style>
|
||||
<Style TargetType="Grid">
|
||||
<Setter Property="Tag">
|
||||
<Setter.Value>
|
||||
<sys:Double>0.0</sys:Double>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsOpen}" Value="True">
|
||||
<DataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
AutoReverse="False"
|
||||
Storyboard.TargetProperty="Tag"
|
||||
To="1"
|
||||
Duration="0:0:0.300" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.EnterActions>
|
||||
<DataTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
AutoReverse="False"
|
||||
Storyboard.TargetProperty="Tag"
|
||||
To="0"
|
||||
Duration="0:0:0.300" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.ExitActions>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Style>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Controls:MetroWindow.Flyouts>
|
||||
<Controls:FlyoutsControl>
|
||||
<Controls:Flyout
|
||||
x:Name="AutoCloseFlyout"
|
||||
AutoCloseInterval="10000"
|
||||
CloseButtonVisibility="Collapsed"
|
||||
DataContext="{Binding DownloadFlyoutViewModel}"
|
||||
Header="Downloads"
|
||||
IsAutoCloseEnabled="True"
|
||||
IsOpen="{Binding IsOpen}"
|
||||
Position="Bottom">
|
||||
<views:DownloadFlyoutView x:Name="DownloadFlyoutsControl" />
|
||||
</Controls:Flyout>
|
||||
</Controls:FlyoutsControl>
|
||||
</Controls:MetroWindow.Flyouts>
|
||||
</Controls:MetroWindow>
|
||||
128
VideoBrowser/Views/MainWindow.xaml.cs
Normal file
128
VideoBrowser/Views/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,128 @@
|
||||
namespace VideoBrowser.Views
|
||||
{
|
||||
using Dragablz;
|
||||
using System.Windows;
|
||||
using VideoBrowser.Common;
|
||||
using VideoBrowser.Controls.CefSharpBrowser;
|
||||
using VideoBrowser.Extensions;
|
||||
using VideoBrowser.Helpers;
|
||||
using VideoBrowser.Models;
|
||||
using VideoBrowser.ViewModels;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml.
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MainWindow"/> class.
|
||||
/// </summary>
|
||||
public MainWindow() : this(new GlobalBrowserData())
|
||||
{
|
||||
// This constructor is called once per application instance.
|
||||
var addIns = this.GlobalBrowserData.AddInButtons;
|
||||
addIns.Add(new DownloadQueueButton(this.GlobalBrowserData.DownloadItemModels));
|
||||
addIns.Add(new OpenOutputFolderButton(this.GlobalBrowserData.Settings));
|
||||
addIns.Add(new SettingsButton(this.GlobalBrowserData.Settings));
|
||||
addIns.Add(new AboutButton());
|
||||
if (DebugHelper.IsDebug)
|
||||
{
|
||||
addIns.Add(new TestButton());
|
||||
}
|
||||
|
||||
// Register create browser tab.
|
||||
this.GlobalBrowserData.InterTabClient.CreateWindow = this.CreateWindow;
|
||||
|
||||
// Add the first browser tab.
|
||||
var browserTabModel = this.MainWindowViewModel.WebBrowserTabControlViewModel;
|
||||
browserTabModel.TabItems.Add(this.MainWindowViewModel.CreateBrowser());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MainWindow"/> class.
|
||||
/// </summary>
|
||||
/// <param name="globalBrowserData">The globalBrowserData<see cref="GlobalBrowserData"/>.</param>
|
||||
internal MainWindow(GlobalBrowserData globalBrowserData)
|
||||
{
|
||||
// This constructor is intended to create new window after dragging the browser tab.
|
||||
Logger.Info($"Start {nameof(VideoBrowser)}");
|
||||
this.GlobalBrowserData = globalBrowserData;
|
||||
this.MainWindowViewModel = new MainWindowViewModel(globalBrowserData);
|
||||
this.MainWindowViewModel.CefWindowData.PropertyChanged += this.CefWindowData_PropertyChanged;
|
||||
this.GlobalBrowserData.WindowViewModels.Add(this.MainWindowViewModel);
|
||||
this.DataContext = this.MainWindowViewModel;
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
#endregion Constructors
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the GlobalBrowserData.
|
||||
/// </summary>
|
||||
internal GlobalBrowserData GlobalBrowserData { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the LastWindowState.
|
||||
/// </summary>
|
||||
private WindowState LastWindowState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the LastWindowStyle.
|
||||
/// </summary>
|
||||
private WindowStyle LastWindowStyle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MainWindowViewModel.
|
||||
/// </summary>
|
||||
private MainWindowViewModel MainWindowViewModel { get; set; }
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The OnGlobalData_PropertyChanged.
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender<see cref="object"/>.</param>
|
||||
/// <param name="e">The e<see cref="System.ComponentModel.PropertyChangedEventArgs"/>.</param>
|
||||
private void CefWindowData_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
var cefWindowData = this.MainWindowViewModel.CefWindowData;
|
||||
if (e.IsMatch(nameof(cefWindowData.IsFullScreen)))
|
||||
{
|
||||
if (cefWindowData.IsFullScreen)
|
||||
{
|
||||
this.LastWindowState = this.WindowState;
|
||||
this.LastWindowStyle = this.WindowStyle;
|
||||
this.WindowState = WindowState.Maximized;
|
||||
this.WindowStyle = WindowStyle.None;
|
||||
this.ShowTitleBar = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WindowState = this.LastWindowState;
|
||||
this.WindowStyle = this.LastWindowStyle;
|
||||
this.ShowTitleBar = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The CreateWindow.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="(Window, TabablzControl)"/>.</returns>
|
||||
private (Window, TabablzControl) CreateWindow()
|
||||
{
|
||||
var viewModel = new MainWindowViewModel(this.GlobalBrowserData);
|
||||
var window = new MainWindow(this.GlobalBrowserData) { DataContext = viewModel };
|
||||
var initialTabablzControl = window.WebBrowserTabControlView.InitialTabablzControl;
|
||||
return (window, initialTabablzControl);
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
130
VideoBrowser/Views/UrlEditorView.xaml
Normal file
130
VideoBrowser/Views/UrlEditorView.xaml
Normal file
@@ -0,0 +1,130 @@
|
||||
<Grid
|
||||
x:Class="VideoBrowser.Views.UrlEditorView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cefsharpbrowser="clr-namespace:VideoBrowser.Controls.CefSharpBrowser"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:extension="clr-namespace:VideoBrowser.Extensions"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewmodels="clr-namespace:VideoBrowser.ViewModels"
|
||||
d:DataContext="{d:DesignInstance viewmodels:UrlEditorViewModel}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
extension:FocusExtension.IsFocused="{Binding IsFocused, Mode=TwoWay}"
|
||||
extension:FocusExtension.TrackFocus="True"
|
||||
mc:Ignorable="d">
|
||||
<Grid.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Resources/IconsResource.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<Style
|
||||
x:Key="ButtonPathStyle"
|
||||
BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
|
||||
TargetType="Button">
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Margin" Value="2" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</Grid.Resources>
|
||||
<Border Background="White" Visibility="{Binding IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="10"
|
||||
Opacity="0.3"
|
||||
ShadowDepth="0" />
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
<Grid Margin="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Url TextBox -->
|
||||
<!--<TextBox
|
||||
Grid.Row="0"
|
||||
Height="21"
|
||||
Margin="2,2,2,4"
|
||||
VerticalAlignment="Center"
|
||||
extension:FocusExtension.IsFocused="{Binding IsTextBoxFocused, Mode=TwoWay, Delay=100}"
|
||||
extension:FocusExtension.TrackFocus="True"
|
||||
extension:TextBoxExtension.IsClickToSelectAll="True"
|
||||
Text="{Binding Url, UpdateSourceTrigger=PropertyChanged}">
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Key="Return" Command="{Binding NavigateUrlCommand}" />
|
||||
</TextBox.InputBindings>
|
||||
</TextBox>-->
|
||||
<cefsharpbrowser:UrlTextBox
|
||||
Grid.Row="0"
|
||||
Margin="2,2,2,4"
|
||||
extension:FocusExtension.IsFocused="{Binding IsTextBoxFocused, Mode=TwoWay, Delay=100}"
|
||||
extension:FocusExtension.TrackFocus="True"
|
||||
extension:TextBoxExtension.IsClickToSelectAll="True"
|
||||
NavigateUrl="{Binding NavigateUrl, UpdateSourceTrigger=PropertyChanged}"
|
||||
NavigateUrlCommand="{Binding NavigateUrlCommand}"
|
||||
Url="{Binding Url, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Grid Grid.Row="1" Visibility="{Binding IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0" VerticalAlignment="Center">
|
||||
<Image
|
||||
Width="200"
|
||||
Source="{Binding ImageUrl}"
|
||||
Stretch="Uniform" />
|
||||
<Label
|
||||
Margin="4"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Background="Black"
|
||||
Content="{Binding Duration}"
|
||||
Foreground="White" />
|
||||
</Grid>
|
||||
<StackPanel Grid.Column="1" Margin="12,0,12,0">
|
||||
<TextBlock
|
||||
Margin="0,0,0,2"
|
||||
FontSize="14"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding FileName}" />
|
||||
<TextBlock Text="{Binding FileSize}" />
|
||||
<ComboBox
|
||||
Width="200"
|
||||
Margin="0,4,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
ItemsSource="{Binding Formats}"
|
||||
SelectedIndex="{Binding SelectedFormatIndex, UpdateSourceTrigger=PropertyChanged, Delay=300}"
|
||||
SelectedItem="{Binding SelectedFormat, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}" />
|
||||
<StackPanel Margin="0,4,0,0" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
MaxWidth="500"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Settings.OutputFolder}" />
|
||||
<Button
|
||||
Margin="8,0,0,0"
|
||||
Command="{Binding GetFolderCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource Self}}"
|
||||
Style="{StaticResource ButtonPathStyle}"
|
||||
ToolTip="Change the output folder">
|
||||
<Path Style="{StaticResource VideoFolder}" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<Button
|
||||
Margin="0,4,0,8"
|
||||
HorizontalAlignment="Left"
|
||||
Command="{Binding DownloadCommand}"
|
||||
Content="Download"
|
||||
Style="{DynamicResource MahApps.Styles.Button.Square.Accent}"
|
||||
ToolTip="Download the current video" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Grid Background="#AAFFFFFF" Visibility="{Binding IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<mah:ProgressRing IsActive="{Binding IsBusy}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
20
VideoBrowser/Views/UrlEditorView.xaml.cs
Normal file
20
VideoBrowser/Views/UrlEditorView.xaml.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace VideoBrowser.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for UrlEditorView.xaml
|
||||
/// </summary>
|
||||
public partial class UrlEditorView
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UrlEditorView"/> class.
|
||||
/// </summary>
|
||||
public UrlEditorView()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
#endregion Constructors
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user