Changes between Version 9 and Version 10 of SchedulingGUI


Ignore:
Timestamp:
Aug 7, 2011, 9:06:21 PM (13 years ago)
Author:
Sam Habiel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SchedulingGUI

    v9 v10  
    3131 * Full UTF-8 support if the Mumps Database supports it.
    3232 * L18N for Arabic
     33== What is the Scheduling GUI written in? ==
     34The client is in C# using the .Net 4.0 libraries on MS Windows. The Windowing library used is WinForms 2.0. The database side uses Plain Jane remote procedures over a custom broker developed by Indian Health Service called BMX that provides ADO.net support to Fileman. Currently, most remote procedures are very heavy Mumps.
    3335
     36== Show me some code! ==
     37This is the C# code that inits the Scheduling GUI.
     38{{{
     39#!java
     40#if DEBUG
     41        //To write to the console
     42        [DllImport("kernel32.dll")]
     43        static extern bool AttachConsole(int dwProcessId);
     44        private const int ATTACH_PARENT_PROCESS = -1;
     45#endif
     46        /// <summary>
     47        /// Main Entry Point
     48        /// </summary>
     49        /// <param name="args">We accept the following Arguments:
     50        /// /s or -s = Server ip address or name
     51        /// /p or -p = port number (must be numeric)
     52        /// /a or -a = Access Code
     53        /// /v or -v = Verify Code
     54        /// /e or -e = Encoding (name of encoding as known to windows, such as windows-1256)
     55        /// /culture or -culture = Culture Name for UI Culture if you wish to override the Windows Culture
     56        /// </param>
     57        /// <remarks>
     58        /// Encoding decision is complex. This is the order of priority:
     59        /// - If the M DB runs in UTF-8, that's what we are going to use.
     60        /// - If that's not so, /e sets the default encoding. If /e is a non-existent encoding, move to next step.
     61        /// - If /e is not supplied or is not recognized, the default encoding is the Windows default Encoding for the user.
     62        /// </remarks>
     63        [STAThread()]
     64        static void Main(string[] args)
     65        {
     66            //Application wide error handler for unhandled errors (later I figure out that's only for WinForm ex'es)
     67            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
     68            Application.ThreadException += new ThreadExceptionEventHandler(App_ThreadException);
     69
     70            // Add the event handler for handling non-UI thread exceptions to the event.
     71            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(App_DomainException);
     72
     73#if DEBUG
     74            // Print console messages to console if launched from console
     75            // Note: Imported From kernel32.dll
     76            AttachConsole(ATTACH_PARENT_PROCESS);
     77#endif
     78
     79#if TRACE
     80            DateTime startLoadTime = DateTime.Now;
     81#endif
     82
     83            //Store a class instance of manager. Actual constructor does nothing.
     84            _current = new CGDocumentManager();
     85
     86            //Get command line options; store in private class wide variables
     87            var opset = new OptionSet() {
     88                { "s=", s => _current.m_Server = s },
     89                { "p=", p => _current.m_Port = int.Parse(p) },
     90                { "a=", a => _current.m_AccessCode = a },
     91                { "v=", v => _current.m_VerifyCode = v },
     92                { "e=", e => _current.m_Encoding = e},
     93                { "culture=", culture => _current.m_CultureName = culture }
     94            };
     95
     96            opset.Parse(args);
     97           
     98            //Init app
     99            bool isEverythingOkay = _current.InitializeApp();
     100
     101            //if an error occurred, break out.
     102            if (!isEverythingOkay) return;
     103
     104            //Create the first empty document
     105            //A document holds the resources, appointments, and availabilites
     106            //SAM: Good place for break point
     107            CGDocument doc = new CGDocument();
     108            doc.DocManager = _current;
     109
     110            //Create new View
     111            //A view is a specific arrangement of appointments and availabilites that constitute a document
     112            CGView view = new CGView();
     113            view.InitializeDocView(doc, _current, doc.StartDate, _current.WindowText);
     114
     115            //Handle BMX Event
     116            Application.DoEvents();
     117
     118            //test
     119            //doc.ThrowException();
     120            //test
     121
     122#if TRACE
     123            DateTime EndLoadTime = DateTime.Now;
     124            TimeSpan LoadTime = EndLoadTime - startLoadTime;
     125            Debug.Write("Load Time for GUI is " + LoadTime.Seconds + " s & " + LoadTime.Milliseconds + " ms\n");
     126#endif
     127           
     128            view.Show();
     129            view.Activate();
     130           
     131            Application.Run();
     132        }
     133}}}