add buttons

This commit is contained in:
jianxin committed 2024-01-05 01:06:53 +08:00
1 parent 589ed7a249
commit b207468416
31 files changed
+213 -1074

No files matched your search

+34 -38
View File
@@ -6,24 +6,8 @@ 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,
@@ -42,27 +26,39 @@ namespace SAPRecorderApp
Activated += MainWindow_Activated;
this.AppWindow.MoveAndResize(new Windows.Graphics.RectInt32(1600, 100, 500, 1000));
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 = 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 myButton_Click(object sender, RoutedEventArgs e)
private void RecordButton_Click(object sender, RoutedEventArgs e)
{
if (myButton.Content == "Recording")
{
myButton.Content = "Record";
}
else
{
myButton.Content = "Recording";
}
}
private void CopyButton_Click(object sender, RoutedEventArgs e)
{
//Clipboard.SetContent(recordTextBox.Text);
}
private void ClearButton_Click(object sender, RoutedEventArgs e)
{
recordTextBox.Text = "";
}
@@ -72,7 +68,7 @@ namespace SAPRecorderApp
// 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);
@@ -97,11 +93,11 @@ namespace SAPRecorderApp
//}
}
private AppWindow GetAppWindowForCurrentWindow()
{
IntPtr hWnd = WindowNative.GetWindowHandle(this);
WindowId wndId = Win32Interop.GetWindowIdFromWindow(hWnd);
return AppWindow.GetFromWindowId(wndId);
}
//private AppWindow GetAppWindowForCurrentWindow()
//{
// IntPtr hWnd = WindowNative.GetWindowHandle(this);
// WindowId wndId = Win32Interop.GetWindowIdFromWindow(hWnd);
// return AppWindow.GetFromWindowId(wndId);
//}
}
}