-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHistoryWindow.xaml.cs
More file actions
98 lines (86 loc) · 3.07 KB
/
Copy pathHistoryWindow.xaml.cs
File metadata and controls
98 lines (86 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System.Text;
using System.Windows;
namespace PrimeDictate;
internal partial class HistoryWindow : Window
{
internal HistoryWindow(TranscriptionHistoryViewModel viewModel)
{
InitializeComponent();
this.DataContext = viewModel;
this.Loaded += (_, _) => this.SearchTextBox.Focus();
}
private void OnCopyTranscriptClick(object sender, RoutedEventArgs e)
{
if (this.DataContext is not TranscriptionHistoryViewModel { SelectedEntry: { } entry })
{
System.Windows.MessageBox.Show(
this,
"Select a transcript first, then copy.",
"Nothing selected",
MessageBoxButton.OK,
MessageBoxImage.Information);
return;
}
System.Windows.Clipboard.SetText(entry.Transcript);
}
private void OnCopyDetailsClick(object sender, RoutedEventArgs e)
{
if (this.DataContext is not TranscriptionHistoryViewModel { SelectedEntry: { } entry })
{
System.Windows.MessageBox.Show(
this,
"Select a transcript first, then copy.",
"Nothing selected",
MessageBoxButton.OK,
MessageBoxImage.Information);
return;
}
var sb = new StringBuilder();
sb.AppendLine($"Timestamp (UTC): {entry.TimestampUtc:O}");
sb.AppendLine($"Thread: {entry.ThreadId}");
sb.AppendLine($"Delivery: {entry.DeliveryStatusDisplay}");
sb.AppendLine($"Target app: {entry.TargetAppDisplayName}");
sb.AppendLine($"Target window: {entry.TargetWindowDisplayName}");
sb.AppendLine($"Audio seconds: {entry.AudioDurationSeconds:N1}");
if (!string.IsNullOrWhiteSpace(entry.Error))
{
sb.AppendLine($"Error: {entry.Error}");
}
if (!string.IsNullOrWhiteSpace(entry.OriginalTranscript))
{
sb.AppendLine();
sb.AppendLine("Original Transcript:");
sb.AppendLine(entry.OriginalTranscript);
sb.AppendLine();
sb.AppendLine("Ollama System Prompt:");
sb.AppendLine(entry.OllamaSystemPrompt);
sb.AppendLine();
sb.AppendLine("Final Injected Transcript:");
}
sb.AppendLine();
sb.AppendLine(entry.Transcript);
System.Windows.Clipboard.SetText(sb.ToString());
}
private void OnClearRetrievalClick(object sender, RoutedEventArgs e)
{
if (this.DataContext is TranscriptionHistoryViewModel viewModel)
{
viewModel.ClearRetrievalFilters();
}
}
private void OnTitleBarMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (e.ButtonState == System.Windows.Input.MouseButtonState.Pressed)
{
this.DragMove();
}
}
private void OnMinimizeClick(object sender, RoutedEventArgs e)
{
this.WindowState = WindowState.Minimized;
}
private void OnCloseClick(object sender, RoutedEventArgs e)
{
this.Close();
}
}