public MainServerForm()
        {
            if (instance != null)
            {
                throw new Exception("Cannot create more than one instance of MainServerForm.");
            }
            instance = this;

            InitializeComponent();

            this.Text = "Atticus Server " + DataStructures.Information.VersionString;

            AtticusSplashForm splash = new AtticusSplashForm();
            splash.Show();

            this.serverNameTextBox.Text = AtticusServer.server.serverSettings.ServerName;
            this.listBox1.Items.Clear();

            foreach (DeviceSettings ds in AtticusServer.server.serverSettings.myDevicesSettings.Values)
            {
                this.listBox1.Items.Add(ds);
            }

            hcList.Items.Clear();
            foreach (HardwareChannel hc in AtticusServer.server.MyHardwareChannels)
            {
                hcList.Items.Add(hc);
            }

            serverSettingsPropertyGrid.SelectedObject = AtticusServer.server.serverSettings;

            updateHardwareChannelCount();
        }
        public MainServerForm()
        {
            if (instance != null)
            {
                throw new Exception("Cannot create more than one instance of MainServerForm.");
            }
            instance = this;

            InitializeComponent();

            this.Text = "Atticus Server " + DataStructures.Information.VersionString;

            AtticusSplashForm splash = new AtticusSplashForm();

            splash.Show();

            this.serverNameTextBox.Text = AtticusServer.server.serverSettings.ServerName;
            this.listBox1.Items.Clear();

            foreach (DeviceSettings ds in AtticusServer.server.serverSettings.myDevicesSettings.Values)
            {
                this.listBox1.Items.Add(ds);
            }

            hcList.Items.Clear();
            foreach (HardwareChannel hc in AtticusServer.server.MyHardwareChannels)
            {
                hcList.Items.Add(hc);
            }

            serverSettingsPropertyGrid.SelectedObject = AtticusServer.server.serverSettings;

            updateHardwareChannelCount();
        }
Ejemplo n.º 3
0
        static void Main()
        {
            /*
             * // demand high security permissions for Atticus. This may help improve performance?
             *
             * SecurityPermission perm = new SecurityPermission(SecurityPermissionFlag.AllFlags);
             * perm.Assert();
             *
             * */

            try
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                try
                {
                    NationalInstruments.NI4882.Address      testObject  = new NationalInstruments.NI4882.Address();
                    NationalInstruments.DAQmx.CouplingTypes testObject2 = new NationalInstruments.DAQmx.CouplingTypes();
                }
                catch (Exception)
                {
                    MessageBox.Show("Unable to load National Instruments DAQmx libraries. You may have an older version of these libraries installed. Please install the latest version of DAQmx. Press OK to see the detailed exception.", "Unable to load DAQmx libraries.");
                    throw;
                }



                // Maximum server uptime: 1000 days. Lets see if this solves some of those "disconnection" issues we had
                System.Runtime.Remoting.Lifetime.LifetimeServices.LeaseTime = new TimeSpan(1000, 0, 0, 0, 0);


                ServerSettings serverSettings;
                String         serverSettingsFilesName = FileNameStrings.DefaultServerSettingsDataFile;

                try
                {
                    serverSettings = loadServerSettings(serverSettingsFilesName);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception when attempting to load server settings.");
                    Console.WriteLine("Proceeding with blank settings.");
                    serverSettings = new ServerSettings();
                }


                Console.WriteLine("Creating AtticusServerRuntime object...");

                server = new AtticusServerCommunicator(serverSettings);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                MainServerForm form = new MainServerForm();

                server.updateGUI += form.updateGUI;
                server.registerMessageEventHandler(form.addMessageLogText);



                Application.Run(form);



                saveServerSettings(AppDomain.CurrentDomain.BaseDirectory + FileNameStrings.DefaultServerSettingsDataFile, serverSettings);
            }
            catch (Exception e)
            {
                display_unhandled_exception(e);
            }
        }
Ejemplo n.º 4
0
        static void Main()
        {
            /*
             * // demand high security permissions for Atticus. This may help improve performance?

            SecurityPermission perm = new SecurityPermission(SecurityPermissionFlag.AllFlags);
            perm.Assert();

             * */

            try
            {

                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                try
                {
                    NationalInstruments.NI4882.Address testObject = new NationalInstruments.NI4882.Address();
                    NationalInstruments.DAQmx.CouplingTypes testObject2 = new NationalInstruments.DAQmx.CouplingTypes();
                }
                catch (Exception)
                {
                    MessageBox.Show("Unable to load National Instruments DAQmx libraries. You may have an older version of these libraries installed. Please install the latest version of DAQmx. Press OK to see the detailed exception.", "Unable to load DAQmx libraries.");
                    throw;
                }

                // Maximum server uptime: 1000 days. Lets see if this solves some of those "disconnection" issues we had
                System.Runtime.Remoting.Lifetime.LifetimeServices.LeaseTime = new TimeSpan(1000, 0, 0, 0, 0);

                ServerSettings serverSettings;
                String serverSettingsFilesName = FileNameStrings.DefaultServerSettingsDataFile;

                try
                {
                    serverSettings = loadServerSettings(serverSettingsFilesName);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception when attempting to load server settings.");
                    Console.WriteLine("Proceeding with blank settings.");
                    serverSettings = new ServerSettings();
                }

                Console.WriteLine("Creating AtticusServerRuntime object...");

                server = new AtticusServerCommunicator(serverSettings);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                MainServerForm form = new MainServerForm();

                server.updateGUI += form.updateGUI;
                server.messageLog += form.addMessageLogText;

                Application.Run(form);

                saveServerSettings(AppDomain.CurrentDomain.BaseDirectory +  FileNameStrings.DefaultServerSettingsDataFile, serverSettings);
            }
            catch (Exception e)
            {
                display_unhandled_exception(e);
            }
        }