From 2e85810cb0b261e598c11233bc196a06cdae67c9 Mon Sep 17 00:00:00 2001 From: silane <18604696+silane@users.noreply.github.com> Date: Mon, 1 Mar 2021 11:00:05 +0900 Subject: [PATCH] =?UTF-8?q?[controller]=20=E7=B5=82=E4=BA=86=E6=99=82?= =?UTF-8?q?=E3=81=AB=E3=83=8B=E3=82=B3=E3=83=8B=E3=82=B3=E3=81=AE=E3=83=AD?= =?UTF-8?q?=E3=82=B0=E3=82=A2=E3=82=A6=E3=83=88=E5=87=A6=E7=90=86=E3=82=92?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Model/ChatService/NiconicoChatService.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/TVTComment/Model/ChatService/NiconicoChatService.cs b/TVTComment/Model/ChatService/NiconicoChatService.cs index 83b33ac..e1e5e6c 100644 --- a/TVTComment/Model/ChatService/NiconicoChatService.cs +++ b/TVTComment/Model/ChatService/NiconicoChatService.cs @@ -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 @@ -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 + )) + { + } + } + } } }