diff --git a/Controls/BrowserMenuItems.xaml b/Controls/BrowserMenuItems.xaml index 103d19b..90e729f 100644 --- a/Controls/BrowserMenuItems.xaml +++ b/Controls/BrowserMenuItems.xaml @@ -115,12 +115,6 @@ - - - - - - diff --git a/Controls/BrowserMenuItems.xaml.cs b/Controls/BrowserMenuItems.xaml.cs index 67f16e9..e1d754c 100644 --- a/Controls/BrowserMenuItems.xaml.cs +++ b/Controls/BrowserMenuItems.xaml.cs @@ -1,11 +1,7 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.Web.WebView2.Core; -using System.Collections.Generic; using System.Linq; -using System.Runtime.InteropServices; -using Windows.Win32; -using Windows.Win32.UI.Input.KeyboardAndMouse; namespace Edge { @@ -19,7 +15,6 @@ public BrowserMenuItems() private void TryCreateNewTab(object sender, RoutedEventArgs e) { MainWindow mainWindow = App.GetWindowForElement(this); - mainWindow.AddHomePage(); } @@ -57,47 +52,6 @@ private void CloseApp(object sender, RoutedEventArgs e) App.mainWindows.ForEach(x => x.Close()); } - private void ScreenClip(object sender, RoutedEventArgs e) - { - WebView2 webView2 = App.GetWebView2(this); - webView2.Focus(FocusState.Programmatic); - - List inputs = - [ - new() - { - type = INPUT_TYPE.INPUT_KEYBOARD, - Anonymous = { ki = { wVk = VIRTUAL_KEY.VK_CONTROL } } - }, - new() - { - type = INPUT_TYPE.INPUT_KEYBOARD, - Anonymous = { ki = { wVk = VIRTUAL_KEY.VK_SHIFT } } - }, - new() - { - type = INPUT_TYPE.INPUT_KEYBOARD, - Anonymous = { ki = { wVk = VIRTUAL_KEY.VK_S } } - }, - new() - { - type = INPUT_TYPE.INPUT_KEYBOARD, - Anonymous = { ki = { wVk = VIRTUAL_KEY.VK_S, dwFlags = KEYBD_EVENT_FLAGS.KEYEVENTF_KEYUP } } - }, - new() - { - type = INPUT_TYPE.INPUT_KEYBOARD, - Anonymous = { ki = { wVk = VIRTUAL_KEY.VK_SHIFT, dwFlags = KEYBD_EVENT_FLAGS.KEYEVENTF_KEYUP } } - }, - new() - { - type = INPUT_TYPE.INPUT_KEYBOARD, - Anonymous = { ki = { wVk = VIRTUAL_KEY.VK_CONTROL, dwFlags = KEYBD_EVENT_FLAGS.KEYEVENTF_KEYUP } } - } - ]; - PInvoke.SendInput(inputs.ToArray(), Marshal.SizeOf()); - } - private void MenuFlyout_Opening(object sender, object e) { var items = (sender as MenuFlyout).Items.ToList()[2..^3]; diff --git a/Controls/WebSearch.xaml.cs b/Controls/WebSearch.xaml.cs index 1910d05..2d55c19 100644 --- a/Controls/WebSearch.xaml.cs +++ b/Controls/WebSearch.xaml.cs @@ -73,7 +73,7 @@ private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTex string lastWord = text.Split(' ')[^1].ToLower(); if (!string.IsNullOrEmpty(lastWord)) { - sender.ItemsSource = App.searchEngine.SearchWords(lastWord); + sender.ItemsSource = App.searchEngine.SearchWords(lastWord).Take(10).ToList(); } } } diff --git a/Edge.csproj b/Edge.csproj index 6b8ce28..30a478e 100644 --- a/Edge.csproj +++ b/Edge.csproj @@ -31,11 +31,11 @@ - + - + - + diff --git a/MainWindow.xaml b/MainWindow.xaml index 0e75b96..70d9ed3 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -14,52 +14,6 @@ HorizontalAlignment="Stretch" AddTabButtonClick="TabViewAddTabButtonClick" PointerPressed="TabViewPointerPressed"> - - - diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 308549b..a8b5819 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -119,7 +119,7 @@ private void OnRestoreClicked(object sender, RoutedEventArgs args) /// private void OnMoveClicked(object sender, RoutedEventArgs args) { - PInvoke.SendMessage((HWND)this.GetWindowHandle(), PInvoke.WM_SYSCOMMAND, 0xF010, 0); + PInvoke.SendMessage(new(this.GetWindowHandle()), PInvoke.WM_SYSCOMMAND, 0xF010, 0); } /// @@ -127,7 +127,7 @@ private void OnMoveClicked(object sender, RoutedEventArgs args) /// private void OnSizeClicked(object sender, RoutedEventArgs args) { - PInvoke.SendMessage((HWND)this.GetWindowHandle(), PInvoke.WM_SYSCOMMAND, 0xF000, 0); + PInvoke.SendMessage(new(this.GetWindowHandle()), PInvoke.WM_SYSCOMMAND, 0xF000, 0); } /// @@ -300,16 +300,6 @@ private void TabViewAddTabButtonClick(TabView sender, object args) AddHomePage(); } - private async void LearnAboutWorkspaces(object sender, RoutedEventArgs e) - { - await Launcher.LaunchUriAsync(new Uri("https://aka.ms/edgeworkspaces/learn-more-msa")); - } - - private void CreateNewWorkspaces(object sender, RoutedEventArgs e) - { - - } - private void TabViewPointerPressed(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) { var properties = e.GetCurrentPoint(null).Properties; diff --git a/NativeMethods.txt b/NativeMethods.txt index b436536..58f51d1 100644 --- a/NativeMethods.txt +++ b/NativeMethods.txt @@ -1,7 +1,6 @@ SetWindowSubclass SendMessage DefSubclassProc -SendInput ScreenToClient GetDpiForWindow diff --git a/Pages/HomePage.xaml b/Pages/HomePage.xaml index fabc35d..7e4a2ff 100644 --- a/Pages/HomePage.xaml +++ b/Pages/HomePage.xaml @@ -7,7 +7,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - + @@ -43,12 +43,6 @@ - - - - - - diff --git a/Pages/HomePage.xaml.cs b/Pages/HomePage.xaml.cs index 6ba2d29..f61946d 100644 --- a/Pages/HomePage.xaml.cs +++ b/Pages/HomePage.xaml.cs @@ -28,7 +28,7 @@ public HomePage() if (App.settings.ShowBackground) { - homeGrid.Background = new ImageBrush() + Background = new ImageBrush() { ImageSource = new BitmapImage() { @@ -78,13 +78,6 @@ private void OpenSuggestWebsite(object sender, ItemClickEventArgs e) mainWindow.AddNewTab(new WebViewPage((e.ClickedItem as WebsiteInfo).Uri)); } - private void OpenWebSite(object sender, RoutedEventArgs e) - { - MainWindow mainWindow = App.GetWindowForElement(this); - Uri uri = ((sender as MenuFlyoutItem).DataContext as WebsiteInfo).Uri; - mainWindow.AddNewTab(new WebViewPage(uri)); - } - private void HideItem(object sender, RoutedEventArgs e) { Info.SuggestWebsiteList.Remove((sender as MenuFlyoutItem).DataContext as WebsiteInfo); diff --git a/Pages/WebViewPage.xaml b/Pages/WebViewPage.xaml index 6925e02..66c14d7 100644 --- a/Pages/WebViewPage.xaml +++ b/Pages/WebViewPage.xaml @@ -26,19 +26,18 @@ + ButtonClicked="UriGoBackRequest" + IsEnabled="{Binding ElementName=EdgeWebViewEngine, Path=CanGoBack, Mode=TwoWay}"/> + ButtonClicked="UriGoForwardRequest" + Visibility="{Binding ElementName=EdgeWebViewEngine, Path=CanGoForward, Mode=TwoWay}"/> x.Uri.Equals(sender.Source)).Any()) { @@ -296,13 +287,11 @@ private void CoreWebView2_NewWindowRequested(CoreWebView2 sender, CoreWebView2Ne private void UriGoBackRequest(object sender, RoutedEventArgs e) { if (EdgeWebViewEngine.CanGoBack) EdgeWebViewEngine.GoBack(); - SetNavigationButtonStatus(); } private void UriGoForwardRequest(object sender, RoutedEventArgs e) { if (EdgeWebViewEngine.CanGoForward) EdgeWebViewEngine.GoForward(); - SetNavigationButtonStatus(); } private void UriRefreshRequest(object sender, RoutedEventArgs e) => EdgeWebViewEngine.Reload(); diff --git a/Utilities.cs b/Utilities.cs index 95fcaf4..a58e30b 100644 --- a/Utilities.cs +++ b/Utilities.cs @@ -1,6 +1,5 @@ using Microsoft.UI; using Microsoft.UI.Composition.SystemBackdrops; -using Microsoft.UI.Windowing; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media; using System; @@ -48,7 +47,6 @@ public static void SetBackdrop(this Window window) public static void SetThemeColor(this Window window) { string appearance = App.settings.Appearance; - window.AppWindow.TitleBar.PreferredTheme = Enum.Parse(appearance); if (window.Content is FrameworkElement rootElement) { rootElement.RequestedTheme = Enum.Parse(appearance);