-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScriptViewer.xaml.cs
71 lines (61 loc) · 1.98 KB
/
ScriptViewer.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
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Input;
using ScriptCommander.Annotations;
using ScriptCommander.Core;
namespace ScriptCommander
{
/// <summary>
/// Interaction logic for ScriptViewer.xaml
/// </summary>
public partial class ScriptViewer
{
public event PropertyChangedEventHandler PropertyChanged;
public static readonly DependencyProperty ApiProperty =
DependencyProperty.Register("Api", typeof (Api), typeof (ScriptViewer), new PropertyMetadata(default(Api)));
public Api Api
{
get { return (Api) GetValue(ApiProperty); }
set { SetValue(ApiProperty, value); }
}
public ScriptViewer()
{
InitializeComponent();
}
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
var cmd = UiTxtRun.Text;
Api.Console.Write(cmd + Environment.NewLine);
if (UiScriptList.SelectedIndex < UiScriptList.Items.Count - 1)
{
UiScriptList.SelectedIndex++;
var nextCmd = (string)UiScriptList.SelectedItem;
if (nextCmd.StartsWith("#"))
{
//# wait 1s
//# wait "ok"
}
}
}
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
private void UiTxtRun_OnKeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
ButtonBase_OnClick(sender, null);
}
}
}
}