Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs	(revision 1233)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs	(revision 1474)
@@ -114,4 +114,5 @@
         private MenuItem sepApptMenu3;
         private MenuItem mnuReprintApptSlip;
+        private MenuItem mnuViewBrokerLog;
         private IContainer components;
 
@@ -132,9 +133,9 @@
 		public void InitializeDocView(string sText)
 		{
-			this.Text = this.DocManager.ConnectInfo.UserName;
+            this.Text = CGDocumentManager.Current.RemoteSession.User.Name;
 			if (sText != null)
 				this.Text += " - " + sText;
-			if (DocManager.ConnectInfo.DivisionName != null)
-				this.Text += " - " + DocManager.ConnectInfo.DivisionName;
+            if (CGDocumentManager.Current.RemoteSession.User.Division.Name != null)
+                this.Text += " - " + CGDocumentManager.Current.RemoteSession.User.Division.Name;
 		}
 
@@ -157,16 +158,12 @@
 
             // Set username and division up top
-            this.Text = this.DocManager.ConnectInfo.UserName;
+            this.Text = CGDocumentManager.Current.RemoteSession.User.Name;
 			if (sText != null)
 				this.Text += " - " + sText;
-			if (DocManager.ConnectInfo.DivisionName != null)
-				this.Text += " - " + DocManager.ConnectInfo.DivisionName;
-
-			this.m_ConnectInfo = m_DocManager.ConnectInfo;
-			m_bmxDelegate = new BMXNetConnectInfo.BMXNetEventDelegate(BMXNetEventHandler);
-			m_ConnectInfo.BMXNetEvent += m_bmxDelegate;
-		}
-
-		private BMXNetConnectInfo.BMXNetEventDelegate m_bmxDelegate;
+			if (CGDocumentManager.Current.RemoteSession.User.Division.Name != null)
+                this.Text += " - " + CGDocumentManager.Current.RemoteSession.User.Division.Name;
+
+            CGDocumentManager.Current.RemoteSession.EventServices.RpmsEvent += BMXNetEventHandler;
+		}
 		
 
@@ -235,4 +232,5 @@
             this.mnuHelp = new System.Windows.Forms.MenuItem();
             this.mnuHelpAbout = new System.Windows.Forms.MenuItem();
+            this.mnuViewBrokerLog = new System.Windows.Forms.MenuItem();
             this.mnuTest = new System.Windows.Forms.MenuItem();
             this.mnuTest1 = new System.Windows.Forms.MenuItem();
@@ -680,5 +678,6 @@
             this.mnuHelp.Index = 3;
             this.mnuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
-            this.mnuHelpAbout});
+            this.mnuHelpAbout,
+            this.mnuViewBrokerLog});
             this.mnuHelp.Text = "&Help";
             // 
@@ -688,4 +687,10 @@
             this.mnuHelpAbout.Text = "&About";
             this.mnuHelpAbout.Click += new System.EventHandler(this.mnuHelpAbout_Click);
+            // 
+            // mnuViewBrokerLog
+            // 
+            this.mnuViewBrokerLog.Index = 1;
+            this.mnuViewBrokerLog.Text = "&View Broker Log";
+            this.mnuViewBrokerLog.Click += new System.EventHandler(this.mnuViewBrokerLog_Click);
             // 
             // mnuTest
@@ -702,5 +707,4 @@
             this.mnuTest1.Index = 0;
             this.mnuTest1.Text = "Test1";
-            this.mnuTest1.Click += new System.EventHandler(this.mnuTest1_Click);
             // 
             // tvSchedules
@@ -712,5 +716,5 @@
             this.tvSchedules.Location = new System.Drawing.Point(0, 0);
             this.tvSchedules.Name = "tvSchedules";
-            this.tvSchedules.Size = new System.Drawing.Size(128, 392);
+            this.tvSchedules.Size = new System.Drawing.Size(128, 389);
             this.tvSchedules.Sorted = true;
             this.tvSchedules.TabIndex = 1;
@@ -781,5 +785,5 @@
             this.panelRight.Location = new System.Drawing.Point(996, 0);
             this.panelRight.Name = "panelRight";
-            this.panelRight.Size = new System.Drawing.Size(128, 392);
+            this.panelRight.Size = new System.Drawing.Size(128, 389);
             this.panelRight.TabIndex = 3;
             this.panelRight.Visible = false;
@@ -877,6 +881,141 @@
             this.panelCenter.Location = new System.Drawing.Point(136, 24);
             this.panelCenter.Name = "panelCenter";
-            this.panelCenter.Size = new System.Drawing.Size(857, 344);
+            this.panelCenter.Size = new System.Drawing.Size(857, 341);
             this.panelCenter.TabIndex = 7;
+            // 
+            // ctxCalendarGrid
+            // 
+            this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+            this.ctxCalGridAdd,
+            this.ctxCalGridMkRadAppt,
+            this.ctxCalGridEdit,
+            this.ctxCalGridDelete,
+            this.ctxCalGridCancelRadAppt,
+            this.ctxCalGridCheckIn,
+            this.ctxCalGridUndoCheckin,
+            this.ctxCalGridSep1,
+            this.ctxCalGridNoShow,
+            this.ctxCalGridNoShowUndo,
+            this.ctxCalGridSep2,
+            this.ctxCalGridWalkin,
+            this.ctxCalGridSep3,
+            this.ctxCalGridReprintApptSlip});
+            this.ctxCalendarGrid.Popup += new System.EventHandler(this.ctxCalendarGrid_Popup);
+            // 
+            // ctxCalGridAdd
+            // 
+            this.ctxCalGridAdd.Index = 0;
+            this.ctxCalGridAdd.Text = "Add Appointment";
+            this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click);
+            // 
+            // ctxCalGridMkRadAppt
+            // 
+            this.ctxCalGridMkRadAppt.Index = 1;
+            this.ctxCalGridMkRadAppt.Text = "Make Radiology Appointment";
+            this.ctxCalGridMkRadAppt.Click += new System.EventHandler(this.ctxCalGridMkRadAppt_Click);
+            // 
+            // ctxCalGridEdit
+            // 
+            this.ctxCalGridEdit.Index = 2;
+            this.ctxCalGridEdit.Text = "Edit Appointment";
+            this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click);
+            // 
+            // ctxCalGridDelete
+            // 
+            this.ctxCalGridDelete.Index = 3;
+            this.ctxCalGridDelete.Text = "Cancel Appointment";
+            this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click);
+            // 
+            // ctxCalGridCancelRadAppt
+            // 
+            this.ctxCalGridCancelRadAppt.Index = 4;
+            this.ctxCalGridCancelRadAppt.Text = "Cancel Radiology Appointment";
+            this.ctxCalGridCancelRadAppt.Click += new System.EventHandler(this.ctxCalGridCancelRadAppt_Click);
+            // 
+            // ctxCalGridCheckIn
+            // 
+            this.ctxCalGridCheckIn.Index = 5;
+            this.ctxCalGridCheckIn.Text = "Check In Patient";
+            this.ctxCalGridCheckIn.Click += new System.EventHandler(this.ctxCalGridCheckIn_Click);
+            // 
+            // ctxCalGridUndoCheckin
+            // 
+            this.ctxCalGridUndoCheckin.Index = 6;
+            this.ctxCalGridUndoCheckin.Text = "&Undo Check In";
+            this.ctxCalGridUndoCheckin.Click += new System.EventHandler(this.ctxCalGridUndoCheckin_Click);
+            // 
+            // ctxCalGridSep1
+            // 
+            this.ctxCalGridSep1.Index = 7;
+            this.ctxCalGridSep1.Text = "-";
+            // 
+            // ctxCalGridNoShow
+            // 
+            this.ctxCalGridNoShow.Index = 8;
+            this.ctxCalGridNoShow.Text = "Mark as No Show";
+            this.ctxCalGridNoShow.Click += new System.EventHandler(this.ctxCalGridNoShow_Click);
+            // 
+            // ctxCalGridNoShowUndo
+            // 
+            this.ctxCalGridNoShowUndo.Index = 9;
+            this.ctxCalGridNoShowUndo.Text = "Undo NoShow";
+            this.ctxCalGridNoShowUndo.Click += new System.EventHandler(this.ctxCalGridNoShowUndo_Click);
+            // 
+            // ctxCalGridSep2
+            // 
+            this.ctxCalGridSep2.Index = 10;
+            this.ctxCalGridSep2.Text = "-";
+            // 
+            // ctxCalGridWalkin
+            // 
+            this.ctxCalGridWalkin.Index = 11;
+            this.ctxCalGridWalkin.Text = "Create Wal&k-In Appointment";
+            this.ctxCalGridWalkin.Click += new System.EventHandler(this.ctxCalGridWalkin_Click);
+            // 
+            // ctxCalGridSep3
+            // 
+            this.ctxCalGridSep3.Index = 12;
+            this.ctxCalGridSep3.Text = "-";
+            // 
+            // ctxCalGridReprintApptSlip
+            // 
+            this.ctxCalGridReprintApptSlip.Index = 13;
+            this.ctxCalGridReprintApptSlip.Text = "&Reprint Appointment Slip";
+            this.ctxCalGridReprintApptSlip.Click += new System.EventHandler(this.ctxCalGridReprintApptSlip_Click);
+            // 
+            // panelBottom
+            // 
+            this.panelBottom.Controls.Add(this.statusBar1);
+            this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
+            this.panelBottom.Location = new System.Drawing.Point(136, 365);
+            this.panelBottom.Name = "panelBottom";
+            this.panelBottom.Size = new System.Drawing.Size(857, 24);
+            this.panelBottom.TabIndex = 8;
+            // 
+            // statusBar1
+            // 
+            this.statusBar1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.statusBar1.Location = new System.Drawing.Point(0, 0);
+            this.statusBar1.Name = "statusBar1";
+            this.statusBar1.Size = new System.Drawing.Size(857, 24);
+            this.statusBar1.SizingGrip = false;
+            this.statusBar1.TabIndex = 0;
+            // 
+            // splitter1
+            // 
+            this.splitter1.Location = new System.Drawing.Point(128, 24);
+            this.splitter1.Name = "splitter1";
+            this.splitter1.Size = new System.Drawing.Size(8, 365);
+            this.splitter1.TabIndex = 9;
+            this.splitter1.TabStop = false;
+            // 
+            // splitter2
+            // 
+            this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
+            this.splitter2.Location = new System.Drawing.Point(993, 24);
+            this.splitter2.Name = "splitter2";
+            this.splitter2.Size = new System.Drawing.Size(3, 365);
+            this.splitter2.TabIndex = 10;
+            this.splitter2.TabStop = false;
             // 
             // calendarGrid1
@@ -899,5 +1038,5 @@
             this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources")));
             this.calendarGrid1.SelectedAppointment = 0;
-            this.calendarGrid1.Size = new System.Drawing.Size(857, 344);
+            this.calendarGrid1.Size = new System.Drawing.Size(857, 341);
             this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0);
             this.calendarGrid1.TabIndex = 0;
@@ -909,143 +1048,8 @@
             this.calendarGrid1.MouseEnter += new System.EventHandler(this.calendarGrid1_MouseEnter);
             // 
-            // ctxCalendarGrid
-            // 
-            this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
-            this.ctxCalGridAdd,
-            this.ctxCalGridMkRadAppt,
-            this.ctxCalGridEdit,
-            this.ctxCalGridDelete,
-            this.ctxCalGridCancelRadAppt,
-            this.ctxCalGridCheckIn,
-            this.ctxCalGridUndoCheckin,
-            this.ctxCalGridSep1,
-            this.ctxCalGridNoShow,
-            this.ctxCalGridNoShowUndo,
-            this.ctxCalGridSep2,
-            this.ctxCalGridWalkin,
-            this.ctxCalGridSep3,
-            this.ctxCalGridReprintApptSlip});
-            this.ctxCalendarGrid.Popup += new System.EventHandler(this.ctxCalendarGrid_Popup);
-            // 
-            // ctxCalGridAdd
-            // 
-            this.ctxCalGridAdd.Index = 0;
-            this.ctxCalGridAdd.Text = "Add Appointment";
-            this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click);
-            // 
-            // ctxCalGridMkRadAppt
-            // 
-            this.ctxCalGridMkRadAppt.Index = 1;
-            this.ctxCalGridMkRadAppt.Text = "Make Radiology Appointment";
-            this.ctxCalGridMkRadAppt.Click += new System.EventHandler(this.ctxCalGridMkRadAppt_Click);
-            // 
-            // ctxCalGridEdit
-            // 
-            this.ctxCalGridEdit.Index = 2;
-            this.ctxCalGridEdit.Text = "Edit Appointment";
-            this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click);
-            // 
-            // ctxCalGridDelete
-            // 
-            this.ctxCalGridDelete.Index = 3;
-            this.ctxCalGridDelete.Text = "Cancel Appointment";
-            this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click);
-            // 
-            // ctxCalGridCancelRadAppt
-            // 
-            this.ctxCalGridCancelRadAppt.Index = 4;
-            this.ctxCalGridCancelRadAppt.Text = "Cancel Radiology Appointment";
-            this.ctxCalGridCancelRadAppt.Click += new System.EventHandler(this.ctxCalGridCancelRadAppt_Click);
-            // 
-            // ctxCalGridCheckIn
-            // 
-            this.ctxCalGridCheckIn.Index = 5;
-            this.ctxCalGridCheckIn.Text = "Check In Patient";
-            this.ctxCalGridCheckIn.Click += new System.EventHandler(this.ctxCalGridCheckIn_Click);
-            // 
-            // ctxCalGridUndoCheckin
-            // 
-            this.ctxCalGridUndoCheckin.Index = 6;
-            this.ctxCalGridUndoCheckin.Text = "&Undo Check In";
-            this.ctxCalGridUndoCheckin.Click += new System.EventHandler(this.ctxCalGridUndoCheckin_Click);
-            // 
-            // ctxCalGridSep1
-            // 
-            this.ctxCalGridSep1.Index = 7;
-            this.ctxCalGridSep1.Text = "-";
-            // 
-            // ctxCalGridNoShow
-            // 
-            this.ctxCalGridNoShow.Index = 8;
-            this.ctxCalGridNoShow.Text = "Mark as No Show";
-            this.ctxCalGridNoShow.Click += new System.EventHandler(this.ctxCalGridNoShow_Click);
-            // 
-            // ctxCalGridNoShowUndo
-            // 
-            this.ctxCalGridNoShowUndo.Index = 9;
-            this.ctxCalGridNoShowUndo.Text = "Undo NoShow";
-            this.ctxCalGridNoShowUndo.Click += new System.EventHandler(this.ctxCalGridNoShowUndo_Click);
-            // 
-            // ctxCalGridSep2
-            // 
-            this.ctxCalGridSep2.Index = 10;
-            this.ctxCalGridSep2.Text = "-";
-            // 
-            // ctxCalGridWalkin
-            // 
-            this.ctxCalGridWalkin.Index = 11;
-            this.ctxCalGridWalkin.Text = "Create Wal&k-In Appointment";
-            this.ctxCalGridWalkin.Click += new System.EventHandler(this.ctxCalGridWalkin_Click);
-            // 
-            // ctxCalGridSep3
-            // 
-            this.ctxCalGridSep3.Index = 12;
-            this.ctxCalGridSep3.Text = "-";
-            // 
-            // ctxCalGridReprintApptSlip
-            // 
-            this.ctxCalGridReprintApptSlip.Index = 13;
-            this.ctxCalGridReprintApptSlip.Text = "&Reprint Appointment Slip";
-            this.ctxCalGridReprintApptSlip.Click += new System.EventHandler(this.ctxCalGridReprintApptSlip_Click);
-            // 
-            // panelBottom
-            // 
-            this.panelBottom.Controls.Add(this.statusBar1);
-            this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
-            this.panelBottom.Location = new System.Drawing.Point(136, 368);
-            this.panelBottom.Name = "panelBottom";
-            this.panelBottom.Size = new System.Drawing.Size(857, 24);
-            this.panelBottom.TabIndex = 8;
-            // 
-            // statusBar1
-            // 
-            this.statusBar1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.statusBar1.Location = new System.Drawing.Point(0, 0);
-            this.statusBar1.Name = "statusBar1";
-            this.statusBar1.Size = new System.Drawing.Size(857, 24);
-            this.statusBar1.SizingGrip = false;
-            this.statusBar1.TabIndex = 0;
-            // 
-            // splitter1
-            // 
-            this.splitter1.Location = new System.Drawing.Point(128, 24);
-            this.splitter1.Name = "splitter1";
-            this.splitter1.Size = new System.Drawing.Size(8, 368);
-            this.splitter1.TabIndex = 9;
-            this.splitter1.TabStop = false;
-            // 
-            // splitter2
-            // 
-            this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
-            this.splitter2.Location = new System.Drawing.Point(993, 24);
-            this.splitter2.Name = "splitter2";
-            this.splitter2.Size = new System.Drawing.Size(3, 368);
-            this.splitter2.TabIndex = 10;
-            this.splitter2.TabStop = false;
-            // 
             // CGView
             // 
             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
-            this.ClientSize = new System.Drawing.Size(1124, 392);
+            this.ClientSize = new System.Drawing.Size(1124, 389);
             this.Controls.Add(this.panelCenter);
             this.Controls.Add(this.panelBottom);
@@ -1086,6 +1090,4 @@
 		private Hashtable			m_htModifySchedule;
 		private Hashtable			m_htChangeAppts;
-		private BMXNetConnectInfo	m_ConnectInfo = null;
-		public BMXNetConnectInfo.BMXNetEventDelegate	BMXNetEvent;
 
 		#endregion Fields
@@ -1308,5 +1310,5 @@
 			DataTable dt = this.DocManager.GlobalDataSet.Tables["ResourceUser"];
 			DataView dv = new DataView(dt, "", "RESOURCENAME ASC", DataViewRowState.OriginalRows);
-			string sDuz = this.DocManager.ConnectInfo.DUZ;
+            string sDuz = CGDocumentManager.Current.RemoteSession.User.Duz;
 			bool bModSchedule = false;
 			DataRowView[] drvA = dv.FindRows(sResource);
@@ -1569,4 +1571,9 @@
         private bool IsThisARadiologyResource(string sResource)
         {
+            //smh - change in v 1.7... if the resource is not linked to a PIMS clinic, this method fails.
+            //This happens if there is just one resource that is not linked, which makes it impossible to
+            //make any appointments, because this method gets called at any time a menu is opened.
+            //So we change res.Field<int> to res.Field<int?> 
+           
             // see if resource is mapped to a Radiology Hospital Location.
             return (   //select all Hospital Locations which are radiology locations
@@ -1575,5 +1582,6 @@
                        //join this to the resources table using the foreign ID (plain jane relational join)
                        join res in CGDocumentManager.Current.GlobalDataSet.Tables["Resources"].AsEnumerable()
-                       on hl.Field<int>("HOSPITAL_LOCATION_ID") equals res.Field<int>("HOSPITAL_LOCATION_ID")
+                       //on hl.Field<int>("HOSPITAL_LOCATION_ID") equals res.Field<int>("HOSPITAL_LOCATION_ID") //change in 1.7
+                       on hl.Field<int>("HOSPITAL_LOCATION_ID") equals res.Field<int?>("HOSPITAL_LOCATION_ID")
                        //then filter this down to the resource that we have
                        where res.Field<string>("RESOURCE_NAME") == sResource
@@ -1766,5 +1774,5 @@
 					doc.ResourceID = Convert.ToInt32(sResourceID);
 
-					bool bLock = DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXRES(" + sResourceID + ")", "+");
+                    bool bLock = CGDocumentManager.Current.RemoteSession.Lock("^BSDXRES(" + sResourceID + ")", "+");
 					if (bLock == false)
 					{
@@ -1939,7 +1947,5 @@
 			dt = this.DocManager.GlobalDataSet.Tables["ResourceUser"];
 			dv = new DataView(dt, "", "RESOURCENAME ASC", DataViewRowState.OriginalRows);
-
-            //dv.RowFilter = "USERNAME = '" + filte_name + "'";
-            dv.RowFilter = String.Format("USERNAME = '{0}'", this.DocManager.ConnectInfo.UserName.Replace("'", "''"));
+            dv.RowFilter = String.Format("USERNAME = '{0}'", CGDocumentManager.Current.RemoteSession.User.Name.Replace("'", "''"));
 
 			for (int j=0; j < dv.Count; j++)
@@ -2529,6 +2535,6 @@
 			{
                 string msg;
-                if (BMXNetLib.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error.
-                    msg = BMXNetLib.Piece(ex.Message, "~", 4);
+                if (M.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error.
+                    msg = M.Piece(ex.Message, "~", 4);
                 else
                     msg = ex.Message;
@@ -2640,6 +2646,6 @@
 			{   
                 string msg;
-                if (BMXNetLib.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error.
-                    msg = BMXNetLib.Piece(ex.Message, "~", 4);
+                if (M.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error.
+                    msg = M.Piece(ex.Message, "~", 4);
                 else
                     msg = ex.Message;
@@ -2748,6 +2754,6 @@
             {
                 string msg;
-                if (BMXNetLib.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error.
-                    msg = BMXNetLib.Piece(ex.Message, "~", 4);
+                if (M.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error.
+                    msg = M.Piece(ex.Message, "~", 4);
                 else
                     msg = ex.Message;
@@ -2771,5 +2777,5 @@
         /// <param name="e">BMXEvent Args: 
         /// e.BMXEvent is free text for Event Type; e.BMXParam is free text for Event Arguments</param>
-        private void BMXNetEventHandler(Object obj, BMXNet.BMXNetEventArgs e)
+        private void BMXNetEventHandler(Object obj, RemoteEventArgs e)
         {
             try
@@ -2779,5 +2785,5 @@
 
                 // if event is Autofire event
-                if (e.BMXEvent == "BMXNet AutoFire")
+                if (e.EventType == "BMXNet AutoFire")
                 {
                     Debug.Write("CGView caught AutoFire event.\n");
@@ -2792,5 +2798,5 @@
 
                 // if event is BSDX SCHEDULE
-                else if (e.BMXEvent == "BSDX SCHEDULE")
+                else if (e.EventType == "BSDX SCHEDULE")
                 {
                     //See if any of the resources in the event argument matches BSDX Schedule.
@@ -2800,5 +2806,5 @@
                     {
                         sResourceName = m_Document.m_sResourcesArray[j].ToString();
-                        if (e.BMXParam == sResourceName)
+                        if (e.Details == sResourceName)
                         {
                             Debug.Write("CGView caught BSDX SCHEDULE event.\n");
@@ -2868,5 +2874,5 @@
             {
                 //Signal RPMS to raise an event
-                m_ConnectInfo.RaiseEvent(sEvent, sParams, false);
+                CGDocumentManager.Current.RemoteSession.EventServices.TriggerEvent(sEvent, sParams, false);
             }
             catch (Exception ex)
@@ -2914,5 +2920,5 @@
             try
             {
-                bool bLock = DocManager.ConnectInfo.Lock("^BSDXMGR", "+", "");
+                bool bLock = CGDocumentManager.Current.RemoteSession.Lock("^BSDXMGR", "+");
                 if (bLock == false)
                 {
@@ -2929,5 +2935,5 @@
                 m_DocManager.GlobalDataSet.Tables["ResourceUser"].Clear();
                 m_DocManager.LoadResourceUserTable(false);
-                bLock = DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXMGR", "-");
+                bLock = CGDocumentManager.Current.RemoteSession.Lock("^BSDXMGR", "-");
             }
             catch (ApplicationException aex)
@@ -3195,47 +3201,9 @@
         }
 
-        /// <summary>
-        /// Useless code now... Good place to test something.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-		private void mnuTest1_Click(object sender, System.EventArgs e)
-		{
-			ReaderWriterLock m_rwl = this.DocManager.ConnectInfo.bmxNetLib.BMXRWL;
+		private void CGView_Closing(object sender, System.ComponentModel.CancelEventArgs e)
+		{
 			try
 			{
-				m_rwl.AcquireWriterLock(50);
-				Debug.Write("\nTest Button 1 Acquired first lock\n");
-				m_rwl.AcquireWriterLock(50);
-				Debug.Write("Test Button 1 Acquired second lock\n");
-				this.DocManager.ViewRefresh();
-				Thread.Sleep(5000);
-				try
-				{
-				}
-				catch
-				{
-				}
-				finally
-				{
-					m_rwl.ReleaseWriterLock();
-					Debug.Write ("Test Button 1 released first lock.\n");
-					m_rwl.ReleaseWriterLock();
-					Debug.Write ("Test Button 1 released second lock.\n");
-				}
-
-				return;
-			}
-			catch (Exception ex)
-			{
-				Debug.Write("Test Button 1 exception: " + ex.Message + "\n");
-			}
-		}
-
-		private void CGView_Closing(object sender, System.ComponentModel.CancelEventArgs e)
-		{
-			try
-			{
-				m_ConnectInfo.BMXNetEvent -= m_bmxDelegate;
+				CGDocumentManager.Current.RemoteSession.EventServices.RpmsEvent -= BMXNetEventHandler;
 				this.calendarGrid1.CloseGrid();
 			}
@@ -3966,4 +3934,10 @@
         }
 
+        private void mnuViewBrokerLog_Click(object sender, EventArgs e)
+        {
+            var view = new RPCLoggerView();
+            view.Show();
+        }
+
 
     }//End class
