private void contextMenuListExportM3u_Click_Implementation(object sender, EventArgs e) { string filename; using (var fileDialog = new SaveFileDialog() { AddExtension = true, AutoUpgradeEnabled = true, CheckPathExists = true, InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), OverwritePrompt = true, RestoreDirectory = true, ShowHelp = false, SupportMultiDottedExtensions = true, Title = contextMenuListExportM3u.Text, ValidateNames = true, DefaultExt = "m3u", Filter = ".m3u|*.m3u", }) { if (fileDialog.ShowDialog(this) != DialogResult.OK) { return; } filename = fileDialog.FileName; } // using BasicGoogleTelemetry.SendEventHit("Feature", "contextMenuListExportM3u", "contextMenuListExportM3u.Text", this.GetType().Name); var sortedServices = from service in ListManager.BroadcastServices orderby service.DisplayLogicalNumber select service; var output = new StringBuilder(); output.AppendLine("#EXTM3U"); foreach (var service in sortedServices) { output.AppendFormat("#EXTINF:-1,[{0}] {1}", service.DisplayLogicalNumber, service.DisplayName); output.AppendLine(); output.AppendLine(service.DisplayLocationUrl); } // foreach service File.WriteAllText(filename, output.ToString(), Encoding.UTF8); } // contextMenuListExportM3u_Click_Implementation
private void HandleException(IWin32Window owner, Exception ex) { string message; BasicGoogleTelemetry.SendExtendedExceptionHit(ex, false, TelemetryScreenName, TelemetryScreenName); var isSocket = ex as SocketException; var isTimeout = ex as TimeoutException; message = TextDownloadException ?? Properties.Texts.HelperExceptionText; if (isSocket != null) { message = string.Format(Properties.Texts.SocketException, message, isSocket.SocketErrorCode); } else if (isTimeout != null) { message = string.Format(Properties.Texts.TimeoutException, message); } var box = new ExceptionMessageBox() { Buttons = ExceptionMessageBoxButtons.Custom, InnerException = ex, Text = message, DefaultButton = ExceptionMessageBoxDefaultButton.Button2, CustomSymbol = Properties.Resources.DvbStpDownload_Error_48x48 }; box.SetButtonText(ExceptionMessageBox.OKButtonText, Properties.Texts.HandleExceptionHelpButton); box.Show(owner); if (box.CustomDialogResult == ExceptionMessageBoxDialogResult.Button2) { BasicGoogleTelemetry.SendEventHit("ShowDialog", "UiServices.DvbStpClient.HelpDialog", TelemetryScreenName, TelemetryScreenName); HelpDialog.ShowRtfHelp(owner, Properties.Texts.RtfTroubleshootingGuide, null); } // if } // HandleException