Skip to content

Commit

Permalink
[controller] 終了時にニコニコのログアウト処理をするように
Browse files Browse the repository at this point in the history
  • Loading branch information
silane committed Mar 1, 2021
1 parent 2ca74a6 commit 2e85810
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions TVTComment/Model/ChatService/NiconicoChatService.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ObservableUtils;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Threading.Tasks;

namespace TVTComment.Model.ChatService
Expand Down Expand Up @@ -94,6 +94,20 @@ public async Task SetUser(string userId, string userPassword)
this.loginSession.Value = tmpSession;
}

public void Dispose(){ }
public void Dispose()
{
if(this.loginSession.Value?.IsLoggedin ?? false)
{
try
{
this.loginSession.Value.Logout().Wait();
}
catch (AggregateException e) when (e.InnerExceptions.All(
x => x is NiconicoUtils.NiconicoLoginSessionException
))
{
}
}
}
}
}

0 comments on commit 2e85810

Please sign in to comment.