public static void ShowTextFileViewer(MainForm frm) { TextFileViewer textoutForm = null; //string filename = @"c:\testfiles\testfile.txt"; string filename = @"c:\testfiles\FirstNamesShort.txt"; try { _msg.Length = 0; _msg.Append("ShowTextFileViewer started ...\r\n"); Program._messageLog.WriteLine(_msg.ToString()); textoutForm = new TextFileViewer(); textoutForm.Caption = "Test Progam for PFTextFileViewer ..."; textoutForm.Font = "Lucida Console"; textoutForm.FontSize = (float)10.0; textoutForm.LoadFile(filename); textoutForm.ShowDialog(); textoutForm.CloseWindow(); textoutForm = null; } catch (System.Exception ex) { _msg.Length = 0; _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex)); Program._messageLog.WriteLine(_msg.ToString()); AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog); } finally { if (textoutForm != null) { if (textoutForm.FormIsVisible) { textoutForm.CloseWindow(); } textoutForm = null; } _msg.Length = 0; _msg.Append("\r\n... ShowTextFileViewer finished."); Program._messageLog.WriteLine(_msg.ToString()); } }
private void BtnLicense_Click(object sender, RoutedEventArgs e) { string dir = AppInfo.AppDirectory; TextFileViewer.ViewTextFile(Path.Combine(dir, "License.txt")); }
private async void BtnLog_Click(object sender, RoutedEventArgs e) { _ = await TextFileViewer.ViewTextFile(NLHelpers.GetLogfileName()).ConfigureAwait(true); }
private async void BtnReadme_Click(object sender, RoutedEventArgs e) { string dir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); _ = await TextFileViewer.ViewTextFile(Path.Combine(dir, "ReadMe.txt")).ConfigureAwait(true); }
private async void BtnLicense_Click(object sender, RoutedEventArgs e) { string dir = AppInfo.AppDirectory; _ = await TextFileViewer.ViewTextFile(Path.Combine(dir, "License.txt")).ConfigureAwait(true); }