private void OnBlogKeyUp(object sender, KeyEventArgs e) { //Event handler for new blog entry Cursor.Current = Cursors.WaitCursor; try { if (e.KeyCode == Keys.Enter) { BlogEntry entry = new BlogEntry(); entry.Date = DateTime.Now; entry.Comment = this.txtComment.Text; entry.UserID = Environment.UserName; if (FreightGateway.AddBlogEntry(entry)) { this.txtComment.Clear(); lock (this.txtBlog) { DispatchDataset ds = FreightGateway.ViewBlog(); refreshBlog(ds); } } } } catch (Exception ex) { App.ReportError(ex, false, LogLevel.Warning); } finally { Cursor.Current = Cursors.Default; } }
private void OnAutoRefresh(object sender, DoWorkEventArgs e) { //Event handler for background worker thread DoWork event; runs on worker thread try { e.Result = FreightGateway.ViewBlog(); } catch { } }