source: Scheduling/trunk/cs/bsdx0200GUISourceCode/RPCLoggerView.cs@ 1581

Last change on this file since 1581 was 1474, checked in by Sam Habiel, 12 years ago

Finally, v 1.7 to the main repo. I will delete the branch after this.

This commit merges all the BMX4 changes in the Scheduling GUI back to the main trunk.

File size: 2.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Linq;
7using System.Text;
8using System.Windows.Forms;
9
10namespace IndianHealthService.ClinicalScheduling
11{
12 /// <summary>
13 /// This form displays the RPC Events found in RPCLogger
14 /// </summary>
15 public partial class RPCLoggerView : Form
16 {
17 public RPCLoggerView()
18 {
19 InitializeComponent();
20 lstRPCEvents.BeginUpdate(); // Stop redrawing
21 foreach (var eventItem in CGDocumentManager.Current.RPCLogger.Logger) lstRPCEvents.Items.Add(eventItem); // Add the stuff
22 lstRPCEvents.EndUpdate(); // Draw Again
23
24 //We are interested in event HaveMoreData. Each time it happens, it means we have an extra item we need to add.
25 CGDocumentManager.Current.RPCLogger.HaveMoreData += new EventHandler<RPCLogger.EventToLog>(RPCLogger_HaveMoreData);
26 }
27
28 // Dummmy delegate for the method below to use in this.Invoke
29 delegate void dAny(object s, RPCLogger.EventToLog e);
30
31 /// <summary>
32 /// Adds the new RPC event to Listbox
33 /// </summary>
34 /// <param name="sender">this is the RPCLogger Object. It's not used</param>
35 /// <param name="e">That's the custom logged event.</param>
36 void RPCLogger_HaveMoreData(object sender, RPCLogger.EventToLog e)
37 {
38 if (this.InvokeRequired)
39 {
40 dAny d = new dAny(this.RPCLogger_HaveMoreData);
41 this.Invoke(d, new object[] { sender, e });
42 return;
43 }
44
45 lstRPCEvents.Items.Add(e);
46 }
47
48 /// <summary>
49 /// Puts the text of the event in the text box
50 /// </summary>
51 /// <param name="sender">useless</param>
52 /// <param name="e">useless</param>
53 private void lstRPCEvents_SelectedIndexChanged(object sender, EventArgs e)
54 {
55 RPCLogger.EventToLog l = lstRPCEvents.SelectedItem as RPCLogger.EventToLog;
56 if (l == null) return;
57 txtRPCEvent.Text = l.Lines + "\r\n" + l.Exception ?? "";
58 }
59 }
60}
Note: See TracBrowser for help on using the repository browser.