This commit is contained in:
jianxin committed 2024-01-05 15:10:10 +08:00
1 parent b207468416
commit 3a0976680e
51 files changed
+227 -1781

No files matched your search

+62
View File
@@ -6,7 +6,11 @@ using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using System.Threading;
using Windows.ApplicationModel;
using System.Collections;
using System.Threading.Tasks;
using System.Collections.Concurrent;
@@ -18,8 +22,10 @@ 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();
@@ -44,10 +50,60 @@ namespace SAPRecorderApp
SystemBackdrop = new DesktopAcrylicBackdrop();
Task.Run(() =>
{
foreach (var item in Globals.recordTextQueue.GetConsumingEnumerable())
{
SetTextBox(item + "\n");
}
});
}
private void SetTextBox(string text)
{
this.DispatcherQueue.TryEnqueue(() =>
{
this.recordTextBox.Text += text;
});
}
private void RecordButton_Click(object sender, RoutedEventArgs e)
{
var sapGui = new SapGui();
sapGui.textBox = recordTextBox;
sapGui.Session.Record = true;
if (recordButton.Content == "Record")
{
if (sapGui.Session != null)
{
recordButton.Content = "Stop";
recordInfoBar.IsOpen = false;
recordInfoBar.Message = "";
recordInfoBar.Title = "";
recordInfoBar.Severity = InfoBarSeverity.Informational;
sapGui.BeginRecord();
recordProgressBar.IsIndeterminate = true;
}
else
{
recordInfoBar.IsOpen = true;
recordInfoBar.Message = "Please login SAP First";
recordInfoBar.Title = "";
recordInfoBar.Severity = InfoBarSeverity.Warning;
}
}
else
{
recordButton.Content = "Record";
recordButtonIcon.Glyph = "\uE7C8";
recordProgressBar.IsIndeterminate = false;
}
}
private void CopyButton_Click(object sender, RoutedEventArgs e)
@@ -100,4 +156,10 @@ namespace SAPRecorderApp
// return AppWindow.GetFromWindowId(wndId);
//}
}
public static class Globals
{
//public static Queue recordTextQueue = new Queue();
public static BlockingCollection<string> recordTextQueue = new BlockingCollection<string>();
}
}