public async void CloseSessionAsync(bool sendCopy) { if (Connectivity.NetworkAccess != NetworkAccess.Internet) { NoInternetAlert(); return; } int res = await manager.CloseSession(chat.SessionID); switch (res) { case -1: //session already closed view.notify("session closed"); break; case -2: //The server returned object different from integer... view.notify("closing error", "Internal server error"); break; case -3: //The chat manager threw an exception... view.notify("closing error", "Application error... Check internet connection."); break; default: if (sendCopy) { SendChatCopy(); } view.notify("session closed"); break; } }