private async void StartDownloadAsync(String searchRequest) { BeforeTaskStarted(); Task = new DownloadTask(searchRequest, PathUtils.IsValidFilePath(_downloadPathTextBox.Text) ? _downloadPathTextBox.Text : null); try { AfterTaskCreated(); if (!Task.IsInvalid) { await Task.InitializeTaskAsync().ConfigureAwait(true); } if (!Task.IsInvalid) { await Task.StartTaskAsync().ConfigureAwait(true); } } catch (Exception e) { Log(new LogMessage($"{e.Message}{LocalizationBase.NewLine}{e.StackTrace}", MessageType.CriticalError)); OnTaskInvalid(Task.Log); } OnDownloadFinally(); }