Example #1
0
        public static int Main(string[] args)
        {
            Client           client     = null;
            ClientController controller = null;

            try
            {
                System.Windows.Forms.Application.EnableVisualStyles();

                log4net.Config.XmlConfigurator.Configure();

                configSection = ConfigurationManager.GetSection("quantmodel") as QuantmodelConfiguration;

                SelectConnectionForm scf = new SelectConnectionForm(configSection);

                if (scf.ShowDialog() == DialogResult.OK)
                {
                    ChangeLogFileName("LogFileAppender", scf.ConnectionElement.Name + ".log");
                    controller = new ClientController(scf.ConnectionElement);
                    client     = new Client(controller);

                    System.Windows.Forms.Application.DoEvents();
                    System.Windows.Forms.Application.Run(client);
                }
            }
            catch (Exception e)
            {
                log.Fatal("Client error:", e);

                //
                //  Show error dialog
                //

                System.Windows.Forms.MessageBox.Show(
                    "The client has encountered a fatal error and must be closed: " + e.ToString(),
                    "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            //try
            //{
            //    log4net.Config.XmlConfigurator.Configure();
            //    QuantmodelConfiguration section =
            //        ConfigurationManager.GetSection( "quantmodel" )
            //            as QuantmodelConfiguration;
            //
            //    System.Windows.Forms.MessageBox.Show( "DateTime Format: " +
            //        section.DatetimeFormat + ", FCM: " + section.FcmId );
            //}
            //catch( Exception e )
            //{
            //    System.Windows.Forms.MessageBox.Show(
            //        "The client has encountered a fatal error and must be closed: " + e.ToString(),
            //        "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
            //}

            return(0);
        }
Example #2
0
 public SelectConnectionForm(QuantmodelConfiguration configSection)
 {
     config            = configSection;
     connectionElement = null;
     InitializeComponents();
 }