-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTranslateResult.xaml.cs
105 lines (84 loc) · 2.87 KB
/
TranslateResult.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
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
99
100
101
102
103
104
105
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
namespace CopyPlusPlus
{
/// <summary>
/// Interaction logic for TranslateResult.xaml
/// </summary>
public partial class TranslateResult
{
public static RoutedCommand EscEvent = new RoutedCommand();
//private static Timer _fadeTimer;
//private static Timer _stayTimer;
////Get MainWindow
//private readonly MainWindow _mainWindow = Application.Current.Windows
// .Cast<Window>()
// .FirstOrDefault(window => window is MainWindow) as MainWindow;
//private double _opacity = 1;
public TranslateResult()
{
InitializeComponent();
EscEvent.InputGestures.Add(new KeyGesture(Key.Escape));
//// Create a timer
//_stayTimer = new Timer(2000);
//// Hook up the Elapsed event for the timer.
//_stayTimer.Elapsed += OnStayTimedEvent;
//// Create a timer
//_fadeTimer = new Timer(100);
//// Hook up the Elapsed event for the timer.
//_fadeTimer.Elapsed += OnFadeTimedEvent;
//_fadeTimer.AutoReset = true;
//Stay();
}
private void EscExecuted(object sender, ExecutedRoutedEventArgs e)
{
Close();
}
private void PinSwitch(object sender, RoutedEventArgs e)
{
Topmost = !Topmost;
var converter = new BrushConverter();
Pin.Background = Pin.Background.ToString() == "#FFFFFEFF"
? (Brush)converter.ConvertFromString("#00F6F2F2")
: (Brush)converter.ConvertFromString("#FFFFFEFF");
}
//private static void Stay()
//{
// _stayTimer.Start();
//}
//private static void OnStayTimedEvent(object source, ElapsedEventArgs e)
//{
// Fade();
// _stayTimer.Stop();
//}
//private static void Fade()
//{
// _fadeTimer.Start();
//}
//private void OnFadeTimedEvent(object source, ElapsedEventArgs e)
//{
// _opacity -= 0.04;
// if (_opacity == 0) Close();
// Dispatcher.Invoke(delegate { Opacity = _opacity; });
//}
//private void OnMouseEnter(object sender, MouseEventArgs e)
//{
// Dispatcher.Invoke(delegate { Opacity = 1; });
// _stayTimer.Stop();
// _fadeTimer.Stop();
// _opacity = 1;
//}
//private void OnMouseLeave(object sender, MouseEventArgs e)
//{
// Stay();
//}
//private void OnClosed(object sender, EventArgs e)
//{
// _fadeTimer.Stop();
// _fadeTimer.Dispose();
// _stayTimer.Stop();
// _stayTimer.Dispose();
//}
}
}