- Timestamp:
- Jan 19, 2011, 9:02:59 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs
r1070 r1071 181 181 _current = new CGDocumentManager(); 182 182 183 //Get command line options; store in private variables183 //Get command line options; store in private class wide variables 184 184 var opset = new OptionSet() { 185 185 { "s=", s => _current.m_Server = s }, … … 191 191 192 192 opset.Parse(args); 193 194 193 194 //Init app 195 195 bool isEverythingOkay = _current.InitializeApp(); 196 196 197 //if an error occurred, break out. 197 198 if (!isEverythingOkay) return; 198 199 199 200 //Create the first empty document 201 //A document holds the resources, appointments, and availabilites 200 202 //SAM: Good place for break point 201 203 CGDocument doc = new CGDocument(); 202 204 doc.DocManager = _current; 203 doc.OnNewDocument(); 205 206 //Create new View 207 //A view is a specific arrangement of appointments and availabilites that constitute a document 208 CGView view = new CGView(); 209 view.InitializeDocView(doc, _current, doc.StartDate, doc.Appointments, _current.WindowText); 210 211 //Handle BMX Event 204 212 Application.DoEvents(); 213 214 //Application wide error handler for unhandled errors 215 Application.ThreadException += new ThreadExceptionEventHandler(App_ThreadException); 216 205 217 #if TRACE 206 218 DateTime EndLoadTime = DateTime.Now; … … 208 220 Debug.Write("Load Time for GUI is " + LoadTime.Seconds + " s & " + LoadTime.Milliseconds + " ms\n"); 209 221 #endif 210 //Application wide error handler for unhandled errors 211 Application.ThreadException += new ThreadExceptionEventHandler(App_ThreadException); 212 213 //Run the application 214 //Sam's Note: This is an unusual way to call this. Typically, it's run with 215 //the main form as an argument. 222 223 view.Show(); 224 view.Activate(); 225 216 226 Application.Run(); 217 227 } … … 368 378 } 369 379 // My code -- buts looks so ugly! 380 // Checks the passed parameters stored in the class variables 370 381 else 371 382 { … … 981 992 } 982 993 994 /// <summary> 995 /// Accomplishes Changing the Server to which you connect 996 /// </summary> 997 /// <remarks> 998 /// Parameter relog-in for InitializeApp forces initialize app to use 999 /// 1. The server the user just picked and then BMX saved off to User Preferences 1000 /// 2. A new access and verify code pair 1001 /// </remarks> 1002 /// <param name="sender">unused</param> 1003 /// <param name="e">unused</param> 983 1004 private void mnuRPMSServer_Click(object sender, EventArgs e) 984 1005 { … … 990 1011 try 991 1012 { 1013 // Close All, but tell the Close All method not to call Applicaiton.Exit since we still plan to continue. 1014 // Close All does not call Application.Exit, but CGView_Close handler does 992 1015 m_bExitOK = false; 993 bool bRetry = true; 994 BMXNetConnectInfo tmpInfo; 1016 CloseAll(); 1017 m_bExitOK = true; 1018 1019 //Used in Do loop 1020 bool bRetry = true; 1021 1022 // Do Loop to deal with changing the server and the vagaries of user choices. 995 1023 do 996 1024 { 997 tmpInfo = m_ConnectInfo;998 1025 try 999 1026 { 1000 tmpInfo.ChangeServerInfo(); 1027 //ChangeServerInfo does not re-login the user 1028 //It only changes the saved server information in the %APPDATA% folder 1029 //so it can be re-used when BMX tries to log in again. 1030 //Access and Verify code are prompted for in InitializeApp 1031 m_ConnectInfo.ChangeServerInfo(); 1001 1032 bRetry = false; 1002 1033 } … … 1006 1037 { 1007 1038 bRetry = false; 1039 Application.Exit(); 1008 1040 return; 1009 1041 } … … 1015 1047 { 1016 1048 bRetry = false; 1049 Application.Exit(); 1017 1050 return; 1018 1051 } … … 1020 1053 } while (bRetry == true); 1021 1054 1022 CloseAll(); 1023 m_bExitOK = true; 1024 m_ConnectInfo = tmpInfo; 1025 1026 this.InitializeApp(); 1027 1028 //Create a new document 1029 CGDocument doc = new CGDocument(); 1030 doc.DocManager = _current; 1031 doc.OnNewDocument(); 1032 1055 //Parameter for initialize app tells it that this is a re-login and forces a new access and verify code. 1056 bool isEverythingOkay = this.InitializeApp(true); 1057 1058 //if an error occurred, break out. This time we need to call Application.Exit since it's already running. 1059 if (!isEverythingOkay) 1060 { 1061 Application.Exit(); 1062 return; 1063 } 1064 1065 //Otherwise, everything is okay. So open document and view, then show and activate view. 1066 CGDocument doc = new CGDocument(); 1067 doc.DocManager = _current; 1068 1069 CGView view = new CGView(); 1070 view.InitializeDocView(doc, _current, doc.StartDate, doc.Appointments, _current.WindowText); 1071 1072 view.Show(); 1073 view.Activate(); 1074 1075 //Application.Run need not be called b/c it is already running. 1033 1076 } 1034 1077 catch (Exception ex) … … 1039 1082 } 1040 1083 1084 /// <summary> 1085 /// Accomplishes Re-login into RPMS/VISTA. Now all logic is in this event handler. 1086 /// </summary> 1087 /// <param name="sender">not used</param> 1088 /// <param name="e">not used</param> 1041 1089 private void mnuRPMSLogin_Click(object sender, EventArgs e) 1042 1090 { … … 1048 1096 try 1049 1097 { 1098 // Close All, but tell the Close All method not to call Applicaiton.Exit since we still plan to continue. 1099 // Close All does not call Application.Exit, but CGView_Close handler does 1050 1100 m_bExitOK = false; 1051 1101 CloseAll(); 1052 1102 m_bExitOK = true; 1053 //_current.m_ConnectInfo = new BMXNet.BMXNetConnectInfo();//smh redundant 1054 this.InitializeApp(true); 1055 //Create a new document 1056 CGDocument doc = new CGDocument(); 1057 doc.DocManager = _current; 1058 doc.OnNewDocument(); 1103 1104 //Parameter for initialize app tells it that this is a re-login and forces a new access and verify code. 1105 bool isEverythingOkay = this.InitializeApp(true); 1106 1107 //if an error occurred, break out. This time we need to call Application.Exit since it's already running. 1108 if (!isEverythingOkay) 1109 { 1110 Application.Exit(); 1111 return; 1112 } 1113 1114 //Otherwise, everything is okay. So open document and view, then show and activate view. 1115 CGDocument doc = new CGDocument(); 1116 doc.DocManager = _current; 1117 1118 CGView view = new CGView(); 1119 view.InitializeDocView(doc, _current, doc.StartDate, doc.Appointments, _current.WindowText); 1120 1121 view.Show(); 1122 view.Activate(); 1123 1124 //Application.Run need not be called b/c it is already running. 1059 1125 } 1060 1126 catch (Exception ex)
Note:
See TracChangeset
for help on using the changeset viewer.