init
This commit is contained in:
commit
589ed7a249
62 files changed
+3157
No files matched your search
@@ -0,0 +1,107 @@
|
||||
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 Microsoft.UI.Xaml.Navigation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Display;
|
||||
using Windows.Devices.Enumeration;
|
||||
using Windows.Graphics;
|
||||
using WinRT.Interop;
|
||||
|
||||
using Windows.ApplicationModel;
|
||||
using Rect = Windows.Foundation.Rect;
|
||||
|
||||
using Microsoft.UI; // Needed for WindowId.
|
||||
using Microsoft.UI.Windowing; // Needed for AppWindow.
|
||||
using WinRT.Interop;
|
||||
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
|
||||
namespace SAPRecorderApp
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty window that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
Activated += MainWindow_Activated;
|
||||
|
||||
this.AppWindow.MoveAndResize(new Windows.Graphics.RectInt32(1600, 100, 500, 1000));
|
||||
|
||||
|
||||
var m_AppWindow = GetAppWindowForCurrentWindow();
|
||||
var titleBar = m_AppWindow.TitleBar;
|
||||
// Hide system title bar.
|
||||
titleBar.ExtendsContentIntoTitleBar = true;
|
||||
|
||||
}
|
||||
|
||||
private void myButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (myButton.Content == "Recording")
|
||||
{
|
||||
myButton.Content = "Record";
|
||||
}
|
||||
else
|
||||
{
|
||||
myButton.Content = "Recording";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user