* csharp-sdk.sln:

* Program.cs:
* RealtimeApp.csproj:

* SingleThreadSynchronizationContext.cs: chore: rtm 测试 app
oneRain 2020-04-30 13:35:34 +08:00
parent 08449aea6b
commit ea09941439
4 changed files with 43 additions and 1 deletions

View File

@ -1,9 +1,39 @@
using System;
using LeanCloud;
using LeanCloud.Realtime;
using static System.Console;
namespace RealtimeApp {
class Program {
static void Main(string[] args) {
Console.WriteLine("Hello World!");
SingleThreadSynchronizationContext.Run(async () => {
LCLogger.LogDelegate += Print;
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
LCIMClient client = new LCIMClient("lean");
await client.Open();
//await client.Close();
});
}
static void Print(LCLogLevel level, string info) {
switch (level) {
case LCLogLevel.Debug:
WriteLine($"[DEBUG] {DateTime.Now} {info}\n");
break;
case LCLogLevel.Warn:
WriteLine($"[WARNING] {DateTime.Now} {info}\n");
break;
case LCLogLevel.Error:
WriteLine($"[ERROR] {DateTime.Now} {info}\n");
break;
default:
WriteLine(info);
break;
}
}
}
}

View File

@ -5,4 +5,9 @@
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Common\Common.csproj" />
<ProjectReference Include="..\..\Realtime\Realtime.csproj" />
<ProjectReference Include="..\..\Storage\Storage.csproj" />
</ItemGroup>
</Project>

View File

@ -4,7 +4,7 @@ using System.Threading.Tasks;
using System.Collections.Concurrent;
using System.Collections.Generic;
namespace LeanCloud.Common {
namespace RealtimeApp {
/// <summary>
/// 单线程环境,用于控制台应用 await 返回
/// </summary>

View File

@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Realtime", "Realtime\Realti
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Realtime.Test", "Test\Realtime.Test\Realtime.Test.csproj", "{746B0DE6-C504-4568-BA6D-4A08A91A5E35}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealtimeApp", "Test\RealtimeApp\RealtimeApp.csproj", "{4CB5E8C3-B1FC-45C3-B882-A9A43DFC6B1C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -39,10 +41,15 @@ Global
{746B0DE6-C504-4568-BA6D-4A08A91A5E35}.Debug|Any CPU.Build.0 = Debug|Any CPU
{746B0DE6-C504-4568-BA6D-4A08A91A5E35}.Release|Any CPU.ActiveCfg = Release|Any CPU
{746B0DE6-C504-4568-BA6D-4A08A91A5E35}.Release|Any CPU.Build.0 = Release|Any CPU
{4CB5E8C3-B1FC-45C3-B882-A9A43DFC6B1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4CB5E8C3-B1FC-45C3-B882-A9A43DFC6B1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4CB5E8C3-B1FC-45C3-B882-A9A43DFC6B1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4CB5E8C3-B1FC-45C3-B882-A9A43DFC6B1C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{531F8181-FFE0-476E-9D0A-93F13CAD1183} = {C827DA2F-6AB4-48D8-AB5B-6DAB925F8933}
{746B0DE6-C504-4568-BA6D-4A08A91A5E35} = {C827DA2F-6AB4-48D8-AB5B-6DAB925F8933}
{4CB5E8C3-B1FC-45C3-B882-A9A43DFC6B1C} = {C827DA2F-6AB4-48D8-AB5B-6DAB925F8933}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
version = 0.1.0