blob: 3c608a5189deae9d17ae868792ea68a613f35285 (
plain)
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
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Tango.PPC.Browser.Attributes;
using Tango.PPC.Browser.Views;
using Tango.PPC.Common.Helpers;
using Tango.Touch.Keyboard;
namespace Tango.PPC.Browser.BoundsObjects
{
[BoundObject("keyboard", "keyboard.js")]
public class KeyboardHandler
{
private DateTime _lastTime;
public KeyboardHandler()
{
_lastTime = DateTime.Now;
}
public void openKeyboard(String inputType)
{
if (DateTime.Now > _lastTime.AddMilliseconds(1000))
{
_lastTime = DateTime.Now;
Application.Current.Dispatcher.BeginInvoke(new Action(async () =>
{
switch (inputType)
{
case "search":
KeyboardHelper.OpenKeyboard(KeyboardActionKeyMode.Go);
break;
default:
KeyboardHelper.OpenKeyboard(KeyboardActionKeyMode.Next);
break;
}
await Task.Delay(50);
BrowserView.Instance.btnGo.Focus();
await Task.Delay(50);
BrowserView.Instance.Browser.Focus();
Debug.WriteLine("Focus");
}));
}
}
public void closeKeyboard()
{
if (DateTime.Now > _lastTime.AddMilliseconds(1000))
{
_lastTime = DateTime.Now;
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
KeyboardHelper.CloseKeyboard();
}));
}
}
}
}
|