Exemple #1
0
        private void cmbUser_SelectedIndexChanged(object sender, EventArgs e)
        {
            BioSeqDBLogin frmLogin = new BioSeqDBLogin(cmbUser.Text.Trim().ToUpper(), null);

            if (frmLogin.ShowDialog() != DialogResult.OK)
            {
                cmbUser.SelectedIndexChanged -= cmbUser_SelectedIndexChanged;
                cmbUser.Text = AppConfigHelper.LastUser;
                cmbUser.SelectedIndexChanged += cmbUser_SelectedIndexChanged;
                return;
            }

            AppConfigHelper.Logout(); // Logout current user (just to record the time of logout).

            AppConfigHelper.LastUser = cmbUser.Text;
            AppConfigHelper.SaveConfigGlobal();
            AppConfigHelper.LoggedOnUser = cmbUser.Text;

            cmbUser.SelectedIndexChanged -= cmbUser_SelectedIndexChanged;

            Initialize();
            Visible = true;
            //AppConfigHelper.StartTimer();
            Cursor.Current = Cursors.Default;
            if (Size.Width != 0)
            {
                Location = AppConfigHelper.UILocation();
                if (Location.X <= 0)
                {
                    Location = new Point(100, 100);
                }
                Size = AppConfigHelper.UISize();
                if (Size.Height <= 0 || Size.Width <= 0)
                {
                    Size = new Size(3000, 1500);
                }
            }
            cmbUser.SelectedIndexChanged += cmbUser_SelectedIndexChanged;
        }
Exemple #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            s_Mutex = new Mutex(true, "BioSeqDB");

            if (!s_Mutex.WaitOne(0, false))
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            Logger.Initialize(logger);

            UserProfileHelper.GetUserProfile(); // From C:\Temp\Remember.json.

            Properties.Settings.Default.ModelServer = UserProfileHelper.userProfile.ServerIPAddress;
            //MessageBox.Show("ServerIPAddress: " + Properties.Settings.Default.ModelServer, "ERROR", MessageBoxButtons.OK);
            Properties.Settings.Default.Save();

            // Check if BioSeqService is listening.
            string IsClientOnServer = string.Empty;

            try
            {
                IsClientOnServer = ServiceCallHelper.HelloBioSeqDBService();
            }
            catch (Exception ex)
            {
                MessageBox.Show("It appears that the BioSeqDB service is not running on the '" + Properties.Settings.Default.ModelServer +
                                "' server.  Check VPN if running remotely?", "ERROR", MessageBoxButtons.OK);
                return;
            }

            // Check if WSLProxy is listening.
            try
            {
                string message = BioSeqDBModel.Instance.WSLVersion();
            }
            catch (Exception ex)
            {
                MessageBox.Show("It appears that the WSLProxy service is not running on the '" + Properties.Settings.Default.ModelServer +
                                "' server.", "ERROR", MessageBoxButtons.OK);
                Logger.Log.Debug("It appears that the WSLProxy service is not running on the server. Exception\n" + ex.ToString());
                return;
            }

            try
            {
                BioSeqDBLogin frmLogin = new BioSeqDBLogin(IsClientOnServer);
                if (frmLogin.ShowDialog() == DialogResult.OK)
                {
                    Application.Run(new BioSeqUI());
                }
            }
            catch (Exception ex)
            {
                Logger.Log.Debug("Fatal error: " + ex.ToString());
                MessageBox.Show(ex.ToString(), "ERROR", MessageBoxButtons.OK);
            }
        }