private void PermissionsComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox combobox = (ComboBox)sender; PreMadeChatCommand command = (PreMadeChatCommand)combobox.DataContext; command.Requirements.Role.MixerRole = EnumHelper.GetEnumValueFromString <MixerRoleEnum>((string)combobox.SelectedItem); this.UpdateSetting(); }
public void Initialize(LoadingWindowBase window, PreMadeChatCommand command) { this.window = window; this.DataContext = this.command = command; this.PermissionsComboBox.SelectedItem = this.command.PermissionsString; this.setting = ChannelSession.Settings.PreMadeChatCommandSettings.FirstOrDefault(c => c.Name.Equals(this.command.Name)); if (this.setting == null) { this.setting = new PreMadeChatCommandSettings(this.command); ChannelSession.Settings.PreMadeChatCommandSettings.Add(this.setting); } }
public void Initialize(LoadingWindowBase window, PreMadeChatCommand command) { this.window = window; this.DataContext = this.command = command; this.PermissionsComboBox.SelectedItem = this.command.UserRoleRequirementString; this.CooldownTextBox.Text = this.command.Requirements.Cooldown.Amount.ToString(); this.setting = ChannelSession.Settings.PreMadeChatCommandSettings.FirstOrDefault(c => c.Name.Equals(this.command.Name)); if (this.setting == null) { this.setting = new PreMadeChatCommandSettings(this.command); ChannelSession.Settings.PreMadeChatCommandSettings.Add(this.setting); } }
private void CooldownTextBox_LostFocus(object sender, RoutedEventArgs e) { TextBox textbox = (TextBox)sender; PreMadeChatCommand command = (PreMadeChatCommand)textbox.DataContext; int cooldown = 0; if (!string.IsNullOrEmpty(textbox.Text) && int.TryParse(textbox.Text, out cooldown)) { cooldown = Math.Max(cooldown, 0); } command.Requirements.Cooldown.Amount = cooldown; textbox.Text = command.Requirements.Cooldown.Amount.ToString(); this.UpdateSetting(); }
public PreMadeChatCommandControlViewModel(PreMadeChatCommand command) { this.command = command; this.setting = ChannelSession.Settings.PreMadeChatCommandSettings.FirstOrDefault(c => c.Name.Equals(this.command.Name)); if (this.setting == null) { this.setting = new PreMadeChatCommandSettings(this.command); ChannelSession.Settings.PreMadeChatCommandSettings.Add(this.setting); } this.TestCommand = this.CreateCommand(async(parameter) => { UserViewModel currentUser = await ChannelSession.GetCurrentUser(); await command.Perform(currentUser, new List <string>() { "@" + currentUser.UserName }); }); }
protected override async Task <bool> ConnectInternal() { if (ChannelSession.Connection != null) { this.backgroundThreadCancellationTokenSource = new CancellationTokenSource(); this.Client = await this.ConnectAndAuthenticateChatClient(ChannelSession.Connection); return(await this.RunAsync(async() => { if (this.Client != null) { this.Client.OnClearMessagesOccurred += ChatClient_OnClearMessagesOccurred; this.Client.OnDeleteMessageOccurred += ChatClient_OnDeleteMessageOccurred; this.Client.OnMessageOccurred += ChatClient_OnMessageOccurred; this.Client.OnPollEndOccurred += ChatClient_OnPollEndOccurred; this.Client.OnPollStartOccurred += ChatClient_OnPollStartOccurred; this.Client.OnPurgeMessageOccurred += ChatClient_OnPurgeMessageOccurred; this.Client.OnUserJoinOccurred += ChatClient_OnUserJoinOccurred; this.Client.OnUserLeaveOccurred += ChatClient_OnUserLeaveOccurred; this.Client.OnUserUpdateOccurred += ChatClient_OnUserUpdateOccurred; this.Client.OnSkillAttributionOccurred += Client_OnSkillAttributionOccurred; this.Client.OnDisconnectOccurred += StreamerClient_OnDisconnectOccurred; if (ChannelSession.Settings.DiagnosticLogging) { this.Client.OnPacketSentOccurred += WebSocketClient_OnPacketSentOccurred; this.Client.OnMethodOccurred += WebSocketClient_OnMethodOccurred; this.Client.OnReplyOccurred += WebSocketClient_OnReplyOccurred; this.Client.OnEventOccurred += WebSocketClient_OnEventOccurred; } await ChannelSession.ActiveUsers.AddOrUpdateUsers(await ChannelSession.Connection.GetChatUsers(ChannelSession.Channel, Math.Max(ChannelSession.Channel.viewersCurrent, 1))); if (ChannelSession.IsStreamer) { ChannelSession.PreMadeChatCommands.Clear(); foreach (PreMadeChatCommand command in ReflectionHelper.CreateInstancesOfImplementingType <PreMadeChatCommand>()) { #pragma warning disable CS0612 // Type or member is obsolete if (!(command is ObsoletePreMadeCommand)) { ChannelSession.PreMadeChatCommands.Add(command); } #pragma warning restore CS0612 // Type or member is obsolete } foreach (PreMadeChatCommandSettings commandSetting in ChannelSession.Settings.PreMadeChatCommandSettings) { PreMadeChatCommand command = ChannelSession.PreMadeChatCommands.FirstOrDefault(c => c.Name.Equals(commandSetting.Name)); if (command != null) { command.UpdateFromSettings(commandSetting); } } } #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed Task.Run(async() => { await this.ChannelRefreshBackground(); }, this.backgroundThreadCancellationTokenSource.Token); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed Task.Run(async() => { await this.ChatterJoinLeaveBackground(); }, this.backgroundThreadCancellationTokenSource.Token); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed Task.Run(async() => { await this.ChatterRefreshBackground(); }, this.backgroundThreadCancellationTokenSource.Token); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed return true; } return false; })); } return(false); }
public static async Task <bool> InitializeSession() { try { TwitchNewAPI.Users.UserModel twitchChannelNew = await ChannelSession.TwitchUserConnection.GetNewAPICurrentUser(); TwitchV5API.Channel.ChannelModel twitchChannelv5 = await ChannelSession.TwitchUserConnection.GetCurrentV5APIChannel(); if (twitchChannelNew != null && twitchChannelv5 != null) { try { ChannelSession.TwitchUserNewAPI = twitchChannelNew; ChannelSession.TwitchChannelV5 = twitchChannelv5; ChannelSession.TwitchStreamNewAPI = await ChannelSession.TwitchUserConnection.GetStream(ChannelSession.TwitchUserNewAPI); ChannelSession.TwitchStreamV5 = await ChannelSession.TwitchUserConnection.GetV5LiveStream(ChannelSession.TwitchChannelV5); IEnumerable <TwitchV5API.Users.UserModel> channelEditors = await ChannelSession.TwitchUserConnection.GetV5APIChannelEditors(ChannelSession.TwitchChannelV5); if (channelEditors != null) { foreach (TwitchV5API.Users.UserModel channelEditor in channelEditors) { ChannelSession.TwitchChannelEditorsV5.Add(channelEditor.id); } } if (ChannelSession.Settings == null) { IEnumerable <SettingsV2Model> currentSettings = await ChannelSession.Services.Settings.GetAllSettings(); if (currentSettings.Any(s => !string.IsNullOrEmpty(s.TwitchChannelID) && string.Equals(s.TwitchChannelID, twitchChannelNew.id))) { GlobalEvents.ShowMessageBox($"There already exists settings for the account {twitchChannelNew.display_name}. Please sign in with a different account or re-launch Mix It Up to select those settings from the drop-down."); return(false); } ChannelSession.Settings = await ChannelSession.Services.Settings.Create(twitchChannelNew.display_name, isStreamer : true); } await ChannelSession.Services.Settings.Initialize(ChannelSession.Settings); if (!string.IsNullOrEmpty(ChannelSession.Settings.TwitchUserID) && !string.Equals(ChannelSession.TwitchUserNewAPI.id, ChannelSession.Settings.TwitchUserID)) { Logger.Log(LogLevel.Error, $"Signed in account does not match settings account: {ChannelSession.TwitchUserNewAPI.display_name} - {ChannelSession.TwitchUserNewAPI.id} - {ChannelSession.Settings.TwitchUserID}"); GlobalEvents.ShowMessageBox("The account you are logged in as on Twitch does not match the account for this settings. Please log in as the correct account on Twitch."); ChannelSession.Settings.TwitchUserOAuthToken.accessToken = string.Empty; ChannelSession.Settings.TwitchUserOAuthToken.refreshToken = string.Empty; ChannelSession.Settings.TwitchUserOAuthToken.expiresIn = 0; return(false); } ChannelSession.Settings.Name = ChannelSession.TwitchUserNewAPI.display_name; ChannelSession.Settings.TwitchUserID = ChannelSession.TwitchUserNewAPI.id; ChannelSession.Settings.TwitchChannelID = ChannelSession.TwitchUserNewAPI.id; } catch (Exception ex) { Logger.Log(ex); Logger.Log(LogLevel.Error, "Initialize Settings - " + JSONSerializerHelper.SerializeToString(ex)); await DialogHelper.ShowMessage("Failed to initialize settings. If this continues, please visit the Mix It Up Discord for assistance." + Environment.NewLine + Environment.NewLine + "Error Details: " + ex.Message); return(false); } try { await ChannelSession.Services.Telemetry.Connect(); ChannelSession.Services.Telemetry.SetUserID(ChannelSession.Settings.TelemetryUserID); TwitchChatService twitchChatService = new TwitchChatService(); TwitchEventService twitchEventService = new TwitchEventService(); List <Task <Result> > twitchPlatformServiceTasks = new List <Task <Result> >(); twitchPlatformServiceTasks.Add(twitchChatService.ConnectUser()); twitchPlatformServiceTasks.Add(twitchEventService.Connect()); await Task.WhenAll(twitchPlatformServiceTasks); if (twitchPlatformServiceTasks.Any(c => !c.Result.Success)) { string errors = string.Join(Environment.NewLine, twitchPlatformServiceTasks.Where(c => !c.Result.Success).Select(c => c.Result.Message)); GlobalEvents.ShowMessageBox("Failed to connect to Twitch services:" + Environment.NewLine + Environment.NewLine + errors); return(false); } await ChannelSession.Services.Chat.Initialize(twitchChatService); await ChannelSession.Services.Events.Initialize(twitchEventService); } catch (Exception ex) { Logger.Log(ex); Logger.Log(LogLevel.Error, "Twitch Services - " + JSONSerializerHelper.SerializeToString(ex)); await DialogHelper.ShowMessage("Failed to connect to Twitch services. If this continues, please visit the Mix It Up Discord for assistance." + Environment.NewLine + Environment.NewLine + "Error Details: " + ex.Message); return(false); } if (ChannelSession.IsStreamer) { Result result = await ChannelSession.InitializeBotInternal(); if (!result.Success) { await DialogHelper.ShowMessage("Failed to initialize Bot account"); return(false); } try { // Connect External Services Dictionary <IExternalService, OAuthTokenModel> externalServiceToConnect = new Dictionary <IExternalService, OAuthTokenModel>(); if (ChannelSession.Settings.StreamlabsOAuthToken != null) { externalServiceToConnect[ChannelSession.Services.Streamlabs] = ChannelSession.Settings.StreamlabsOAuthToken; } if (ChannelSession.Settings.StreamElementsOAuthToken != null) { externalServiceToConnect[ChannelSession.Services.StreamElements] = ChannelSession.Settings.StreamElementsOAuthToken; } if (ChannelSession.Settings.StreamJarOAuthToken != null) { externalServiceToConnect[ChannelSession.Services.StreamJar] = ChannelSession.Settings.StreamJarOAuthToken; } if (ChannelSession.Settings.TipeeeStreamOAuthToken != null) { externalServiceToConnect[ChannelSession.Services.TipeeeStream] = ChannelSession.Settings.TipeeeStreamOAuthToken; } if (ChannelSession.Settings.TreatStreamOAuthToken != null) { externalServiceToConnect[ChannelSession.Services.TreatStream] = ChannelSession.Settings.TreatStreamOAuthToken; } if (ChannelSession.Settings.StreamlootsOAuthToken != null) { externalServiceToConnect[ChannelSession.Services.Streamloots] = ChannelSession.Settings.StreamlootsOAuthToken; } if (ChannelSession.Settings.TiltifyOAuthToken != null) { externalServiceToConnect[ChannelSession.Services.Tiltify] = ChannelSession.Settings.TiltifyOAuthToken; } if (ChannelSession.Settings.JustGivingOAuthToken != null) { externalServiceToConnect[ChannelSession.Services.JustGiving] = ChannelSession.Settings.JustGivingOAuthToken; } if (ChannelSession.Settings.IFTTTOAuthToken != null) { externalServiceToConnect[ChannelSession.Services.IFTTT] = ChannelSession.Settings.IFTTTOAuthToken; } if (ChannelSession.Settings.ExtraLifeTeamID > 0) { externalServiceToConnect[ChannelSession.Services.ExtraLife] = new OAuthTokenModel(); } if (ChannelSession.Settings.PatreonOAuthToken != null) { externalServiceToConnect[ChannelSession.Services.Patreon] = ChannelSession.Settings.PatreonOAuthToken; } if (ChannelSession.Settings.DiscordOAuthToken != null) { externalServiceToConnect[ChannelSession.Services.Discord] = ChannelSession.Settings.DiscordOAuthToken; } if (ChannelSession.Settings.TwitterOAuthToken != null) { externalServiceToConnect[ChannelSession.Services.Twitter] = ChannelSession.Settings.TwitterOAuthToken; } if (ChannelSession.Services.OBSStudio.IsEnabled) { externalServiceToConnect[ChannelSession.Services.OBSStudio] = null; } if (ChannelSession.Services.StreamlabsOBS.IsEnabled) { externalServiceToConnect[ChannelSession.Services.StreamlabsOBS] = null; } if (ChannelSession.Services.XSplit.IsEnabled) { externalServiceToConnect[ChannelSession.Services.XSplit] = null; } if (!string.IsNullOrEmpty(ChannelSession.Settings.OvrStreamServerIP)) { externalServiceToConnect[ChannelSession.Services.OvrStream] = null; } if (ChannelSession.Settings.EnableOverlay) { externalServiceToConnect[ChannelSession.Services.Overlay] = null; } if (ChannelSession.Settings.EnableDeveloperAPI) { externalServiceToConnect[ChannelSession.Services.DeveloperAPI] = null; } if (externalServiceToConnect.Count > 0) { Dictionary <IExternalService, Task <Result> > externalServiceTasks = new Dictionary <IExternalService, Task <Result> >(); foreach (var kvp in externalServiceToConnect) { Logger.Log(LogLevel.Debug, "Trying automatic OAuth service connection: " + kvp.Key.Name); try { if (kvp.Key is IOAuthExternalService && kvp.Value != null) { externalServiceTasks[kvp.Key] = ((IOAuthExternalService)kvp.Key).Connect(kvp.Value); } else { externalServiceTasks[kvp.Key] = kvp.Key.Connect(); } } catch (Exception sex) { Logger.Log(LogLevel.Error, "Error in external service initial connection: " + kvp.Key.Name); Logger.Log(sex); } } try { await Task.WhenAll(externalServiceTasks.Values); } catch (Exception sex) { Logger.Log(LogLevel.Error, "Error in batch external service connection"); Logger.Log(sex); } List <IExternalService> failedServices = new List <IExternalService>(); foreach (var kvp in externalServiceTasks) { try { if (kvp.Value.Result != null && !kvp.Value.Result.Success && kvp.Key is IOAuthExternalService) { Logger.Log(LogLevel.Debug, "Automatic OAuth token connection failed, trying manual connection: " + kvp.Key.Name); result = await kvp.Key.Connect(); if (!result.Success) { failedServices.Add(kvp.Key); } } } catch (Exception sex) { Logger.Log(LogLevel.Error, "Error in external service failed re-connection: " + kvp.Key.Name); Logger.Log(sex); failedServices.Add(kvp.Key); } } if (failedServices.Count > 0) { Logger.Log(LogLevel.Debug, "Connection failed for services: " + string.Join(", ", failedServices.Select(s => s.Name))); StringBuilder message = new StringBuilder(); message.AppendLine("The following services could not be connected:"); message.AppendLine(); foreach (IExternalService service in failedServices) { message.AppendLine(" - " + service.Name); } message.AppendLine(); message.Append("Please go to the Services page to reconnect them manually."); await DialogHelper.ShowMessage(message.ToString()); } } } catch (Exception ex) { Logger.Log(ex); Logger.Log(LogLevel.Error, "External Services - " + JSONSerializerHelper.SerializeToString(ex)); await DialogHelper.ShowMessage("Failed to initialize external services. If this continues, please visit the Mix It Up Discord for assistance." + Environment.NewLine + Environment.NewLine + "Error Details: " + ex.Message); return(false); } try { //if (ChannelSession.Settings.RemoteHostConnection != null) //{ // await ChannelSession.Services.RemoteService.InitializeConnection(ChannelSession.Settings.RemoteHostConnection); //} foreach (CurrencyModel currency in ChannelSession.Settings.Currency.Values) { if (currency.ShouldBeReset()) { await currency.Reset(); } } if (ChannelSession.Settings.ModerationResetStrikesOnLaunch) { foreach (UserDataModel userData in ChannelSession.Settings.UserData.Values) { if (userData.ModerationStrikes > 0) { userData.ModerationStrikes = 0; ChannelSession.Settings.UserData.ManualValueChanged(userData.ID); } } } ChannelSession.PreMadeChatCommands.Clear(); foreach (PreMadeChatCommand command in ReflectionHelper.CreateInstancesOfImplementingType <PreMadeChatCommand>()) { #pragma warning disable CS0612 // Type or member is obsolete if (!(command is ObsoletePreMadeCommand)) { ChannelSession.PreMadeChatCommands.Add(command); } #pragma warning restore CS0612 // Type or member is obsolete } foreach (PreMadeChatCommandSettings commandSetting in ChannelSession.Settings.PreMadeChatCommandSettings) { PreMadeChatCommand command = ChannelSession.PreMadeChatCommands.FirstOrDefault(c => c.Name.Equals(commandSetting.Name)); if (command != null) { command.UpdateFromSettings(commandSetting); } } ChannelSession.Services.Chat.RebuildCommandTriggers(); ChannelSession.Services.TimerService.Initialize(); await ChannelSession.Services.Moderation.Initialize(); } catch (Exception ex) { Logger.Log(ex); Logger.Log(LogLevel.Error, "Streamer Services - " + JSONSerializerHelper.SerializeToString(ex)); await DialogHelper.ShowMessage("Failed to initialize streamer-based services. If this continues, please visit the Mix It Up Discord for assistance." + Environment.NewLine + Environment.NewLine + "Error Details: " + ex.Message); return(false); } } try { ChannelSession.Services.Statistics.Initialize(); ChannelSession.Services.InputService.HotKeyPressed += InputService_HotKeyPressed; foreach (RedemptionStoreProductModel product in ChannelSession.Settings.RedemptionStoreProducts.Values) { product.ReplenishAmount(); } foreach (RedemptionStorePurchaseModel purchase in ChannelSession.Settings.RedemptionStorePurchases.ToList()) { if (purchase.State != RedemptionStorePurchaseRedemptionState.ManualRedeemNeeded) { ChannelSession.Settings.RedemptionStorePurchases.Remove(purchase); } } ChannelSession.Services.Telemetry.TrackLogin(ChannelSession.Settings.TelemetryUserID, ChannelSession.TwitchUserNewAPI?.broadcaster_type); await ChannelSession.SaveSettings(); await ChannelSession.Services.Settings.SaveLocalBackup(ChannelSession.Settings); await ChannelSession.Services.Settings.PerformAutomaticBackupIfApplicable(ChannelSession.Settings); AsyncRunner.RunBackgroundTask(sessionBackgroundCancellationTokenSource.Token, 60000, SessionBackgroundTask); } catch (Exception ex) { Logger.Log(ex); Logger.Log(LogLevel.Error, "Finalize Initialization - " + JSONSerializerHelper.SerializeToString(ex)); await DialogHelper.ShowMessage("Failed to finalize initialization. If this continues, please visit the Mix It Up Discord for assistance." + Environment.NewLine + Environment.NewLine + "Error Details: " + ex.Message); return(false); } return(true); } } catch (Exception ex) { Logger.Log(ex); Logger.Log(LogLevel.Error, "Channel Information - " + JSONSerializerHelper.SerializeToString(ex)); await DialogHelper.ShowMessage("Failed to get channel information. If this continues, please visit the Mix It Up Discord for assistance." + Environment.NewLine + Environment.NewLine + "Error Details: " + ex.Message); } return(false); }
public async Task <bool> Connect(int connectionAttempts = 1) { for (int i = 0; i < connectionAttempts; i++) { if (ChannelSession.Connection != null) { this.Client = await this.ConnectAndAuthenticateChatClient(ChannelSession.Connection); if (this.Client != null) { this.Client.OnClearMessagesOccurred += ChatClient_OnClearMessagesOccurred; this.Client.OnDeleteMessageOccurred += ChatClient_OnDeleteMessageOccurred; this.Client.OnMessageOccurred += ChatClient_OnMessageOccurred; this.Client.OnPollEndOccurred += ChatClient_OnPollEndOccurred; this.Client.OnPollStartOccurred += ChatClient_OnPollStartOccurred; this.Client.OnPurgeMessageOccurred += ChatClient_OnPurgeMessageOccurred; this.Client.OnUserJoinOccurred += ChatClient_OnUserJoinOccurred; this.Client.OnUserLeaveOccurred += ChatClient_OnUserLeaveOccurred; this.Client.OnUserTimeoutOccurred += ChatClient_OnUserTimeoutOccurred; this.Client.OnUserUpdateOccurred += ChatClient_OnUserUpdateOccurred; this.Client.OnDisconnectOccurred += StreamerClient_OnDisconnectOccurred; if (ChannelSession.Settings.DiagnosticLogging) { this.Client.OnMethodOccurred += WebSocketClient_OnMethodOccurred; this.Client.OnReplyOccurred += WebSocketClient_OnReplyOccurred; this.Client.OnEventOccurred += WebSocketClient_OnEventOccurred; } foreach (ChatUserModel chatUser in await ChannelSession.Connection.GetChatUsers(ChannelSession.Channel, Math.Max(ChannelSession.Channel.viewersCurrent, 1))) { UserViewModel user = new UserViewModel(chatUser); await user.SetDetails(checkForFollow : false); this.ChatUsers[user.ID] = user; } if (this.ChatUsers.Count > 0) { Dictionary <UserModel, DateTimeOffset?> chatFollowers = await ChannelSession.Connection.CheckIfFollows(ChannelSession.Channel, this.ChatUsers.Values.Select(u => u.GetModel())); foreach (var kvp in chatFollowers) { this.ChatUsers[kvp.Key.id].SetFollowDate(kvp.Value); } } if (ChannelSession.IsStreamer) { ChannelSession.PreMadeChatCommands.Clear(); foreach (PreMadeChatCommand command in ReflectionHelper.CreateInstancesOfImplementingType <PreMadeChatCommand>()) { ChannelSession.PreMadeChatCommands.Add(command); } foreach (PreMadeChatCommandSettings commandSetting in ChannelSession.Settings.PreMadeChatCommandSettings) { PreMadeChatCommand command = ChannelSession.PreMadeChatCommands.FirstOrDefault(c => c.Name.Equals(commandSetting.Name)); if (command != null) { command.UpdateFromSettings(commandSetting); } } } #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed Task.Run(async() => { await this.ChannelRefreshBackground(); }, this.backgroundThreadCancellationTokenSource.Token); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed Task.Run(async() => { await this.ChatUserRefreshBackground(); }, this.backgroundThreadCancellationTokenSource.Token); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed Task.Run(async() => { await this.TimerCommandsBackground(); }, this.backgroundThreadCancellationTokenSource.Token); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed return(true); } } await Task.Delay(1000); } return(false); }