oneRain 2020-04-30 16:22:04 +08:00
parent 65183c63bf
commit 1e4732a5a5
1 changed files with 56 additions and 1 deletions

View File

@ -45,7 +45,7 @@ LCLogger.LogDelegate += (level, info) => {
}
```
## 用法
## 数据存储
### 对象
@ -55,6 +55,8 @@ obj["intValue"] = 123;
await obj.Save();
```
更多关于**对象**用法:[参考](https://github.com/leancloud/csharp-sdk/blob/master/Storage/Storage.Test/ObjectTest.cs)
### 查询
```csharp
@ -63,6 +65,8 @@ query.Limit(2);
List<LCObject> list = await query.Find();
```
更多关于**查询**用法:[参考](https://github.com/leancloud/csharp-sdk/blob/master/Storage/Storage.Test/QueryTest.cs)
### 文件
```csharp
@ -72,16 +76,67 @@ await file.Save((count, total) => {
});
```
更多关于**文件**用法:[参考](https://github.com/leancloud/csharp-sdk/blob/master/Storage/Storage.Test/FileTest.cs)
### 用户
```csharp
await LCUser.Login("hello", "world");
```
更多关于**用户**用法:[参考](https://github.com/leancloud/csharp-sdk/blob/master/Storage/Storage.Test/UserTest.cs)
### GeoPoint
```csharp
LCGeoPoint p1 = new LCGeoPoint(20.0059, 110.3665);
```
更多关于 **GeoPoint** 用法:[参考](https://github.com/leancloud/csharp-sdk/blob/master/Storage/Storage.Test/GeoTest.cs)
## 即时通讯
### 用户
```csharp
LCIMClient client = new LCIMClient("c1");
// 登录
await client.Open();
// 注销
await client.Close();
```
更多关于**用户**用法:[参考](https://github.com/leancloud/csharp-sdk/blob/master/Realtime/Realtime.Test/Client.cs)
### 对话
```csharp
// 创建普通对话
LCIMConversation conversation = await client.CreateConversation(new string[] { "world" }, name: name, unique: false);
// 创建聊天室
LCIMConversation chatroom = await client.CreateChatRoom(name);
// 创建临时对话
LCIMConversation tempConversation = await client.CreateTemporaryConversation(new string[] { "world" });
```
更多关于**对话**用法:[参考](https://github.com/leancloud/csharp-sdk/blob/master/Realtime/Realtime.Test/Conversation.cs)
### 消息
```csharp
// 发送消息
LCIMTextMessage textMessage = new LCIMTextMessage("hello, world");
await conversation.Send(textMessage);
// 接收消息
m2.OnMessage = (conv, msg) => {
if (msg is LCIMTextMessage textMsg) {
WriteLine($"text: {textMsg.Text}");
}
};
```
更多关于**对话**用法:[参考](https://github.com/leancloud/csharp-sdk/blob/master/Realtime/Realtime.Test/Message.cs)
## 文档
[API 文档](https://leancloud.github.io/csharp-sdk/html/index.html)