using Microsoft.UI; using Microsoft.UI.Windowing; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; using Microsoft.UI.Xaml.Data; using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media; using Windows.ApplicationModel; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. namespace SAPRecorderApp { /// /// An empty window that can be used on its own or navigated to within a Frame. /// public sealed partial class MainWindow : Window { public MainWindow() { this.InitializeComponent(); Activated += MainWindow_Activated; this.AppWindow.MoveAndResize(new Windows.Graphics.RectInt32(1600, 100, 600, 1000)); //var m_AppWindow = GetAppWindowForCurrentWindow(); //var titleBar = m_AppWindow.TitleBar; //// Hide system title bar. //titleBar.ExtendsContentIntoTitleBar = true; var m_AppWindow = this.AppWindow; ExtendsContentIntoTitleBar = true; if (ExtendsContentIntoTitleBar == true) { m_AppWindow.TitleBar.PreferredHeightOption = TitleBarHeightOption.Tall; } TitleBarTextBlock.Text = AppInfo.Current.DisplayInfo.DisplayName; SystemBackdrop = new DesktopAcrylicBackdrop(); } private void RecordButton_Click(object sender, RoutedEventArgs e) { } private void CopyButton_Click(object sender, RoutedEventArgs e) { //Clipboard.SetContent(recordTextBox.Text); } private void ClearButton_Click(object sender, RoutedEventArgs e) { recordTextBox.Text = ""; } //private async Task SizeWindow(AppWindow appWindow) //{ // var displayList = await DeviceInformation.FindAllAsync(DisplayMonitor.GetDeviceSelector()); // if (!displayList.Any()) return; // var monitorInfo = await DisplayMonitor.FromIdAsync(displayList[0].Id); // var winSize = new SizeInt32(); // winSize.Height = Convert.ToInt32(monitorInfo.NativeResolutionInRawPixels.Height / 10); // winSize.Width = Convert.ToInt32(monitorInfo.NativeResolutionInRawPixels.Width / 10); // AppWindow.Move(new PointInt32(Convert.ToInt32(monitorInfo.NativeResolutionInRawPixels.Height / 5),10)); // //appWindow.ResizeClient(winSize); //} private void MainWindow_Activated(object sender, WindowActivatedEventArgs args) { //if (args.WindowActivationState == WindowActivationState.Deactivated) //{ // TitleBarTextBlock.Foreground = // (SolidColorBrush)App.Current.Resources["WindowCaptionForegroundDisabled"]; //} //else //{ // TitleBarTextBlock.Foreground = // (SolidColorBrush)App.Current.Resources["WindowCaptionForeground"]; //} } //private AppWindow GetAppWindowForCurrentWindow() //{ // IntPtr hWnd = WindowNative.GetWindowHandle(this); // WindowId wndId = Win32Interop.GetWindowIdFromWindow(hWnd); // return AppWindow.GetFromWindowId(wndId); //} } }