Skip to content

Commit

Permalink
2022.10.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SLT-World committed Oct 10, 2022
1 parent 60ca56b commit 4e9b416
Show file tree
Hide file tree
Showing 55 changed files with 3,363 additions and 504 deletions.
22 changes: 22 additions & 0 deletions SLBr.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SLBr", "SLBr\SLBr.csproj",
EndProject
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "SLBr Packaging Project", "SLBr Packaging Project\SLBr Packaging Project.wapproj", "{D4FC58AC-26D9-41C6-8F97-D28A935C18F3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utility Service", "Utility Service\Utility Service.csproj", "{01B6FD23-3E66-40DA-A849-45513AEF573D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -71,6 +73,26 @@ Global
{D4FC58AC-26D9-41C6-8F97-D28A935C18F3}.Release|x86.ActiveCfg = Release|x86
{D4FC58AC-26D9-41C6-8F97-D28A935C18F3}.Release|x86.Build.0 = Release|x86
{D4FC58AC-26D9-41C6-8F97-D28A935C18F3}.Release|x86.Deploy.0 = Release|x86
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Debug|ARM.ActiveCfg = Debug|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Debug|ARM.Build.0 = Debug|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Debug|ARM64.Build.0 = Debug|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Debug|x64.ActiveCfg = Debug|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Debug|x64.Build.0 = Debug|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Debug|x86.ActiveCfg = Debug|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Debug|x86.Build.0 = Debug|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Release|Any CPU.Build.0 = Release|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Release|ARM.ActiveCfg = Release|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Release|ARM.Build.0 = Release|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Release|ARM64.ActiveCfg = Release|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Release|ARM64.Build.0 = Release|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Release|x64.ActiveCfg = Release|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Release|x64.Build.0 = Release|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Release|x86.ActiveCfg = Release|Any CPU
{01B6FD23-3E66-40DA-A849-45513AEF573D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion SLBr/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SLBr"
StartupUri="MainWindow.xaml" Startup="Application_Startup">
StartupUri="SplashScreen.xaml" Startup="Application_Startup">
<Application.Resources>

</Application.Resources>
Expand Down
31 changes: 31 additions & 0 deletions SLBr/Controls/CredentialsDialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SLBr.Controls
{
public class CredentialsDialogResult
{
public bool Accepted;
public string Username;
public string Password;

public CredentialsDialogResult(bool? _Accepted, string _Username, string _Password)
{
Accepted = (bool)_Accepted;
Username = _Username;
Password = _Password;
}
}
public static class CredentialsDialog
{
public static CredentialsDialogResult Show(string Question)
{
CredentialsDialogWindow _CredentialsDialogWindow = new CredentialsDialogWindow(Question);
_CredentialsDialogWindow.Topmost = true;
return new CredentialsDialogResult(_CredentialsDialogWindow.ShowDialog(), _CredentialsDialogWindow.Username, _CredentialsDialogWindow.Password);
}
}
}
38 changes: 38 additions & 0 deletions SLBr/Controls/CredentialsDialogWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<Window x:Class="SLBr.Controls.CredentialsDialogWindow"
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:SLBr.Controls"
mc:Ignorable="d"
Title="Credentials" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen"
ContentRendered="Window_ContentRendered" WindowStyle="None" ResizeMode="NoResize" AllowsTransparency="True" Background="Transparent">
<Window.Resources>
<ResourceDictionary Source="../StyleResourceDictionary.xaml"/>
</Window.Resources>
<Border Background="{DynamicResource PrimaryBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" CornerRadius="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<Label Name="lblQuestion" Margin="0,5">Question:</Label>
<Grid Margin="5" Grid.Row="1" Height="23">
<TextBlock VerticalAlignment="Center">Username</TextBlock>
<TextBox Name="UsernameTextBox" Height="23" Margin="60,0,0,0" Grid.Row="1" MinWidth="250"></TextBox>
</Grid>
<Grid Margin="5" Grid.Row="2" Height="23">
<TextBlock VerticalAlignment="Center">Password</TextBlock>
<TextBox Name="PasswordTextBox" Height="23" Margin="60,0,0,0" Grid.Row="1" MinWidth="250"></TextBox>
</Grid>

<WrapPanel Grid.Row="3" HorizontalAlignment="Right" Margin="0,5,5,5">
<Button Height="23" BorderBrush="{DynamicResource BorderBrush}" IsDefault="True" Name="btnDialogOk" Click="DialogOk_Click" MinWidth="60" Margin="0,0,5,0">_Sign in</Button>
<Button Height="23" BorderBrush="{DynamicResource BorderBrush}" IsCancel="True" MinWidth="60">_Cancel</Button>
</WrapPanel>
</Grid>
</Border>
</Window>
70 changes: 70 additions & 0 deletions SLBr/Controls/CredentialsDialogWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
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.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace SLBr.Controls
{
/// <summary>
/// Interaction logic for CredentialsDialog.xaml
/// </summary>
public partial class CredentialsDialogWindow : Window
{
public CredentialsDialogWindow(string Question)
{
InitializeComponent();

lblQuestion.Content = Question;
ApplyTheme(MainWindow.Instance.GetTheme());
}

public void ApplyTheme(Theme _Theme)
{
//Resources["PrimaryBrush"] = new SolidColorBrush(_Theme.PrimaryColor);
//Resources["FontBrush"] = new SolidColorBrush(_Theme.FontColor);
//Resources["BorderBrush"] = new SolidColorBrush(_Theme.BorderColor);
//Resources["UnselectedTabBrush"] = new SolidColorBrush(_Theme.UnselectedTabColor);
//Resources["ControlFontBrush"] = new SolidColorBrush(_Theme.ControlFontColor);

Resources["PrimaryBrushColor"] = _Theme.PrimaryColor;
Resources["FontBrushColor"] = _Theme.FontColor;
Resources["BorderBrushColor"] = _Theme.BorderColor;
Resources["UnselectedTabBrushColor"] = _Theme.UnselectedTabColor;
Resources["ControlFontBrushColor"] = _Theme.ControlFontColor;

//Storyboard s = (Storyboard)Resources["ToBorderBrushColor"];
//s.SetValue(value)

//Resources["ToBorderBrushColor"] = new Storyboard(new ColorAnimation()).Color;
}
private void DialogOk_Click(object sender, RoutedEventArgs e)
{
DialogResult = true;
}

private void Window_ContentRendered(object sender, EventArgs e)
{
UsernameTextBox.SelectAll();
UsernameTextBox.Focus();
}

public string Username
{
get { return UsernameTextBox.Text; }
}
public string Password
{
get { return PasswordTextBox.Text; }
}
}
}
26 changes: 26 additions & 0 deletions SLBr/Controls/PopupBrowser.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Window x:Class="SLBr.Controls.PopupBrowser"
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:SLBr.Controls"
mc:Ignorable="d"
Title="SLBr" Height="650" WindowStartupLocation="CenterScreen" Width="600" Loaded="Window_Loaded">
<Window.Resources>
<ResourceDictionary Source="../StyleResourceDictionary.xaml"/>
</Window.Resources>
<Grid>
<Grid x:Name="WebContent">

</Grid>
<Grid IsHitTestVisible="False" Focusable="False" x:Name="StatusBar" Margin="2.5,30" VerticalAlignment="Bottom">
<Popup SnapsToDevicePixels="True" x:Name="StatusBarPopup" Placement="RelativePoint" IsHitTestVisible="False" Focusable="False" AllowsTransparency="True" IsOpen="True">
<Border Background="{DynamicResource PrimaryBrush}" IsHitTestVisible="False" Focusable="False" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" CornerRadius="5">
<Grid IsHitTestVisible="False" Focusable="False" MaxWidth="300" Height="25">
<TextBlock IsHitTestVisible="False" x:Name="StatusMessage" Margin="5" FontFamily="None" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" Foreground="{DynamicResource FontBrush}"/>
</Grid>
</Border>
</Popup>
</Grid>
</Grid>
</Window>
116 changes: 116 additions & 0 deletions SLBr/Controls/PopupBrowser.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
using CefSharp;
using CefSharp.DevTools;
using CefSharp.Wpf.HwndHost;
using System;
using System.Runtime.InteropServices;
using System.Security.Policy;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace SLBr.Controls
{
/// <summary>
/// Interaction logic for PopupBrowser.xaml
/// </summary>
public partial class PopupBrowser : Window
{
[DllImport("dwmapi.dll", PreserveSig = true)]
public static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);

ChromiumWebBrowser _Browser;
Theme CurrentTheme;
string InitialAddress;
public PopupBrowser(string _Address, int _Width, int _Height)
{
InitializeComponent();
InitialAddress = _Address;
if (_Width != -1)
Width = _Width;
if (_Height != -1)
Height = _Height;
}

private void Browser_StatusMessage(object? sender, StatusMessageEventArgs e)
{
Application.Current.Dispatcher.BeginInvoke(new Action(delegate
{
//StatusBar.Visibility = string.IsNullOrEmpty(e.Value) ? Visibility.Collapsed : Visibility.Visible;
StatusBarPopup.IsOpen = !string.IsNullOrEmpty(e.Value);
StatusMessage.Text = e.Value;
}));
}

private void Browser_LoadingStateChanged(object? sender, LoadingStateChangedEventArgs e)
{
if (!_Browser.IsBrowserInitialized)
return;
Application.Current.Dispatcher.BeginInvoke(new Action(delegate
{
Icon = new BitmapImage(new Uri("https://www.google.com/s2/favicons?sz=24&domain=" + Utils.Host(_Browser.Address)));
DevToolsClient _DevToolsClient = _Browser.GetDevToolsClient();
_DevToolsClient.Emulation.SetAutoDarkModeOverrideAsync(CurrentTheme.DarkWebPage ? bool.Parse(MainWindow.Instance.MainSave.Get("DarkWebPage")) : false);
}));
}

public void ApplyTheme(Theme _Theme)
{
CurrentTheme = _Theme;
int SetDarkTitleBar = _Theme.DarkTitleBar ? 1 : 0;
DwmSetWindowAttribute(new WindowInteropHelper(this).Handle, (int)DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, ref SetDarkTitleBar, Marshal.SizeOf(true));

//Resources["PrimaryBrush"] = new SolidColorBrush(_Theme.PrimaryColor);
//Resources["FontBrush"] = new SolidColorBrush(_Theme.FontColor);
//Resources["BorderBrush"] = new SolidColorBrush(_Theme.BorderColor);
//Resources["UnselectedTabBrush"] = new SolidColorBrush(_Theme.UnselectedTabColor);
//Resources["ControlFontBrush"] = new SolidColorBrush(_Theme.ControlFontColor);

Resources["PrimaryBrushColor"] = _Theme.PrimaryColor;
Resources["FontBrushColor"] = _Theme.FontColor;
Resources["BorderBrushColor"] = _Theme.BorderColor;
Resources["UnselectedTabBrushColor"] = _Theme.UnselectedTabColor;
Resources["ControlFontBrushColor"] = _Theme.ControlFontColor;
}

private void Browser_TitleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
Title = $"{e.NewValue} - SLBr";
}

private void Window_Loaded(object sender, RoutedEventArgs e)
{
ApplyTheme(MainWindow.Instance.GetTheme());
_Browser = new ChromiumWebBrowser();
_Browser.Address = InitialAddress;

_Browser.LifeSpanHandler = MainWindow.Instance._LifeSpanHandler;
_Browser.DownloadHandler = MainWindow.Instance._DownloadHandler;
_Browser.RequestHandler = MainWindow.Instance._RequestHandler;
//_Browser.MenuHandler = MainWindow.Instance._ContextMenuHandler;
//_Browser.KeyboardHandler = MainWindow.Instance._KeyboardHandler;
//_Browser.JsDialogHandler = MainWindow.Instance._JsDialogHandler;

_Browser.TitleChanged += Browser_TitleChanged;
_Browser.LoadingStateChanged += Browser_LoadingStateChanged;
_Browser.ZoomLevelIncrement = 0.5f;
_Browser.StatusMessage += Browser_StatusMessage;
_Browser.AllowDrop = true;
_Browser.IsManipulationEnabled = true;

_Browser.BrowserSettings = new BrowserSettings
{
WindowlessFrameRate = MainWindow.Instance.Framerate,
Javascript = MainWindow.Instance.Javascript,
ImageLoading = MainWindow.Instance.LoadImages,
LocalStorage = MainWindow.Instance.LocalStorage,
Databases = MainWindow.Instance.Databases,
WebGl = MainWindow.Instance.WebGL,
BackgroundColor = System.Drawing.Color.Black.ToUInt()
};

WebContent.Children.Add(_Browser);
RenderOptions.SetBitmapScalingMode(_Browser, BitmapScalingMode.LowQuality);
}
}
}
4 changes: 2 additions & 2 deletions SLBr/Controls/ToastBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SLBr.Controls"
mc:Ignorable="d"
Title="Notification Popup" Height="90" Width="300" SizeToContent="Height" WindowStyle="None" ResizeMode="NoResize" Topmost="True" AllowsTransparency="True" Background="Transparent" ShowInTaskbar="False">
Title="Notification Popup" HorizontalAlignment="Right" VerticalAlignment="Bottom" Height="90" Width="300" SizeToContent="Height" WindowStyle="None" AllowsTransparency="True" ResizeMode="NoResize" Topmost="True" Background="Transparent" ShowInTaskbar="False">
<Window.Resources>
<ResourceDictionary Source="../StyleResourceDictionary.xaml"/>
</Window.Resources>
<Grid>
<Border Background="{DynamicResource PrimaryBrush}" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}">
<Border Background="{DynamicResource PrimaryBrush}" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" CornerRadius="5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
Expand Down
Loading

0 comments on commit 4e9b416

Please sign in to comment.