Skip to content

Commit

Permalink
a lot of changes and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
itzbluebxrry committed Aug 14, 2023
1 parent 5ae0695 commit 11f1a09
Show file tree
Hide file tree
Showing 18 changed files with 440 additions and 42 deletions.
18 changes: 18 additions & 0 deletions Project-Radon/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
using Project_Radon;
using Project_Radon.Settings;
using Windows.Storage;
using Microsoft.Toolkit.Uwp.Notifications;
using Windows.Foundation.Collections;

// TODO: Import Cubekit.UI (Firecube's GlowUI refer https://github.com/FireCubeStudios/TemplateApp)

Expand Down Expand Up @@ -144,5 +146,21 @@ private void OnSuspending(object sender, SuspendingEventArgs e)
//TODO: Save application state and stop any background activity
deferral.Complete();
}

protected override void OnActivated(IActivatedEventArgs e)
{
// Handle notification activation
if (e is ToastNotificationActivatedEventArgs toastActivationArgs)
{
// Obtain the arguments from the notification
ToastArguments args = ToastArguments.Parse(toastActivationArgs.Argument);

// Obtain any user input (text boxes, menu selections) from the notification
ValueSet userInput = toastActivationArgs.UserInput;

// TODO: Show the corresponding content

}
}
}
}
49 changes: 47 additions & 2 deletions Project-Radon/Controls/BrowserTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="using:Microsoft.Toolkit.Uwp.UI"
xmlns:media="using:Microsoft.Toolkit.Uwp.UI.Media"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">

<Grid CornerRadius="8" Margin="8,0,8,8" BorderBrush="{ThemeResource SystemBaseLowColor}" Opacity="1" BorderThickness="1">
<Grid CornerRadius="8" Margin="4,0,4,4" BorderBrush="{ThemeResource SystemBaseLowColor}" Opacity="1" BorderThickness="1">

<winui:WebView2
NavigationCompleted="WebBrowser_NavigationCompleted"
NavigationStarting="WebBrowser_NavigationStarting"
x:Name="WebBrowser"
Source="https://google.com"
Visibility="Collapsed"
/>
<Grid x:Name="ntpGrid">
<Grid x:Name="ntpGrid" Visibility="Collapsed">
<Grid.Background>
<ImageBrush x:Name="ntpbackgroundbrush" Stretch="UniformToFill" ImageSource="https://bing.biturl.top/?resolution=1366&amp;format=image&amp;index=random&amp;mkt=en-US"/>
</Grid.Background>
<Grid Background="Black" Opacity="0.5"/>

<StackPanel HorizontalAlignment="Center" VerticalAlignment="Stretch" Margin="100,90" MinWidth="500">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom">
<TextBlock x:Name="ntpHourDisplay" FontWeight="Medium" TextAlignment="Center" Text="12:00" FontSize="68" />
Expand Down Expand Up @@ -72,5 +75,47 @@
<TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Center" Text="Photo: Bing daily photos"
Style="{ThemeResource CaptionTextBlockStyle}" Margin="0,12"/>
</Grid>
<Grid x:Name="offlinePage" Visibility="Collapsed" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{ThemeResource AcrylicInAppFillColorDefaultBrush}">
<ScrollViewer>
<StackPanel Margin="0,30">
<TextBlock Style="{ThemeResource SubheaderTextBlockStyle}" TextAlignment="Center" FontWeight="SemiLight">Unable to reach the web</TextBlock>
<TextBlock Style="{ThemeResource SubheaderTextBlockStyle}" FontSize="16" TextAlignment="Center" FontWeight="SemiLight">Radon is unable to load the page you're requesting for.</TextBlock>
<StackPanel Orientation="Horizontal" Margin="0,12" HorizontalAlignment="Center">
<FontIcon Glyph="&#xE7F8;" FontSize="50"/>
<winui:ProgressBar x:Name="pcToNet" Width="100" Margin="10" Value="100" Foreground="{ThemeResource TextBoxForegroundHeaderThemeBrush}"/>
<FontIcon x:Name="netIcon" Glyph="&#xEC3F;" FontSize="50" Opacity="1" />
<!--Foreground="BlueViolet"-->
<winui:ProgressBar x:Name="netToWeb" Width="100" Margin="10" Value="100" Foreground="{ThemeResource TextBoxForegroundHeaderThemeBrush}"/>
<FontIcon Glyph="&#xE12B;" FontSize="50" Opacity="0.3"/>
</StackPanel>
<winui:InfoBar x:Name="offlineInfoBar" Margin="20,24" MaxWidth="600" HorizontalAlignment="Stretch" IsOpen="True" Severity="Warning" HorizontalContentAlignment="Center"
Title="It seems like your PC isn't connected to any network." IsClosable="False">

</winui:InfoBar>
<TextBlock Margin="20,8,20,8" MaxWidth="600" Style="{ThemeResource SubtitleTextBlockStyle}" FontSize="16">Let's get you back online!</TextBlock>
<TextBlock Margin="20,0" MaxWidth="600">To get connected, try these recommendations:</TextBlock>

<winui:Expander HorizontalContentAlignment="Left" HorizontalAlignment="Stretch" Margin="20,28,20,4" MaxWidth="600">
<winui:Expander.Header>
<TextBlock Style="{ThemeResource SubtitleTextBlockStyle}" FontSize="15">Check your network cables, modem or routers</TextBlock>
</winui:Expander.Header>
<TextBlock TextAlignment="Left" TextWrapping="WrapWholeWords">
<Run>It's always a good idea to check your network connection sources to ensure they work as expected.</Run>
</TextBlock>
</winui:Expander>

<winui:Expander HorizontalContentAlignment="Left" HorizontalAlignment="Stretch" Margin="20,4" MaxWidth="600">
<winui:Expander.Header>
<TextBlock Style="{ThemeResource SubtitleTextBlockStyle}" FontSize="15">Reconnect to your wireless network</TextBlock>
</winui:Expander.Header>
<TextBlock TextAlignment="Left" TextWrapping="WrapWholeWords">
<Run>Sometimes your wireless connection could behave unexpected. Reconnecting could be a major fix for this kind of issue.</Run>
</TextBlock>
</winui:Expander>
</StackPanel>
</ScrollViewer>

</Grid>
<TextBlock x:Name="network_debug" Text="Internet connection status goes here." VerticalAlignment="Bottom"/>
</Grid>
</Page>
66 changes: 60 additions & 6 deletions Project-Radon/Controls/BrowserTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Imaging;
using Microsoft.Toolkit.Uwp;
using Microsoft.Toolkit.Uwp.Connectivity;
using Yttrium;
using Microsoft.Toolkit.Uwp.Notifications;

namespace Project_Radon.Controls
{
Expand Down Expand Up @@ -49,8 +52,11 @@ public bool IsLoading
public BrowserTab()
{
InitializeComponent();





WebBrowser.Source = new Uri("about:radon-ntp");

//Windows.System.Launcher.LaunchFolderAsync(ApplicationData.Current.LocalFolder);
Expand Down Expand Up @@ -111,21 +117,69 @@ private void WebBrowser_NavigationCompleted(Microsoft.UI.Xaml.Controls.WebView2
ntpGrid.Visibility = Visibility.Visible;
ntpbackgroundbrush.ImageSource = new BitmapImage(new Uri("https://bing.biturl.top/?resolution=1366&format=image&index=random&mkt=en-US"));


}
else
{
WebBrowser.Visibility = Visibility.Visible;
ntpGrid.Visibility = Visibility.Collapsed;
if (NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable == false)
{
WebBrowser.Visibility = Visibility.Collapsed;
ntpGrid.Visibility = Visibility.Collapsed;
offlinePage.Visibility = Visibility.Visible;
}
else
{
WebBrowser.Visibility = Visibility.Visible;
ntpGrid.Visibility = Visibility.Collapsed;
offlinePage.Visibility = Visibility.Collapsed;
}
}
}
public void Close() => WebBrowser.Close();
private void WebBrowser_NavigationStarting(Microsoft.UI.Xaml.Controls.WebView2 sender, CoreWebView2NavigationStartingEventArgs args)

private async void WebBrowser_NavigationStarting(Microsoft.UI.Xaml.Controls.WebView2 sender, CoreWebView2NavigationStartingEventArgs args)
{
offlinePage.Visibility = Visibility.Collapsed;
IsLoading = true;
WebBrowser.Focus(FocusState.Pointer);
WebBrowser.Focus(FocusState.Keyboard);



if (NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable == false)
{
if (!WebBrowser.Source.Equals("edge://radon-ntp"))
{
offlinePage.Visibility = Visibility.Visible;
bool isOffline = true;
network_debug.Text = "Internet unavailable - disconnected";
while (isOffline == true)
{
await Task.Delay(1000);
if (NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable == true)
{

WebBrowser.Reload();
WebBrowser.Visibility = Visibility.Collapsed;
isOffline = false;

network_debug.Text = "Internet available - connected";
new ToastContentBuilder()
.AddArgument("action", "viewConversation")
.AddArgument("conversationId", 9813)
.AddButton(new ToastButton()
.SetContent("Dismiss"))
.AddText("You're now online!")
.AddText("The Internet connection has been restored. You can now continue browsing.")
.AddAttributionText("via Radon Browser")
.AddAppLogoOverride(new Uri("ms-appx:///Assets/StoreLogo.scale-100.png"), ToastGenericAppLogoCrop.Circle)
.Show();
await Task.Delay(500);

}
}
}
}

}
public async Task GoTo(string url)
{
Expand Down Expand Up @@ -212,9 +266,9 @@ private void ntpSearchBar_PointerEntered(object sender, Windows.UI.Xaml.Input.Po

}

private async void profileCenterToggle_Click(object sender, RoutedEventArgs e)
private void profileCenterToggle_Click(object sender, RoutedEventArgs e)
{
await new UserProfileDialog().ShowAsync();

}
}
}
2 changes: 1 addition & 1 deletion Project-Radon/Helpers/loginpage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<Grid Height="8"/>
<TextBlock Style="{ThemeResource TitleTextBlockStyle}" TextAlignment="Center">Radon user</TextBlock>
<Grid Height="22"/>
<PasswordBox Width="300" PlaceholderText="Password" IsPasswordRevealButtonEnabled="True" BorderThickness="0" KeyDown="PasswordBox_KeyDown"/>
<PasswordBox Width="300" PlaceholderText="Password" BorderThickness="0" KeyDown="PasswordBox_KeyDown"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="20" VerticalAlignment="Bottom" HorizontalAlignment="Right">
<Button Background="{x:Null}" BorderThickness="0">
Expand Down
1 change: 1 addition & 0 deletions Project-Radon/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,7 @@
<StackPanel Background="{ThemeResource AcrylicBackgroundFillColorDefaultBrush}" Padding="10" HorizontalAlignment="Center" CornerRadius="8">
<TextBlock HorizontalAlignment="Center" Text="Pick a theme:" Style="{ThemeResource SubtitleTextBlockStyle}" TextAlignment="Center"/>
<ComboBox x:Name="ThemePickerComboBox" Width="300" Margin="0,10,0,0" SelectionChanged="ThemePickerComboBox_SelectionChanged">
<ComboBoxItem Content="None"/>
<ComboBoxItem Content="Unknown"/>
<ComboBoxItem Content="Forest"/>
<ComboBoxItem Content="Candy"/>
Expand Down
11 changes: 9 additions & 2 deletions Project-Radon/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using Windows.Devices.Enumeration;
using Windows.UI.Xaml.Navigation;
using Windows.Storage;
using Windows.UI.Xaml.Media.Animation;

namespace Yttrium_browser
{
Expand Down Expand Up @@ -631,7 +632,7 @@ private void RefreshButton_PointerEntered(object sender, PointerRoutedEventArgs

private void controlCenterToggleButton_Click(object sender, RoutedEventArgs e)
{

}

private void controlCenter_Closed(object sender, object e)
Expand Down Expand Up @@ -664,7 +665,13 @@ private void profileCenter_Opened(object sender, object e)
ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
String localValue = localSettings.Values["username"] as string;

profileCenter_UsernameHeader.Text = localValue;
if (localValue != null)
{
profileCenter_UsernameHeader.Text = localValue;
}
else {
// this.Frame.Navigate(typeof(oobe1), null, new EntranceNavigationTransitionInfo());
}
}

private void fullscreentopbar_Click(object sender, RoutedEventArgs e)
Expand Down
10 changes: 8 additions & 2 deletions Project-Radon/Project Radon.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -439,22 +439,28 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm">
<Version>8.1.0</Version>
<Version>8.2.1</Version>
</PackageReference>
<PackageReference Include="Fluent.Icons">
<Version>1.1.110</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.14</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.Connectivity">
<Version>7.1.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications">
<Version>7.1.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls">
<Version>7.1.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Media">
<Version>7.1.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.UI.Xaml">
<Version>2.8.2</Version>
<Version>2.8.5</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Project-Radon/Settings/License.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
Copyright © 2023 ItzBluebxrry <https://youtube.com/@ItzBluebxrry/>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

Expand Down
8 changes: 7 additions & 1 deletion Project-Radon/Settings/oobe1.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0"/>
<RowDefinition Height="48"/>
<RowDefinition Height="3*"/>
</Grid.RowDefinitions>
<Border x:Name="titleBar" BorderBrush="Red" BorderThickness="0">
<StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="Transparent" Orientation="Horizontal">
<Image Margin="15,0,0,0" Source="ms-appx:///Assets/StoreLogo.png" HorizontalAlignment="Left" VerticalAlignment="Center" Width="20"/>
<TextBlock Margin="15,0,0,0" VerticalAlignment="Center" Style="{ThemeResource CaptionTextBlockStyle}">Radon Browser • Initial setup</TextBlock>
</StackPanel>
</Border>
<StackPanel Grid.Row="1" Margin="0,48" VerticalAlignment="Center">
<Image Source="ms-appx:///Assets/welcomegif.png" Width="120"/>

Expand Down
14 changes: 14 additions & 0 deletions Project-Radon/Settings/oobe1.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel.Core;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
Expand All @@ -26,6 +29,17 @@ public sealed partial class oobe1 : Page
public oobe1()
{
this.InitializeComponent();


// Title bar code-behind
var coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
coreTitleBar.ExtendViewIntoTitleBar = true;

// Set XAML element as a drag region.
Window.Current.SetTitleBar(titleBar);
var ititleBar = ApplicationView.GetForCurrentView().TitleBar;
ititleBar.ButtonBackgroundColor = Colors.Transparent;
ititleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
}

private void Button_Click(object sender, RoutedEventArgs e)
Expand Down
14 changes: 10 additions & 4 deletions Project-Radon/Settings/oobe2.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,35 @@

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0"/>
<RowDefinition Height="48"/>
<RowDefinition Height="3*"/>
</Grid.RowDefinitions>
<Grid>

<Border x:Name="titleBar" BorderBrush="Red" BorderThickness="0">
<StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="Transparent" Orientation="Horizontal">
<Image Margin="15,0,0,0" Source="ms-appx:///Assets/StoreLogo.png" HorizontalAlignment="Left" VerticalAlignment="Center" Width="20"/>
<TextBlock Margin="15,0,0,0" VerticalAlignment="Center" Style="{ThemeResource CaptionTextBlockStyle}">Radon Browser • Initial setup</TextBlock>
</StackPanel>
</Border>
</Grid>
<Grid Grid.Row="1" Margin="30,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>

<StackPanel VerticalAlignment="Center" Margin="20,0">
<Image Source="ms-appx:///Assets/clipboard_3d.png" Width="120"/>
<TextBlock Text="License Agreements" Style="{ThemeResource SubheaderTextBlockStyle}" TextAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="Before you can use Radon, please agree to the following license agreements." TextWrapping="WrapWholeWords" Style="{ThemeResource SubheaderTextBlockStyle}" FontSize="18" TextAlignment="Center" Margin="0,8"/>
</StackPanel>
<ScrollViewer Grid.Column="1" Margin="20,40,20,130" Padding="0,20" CornerRadius="8" BorderThickness="1" BorderBrush="{ThemeResource SystemBaseLowColor}">
<ScrollViewer Grid.Column="1" Margin="20,0,20,130" Padding="0,20" CornerRadius="8" BorderThickness="1" BorderBrush="{ThemeResource SystemBaseLowColor}">
<StackPanel CornerRadius="8">




<TextBlock x:Name="LicenseTextBox" TextAlignment="Justify" TextWrapping="WrapWholeWords" Margin="30,20,30,0" Text="Getting license..."/>
<TextBlock x:Name="LicenseTextBox" IsTextSelectionEnabled="True" TextAlignment="Justify" TextWrapping="WrapWholeWords" Margin="30,20,30,0" Text="Getting license..."/>


</StackPanel>
Expand Down
Loading

0 comments on commit 11f1a09

Please sign in to comment.