markus / Makrus_API_Test / MainWindow.xaml.cs @ master
이력 | 보기 | 이력해설 | 다운로드 (3.01 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
using System.Threading.Tasks; |
6 |
using System.Windows; |
7 |
using System.Windows.Controls; |
8 |
using System.Windows.Data; |
9 |
using System.Windows.Documents; |
10 |
using System.Windows.Input; |
11 |
using System.Windows.Media; |
12 |
using System.Windows.Media.Imaging; |
13 |
using System.Windows.Navigation; |
14 |
using System.Windows.Shapes; |
15 |
using System.Windows.Threading; |
16 |
|
17 |
namespace Makrus_API_Test |
18 |
{ |
19 |
/// <summary> |
20 |
/// MainWindow.xaml에 대한 상호 작용 논리 |
21 |
/// </summary> |
22 |
public partial class MainWindow : Window |
23 |
{ |
24 |
public MainWindow() |
25 |
{ |
26 |
InitializeComponent(); |
27 |
} |
28 |
|
29 |
private void Button_Click(object sender, RoutedEventArgs e) |
30 |
{ |
31 |
try |
32 |
{ |
33 |
var license = new License.Validator.Valid("http://localhost:44301/License"); |
34 |
//var license = new License.Validator.Valid("http://192.168.0.67:8921"); |
35 |
license.ValidateError += License_ValidateError; |
36 |
|
37 |
license.GetLicense("public.xml"); |
38 |
license.Activate(); |
39 |
|
40 |
MessageBox.Show("Actvive"); |
41 |
} |
42 |
catch (Exception ex) |
43 |
{ |
44 |
MessageBox.Show("License Validate Error"); |
45 |
} |
46 |
} |
47 |
|
48 |
private void License_ValidateError(object sender, License.Validator.ValidateErrorArgs e) |
49 |
{ |
50 |
e.Received = false; |
51 |
} |
52 |
|
53 |
private void database_Click(object sender, RoutedEventArgs e) |
54 |
{ |
55 |
for (int i = 0; i < 10; i++) |
56 |
{ |
57 |
DispatcherTimer timer = new DispatcherTimer(); |
58 |
timer.Interval = new TimeSpan(0, 0, 0, 0, 50); |
59 |
timer.Tick += (snd, evt) => |
60 |
{ |
61 |
License.DB.DataBase db = new License.DB.DataBase(); |
62 |
db.Active($"Timer {(snd as DispatcherTimer).Tag.ToString()}{Guid.NewGuid().ToString()}", Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); |
63 |
}; |
64 |
|
65 |
timer.Tag = i.ToString(); |
66 |
timer.Start(); |
67 |
} |
68 |
|
69 |
} |
70 |
|
71 |
private void license_Click(object sender, RoutedEventArgs e) |
72 |
{ |
73 |
for (int i = 0; i < 10; i++) |
74 |
{ |
75 |
DispatcherTimer timer = new DispatcherTimer(); |
76 |
timer.Interval = new TimeSpan(0, 0, 0, 0, 50); |
77 |
timer.Tick += (snd, evt) => |
78 |
{ |
79 |
var license = new License.Validator.Valid("http://localhost:51087"); |
80 |
//var license = new License.Validator.Valid("http://192.168.0.67:8921"); |
81 |
|
82 |
license.GetLicense("public.xml"); |
83 |
|
84 |
if (license.Activate()) |
85 |
{ |
86 |
System.Diagnostics.Debug.WriteLine($"Timer:{(snd as DispatcherTimer).Tag.ToString()} Active : {license.Name}"); |
87 |
} |
88 |
}; |
89 |
|
90 |
timer.Tag = i.ToString(); |
91 |
timer.Start(); |
92 |
} |
93 |
} |
94 |
} |
95 |
} |