forked from AgoraIO/Agora-Chat-API-Examples
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainWindow.xaml.cs
94 lines (80 loc) · 2.2 KB
/
MainWindow.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
using System;
using System.Collections.Generic;
using System.Windows;
namespace windows_example
{
/// <summary>
/// MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private readonly System.Windows.Threading.Dispatcher Dip = null;
public MainWindow()
{
InitializeComponent();
Closed += CloseWindow;
Dip = System.Windows.Threading.Dispatcher.CurrentDispatcher;
InitSDK();
AddChatDelegate();
}
// Initialize chat sdk.
private void InitSDK()
{
//TODO:
}
// add chat delegate
private void AddChatDelegate()
{
//TODO:
}
// remove chat delegate
private void RemoveChatDelegate()
{
//TODO:
}
// close window event
private void CloseWindow(object sender, EventArgs e)
{
RemoveChatDelegate();
}
// sign in btn click
private void SignIn_Click(object sender, RoutedEventArgs e)
{
if (UserIdTextBox.Text.Length == 0 || AgoraTokenBox.Text.Length == 0)
{
AddLogToLogText("username or password is null");
return;
}
// TODO:
}
// sign out btn click
private void SignOut_Click(object sender, RoutedEventArgs e)
{
// TODO:
}
// send btn click
private void SendBtn_Click(object sender, RoutedEventArgs e)
{
if (SingleChatIdTextBox.Text.Length == 0)
{
AddLogToLogText("single chat id is null");
return;
}
if (MessageContentTextBox.Text.Length == 0)
{
AddLogToLogText("message content is null !");
return;
}
// TODO:
}
// add log to log text
private void AddLogToLogText(string log)
{
Dip.InvokeAsync(() =>
{
LogTextBox.Text += DateTime.Now + ": " + log + "\n";
LogTextBox.ScrollToEnd();
});
}
}
}