Beispiel #1
0
        void TimerUpdateListener_Elapsed(object sender, EventArgs e)
        {
            if (!UpdateMessenger.CanConnect())
            {
                //if there is no connection, let's check updates more rarely
                TimerUpdateListener.Interval = 100 * 1000;
                return;
            }
            //Restore default listen interval if connection exists
            TimerUpdateListener.Interval = UpdateMessenger.ListenInterval;
            //обновим, что данный экземпляр EIDSS ещё живёт
            UpdateMessenger.CreateRunningApps(ModelUserContext.ClientID, AppCode);
            //проверяем не начался ли апдейт
            //апдейт можно игнорировать, если соблюдаются те же бизнес-правила, что и для старта приложения

            if (!UpdateMessenger.CanRunApplication(ModelUserContext.ClientID, AppCode))
            {
                //отключаем один таймер и включаем другой, который через 10 минут принудительно выключит приложение
                TimerUpdateListener.Enabled = false;
                TimerExit.Enabled           = true;
                ErrorForm.ShowMessageDirect(EidssMessages.Get("ApplicationMustBeClosed"));
            }
        }
Beispiel #2
0
        private bool Login()
        {
            if (!BaseFormManager.CloseAll(true))
            {
                return(true);
            }
            if (m_ActivityMonitor != null)
            {
                m_ActivityMonitor.Enabled = false;
            }
            var manager = new EidssSecurityManager();

            manager.LogOut();
            Visible = false;
            if (!LoginForm.DefaultLogin())
            {
                ExitApp(true);
                return(false);
            }

            //reset connection
            UpdateMessenger.SetConnection((SqlConnection)ConnectionManager.CreateNew().Connection);

            //check for can run application
            if (!UpdateMessenger.CanRunApplication(ModelUserContext.ClientID, AppCode))
            {
                ErrorForm.ShowMessageDirect(EidssMessages.Get("ApplicationMustBeClosed"));
                ExitApp(true);
                return(false);
            }

            if (m_Server == null)
            {
                try
                {
                    RemotingServer.Init();
                    RemoteEventManager.Singleton.MainForm = this;
                    m_Server = RemoteEventManager.Singleton;
                }
                catch (Exception)
                {
                    ErrorForm.ShowMessageDirect(EidssMessages.Get("errRemotingSockeError",
                                                                  "Unable to start server for communication with EIDSS Client Agent. Please check that no EIDSS application is started in other Windows session or ask adminisrtators to correct TCP port used by EIDSS. If you see this message, you will be not able to open EIDSS form directly from EIDSS Client Agent. Other EIDSS functionality is not changed."));
                }
            }
            CommonResourcesCache.Reset();
            EIDSS_LookupCacheHelper.Init();
            BaseForm.ReplicationNeeded         = EidssSiteContext.Instance.RealSiteType != SiteType.CDR;
            CustomCultureHelper.CurrentCountry = EidssSiteContext.Instance.CountryID;
            if (EidssSiteContext.Instance.IsAzerbaijanCustomization)
            {
                panel1.BackgroundImage = Properties.Resources.EIDSS_AZ_Background;
                Appearance.BackColor   = Color.White;
            }
            else if (EidssSiteContext.Instance.IsIraqCustomization)
            {
                panel1.BackgroundImage = Properties.Resources.EIDSS_IQ_Background;
                Appearance.BackColor   = Color.White;
                //Appearance.BackColor =Color.FromArgb(96,199,242);
            }
            else if (EidssSiteContext.Instance.IsThaiCustomization)
            {
                panel1.BackgroundImage = Properties.Resources.EIDSS_TH_Logo;
                Appearance.BackColor   = Color.White;
                //Appearance.BackColor =Color.FromArgb(96,199,242);
            }
            else
            {
                panel1.BackgroundImage = Properties.Resources.EIdss_background;
                Appearance.BackColor   = Color.FromArgb(184, 199, 230);
            }
            //eidss.model.Core.EidssSiteContext.Instance.CountryID = EIDSS.model.Core.EidssSiteContext.Instance.CountryID;
            Splash.ShowSplash();
            if (!ReloadMenu())
            {
                return(false);
            }
            Visible = true;
            InitAutoLogoutMonitor();

            if (BaseSettings.ScanFormsMode)
            {
                MessageBox.Show("Change config setting 'ScanFormsMode' to false!!", "ScanFormsMode = true!!");
            }

            return(true);
        }