forked from openbullet/openbullet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogWindow.xaml.cs
64 lines (56 loc) · 1.8 KB
/
LogWindow.xaml.cs
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
using RuriLib;
using System;
using System.Windows;
using System.Windows.Input;
namespace OpenBullet
{
/// <summary>
/// Logica di interazione per Log.xaml
/// </summary>
public partial class LogWindow : Window
{
public LogWindow()
{
InitializeComponent();
DataContext = Globals.log;
Closing += LogWindowClosing;
}
private void LogWindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
Globals.logWindow = null;
}
private void copyClick(object sender, RoutedEventArgs e)
{
var clipboardText = "";
foreach (LogEntry selected in logListView.SelectedItems)
{
clipboardText += $"[{selected.LogTime}] ({selected.LogLevel}) {selected.LogComponent} - "+ selected.LogString + Environment.NewLine;
}
Clipboard.SetText(clipboardText);
}
private void copyAllButton_Click(object sender, RoutedEventArgs e)
{
var clipboardText = "";
foreach (LogEntry selected in logListView.Items)
{
clipboardText += $"[{selected.LogTime}] ({selected.LogLevel}) {selected.LogComponent} - " + selected.LogString + Environment.NewLine;
}
Clipboard.SetText(clipboardText);
}
private void ListViewItem_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
}
private void clearButton_Click(object sender, RoutedEventArgs e)
{
try
{
Globals.log.List.Clear();
}
catch { }
}
private void searchButton_Click(object sender, RoutedEventArgs e)
{
Globals.log.Refresh();
}
}
}