示例#1
0
        public MainForm()
        {
            InitializeComponent();
            BaseFormManager.Init(this);
            BaseFormManager.MainBarManager = barManager1;
            MenuActionManager.Instance     = new MenuActionManager(this, barManager1, tbToolbar, EidssUserContext.User)
            {
                ItemsStorage = EidssMenu.Instance
            };
            WindowState = FormWindowState.Maximized;
            Text        = WinClientContext.ApplicationCaption;
            ToolTipController.InitTooltipController();
            DefaultBarAndDockingController1.InitBarAppearance();
            tbToolbar.Appearance.InitAppearance();
            Dbg.Debug("Application thread ID: {0}", Thread.CurrentThread.ManagedThreadId);
            DefaultLookAndFeel1.LookAndFeel.SkinName = BaseSettings.SkinName; // "SkinsTest_Money Twins";
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            //AUM
            UpdateMessenger     = new UpdateMessenger(new ConnectionCredentials());
            TimerUpdateListener = UpdateMessenger.CreateTimerListener();
            TimerUpdateListener.SynchronizingObject = this;
            TimerUpdateListener.Elapsed            += TimerUpdateListener_Elapsed;
            TimerExit = UpdateMessenger.CreateTimerExit();
            TimerExit.SynchronizingObject = this;
            TimerExit.Elapsed            += TimerExit_Elapsed;
        }
示例#2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Visible = false;
            //set record from journal
            UpdateMessenger.CreateRunningApps(ModelUserContext.ClientID, AppCode);
            //TODO нужна ли эта проверка, если подключение к той же БД, что EIDSS
            //if (UpdateMessenger.WasConnected)
            //{
            TimerUpdateListener.Enabled = true;
            //}
            if (Login() == false)
            {
                return;
            }

            //string commands = Microsoft.VisualBasic.Interaction.Command();
            //Dbg.Debug("eidss is started with command line: {0}", commands);
            //if (!Utils.IsEmpty(commands))
            //{
            //    string[] args = commands.Split(' '.ToString().ToCharArray());
            //    foreach (string cmd in args)
            //    {
            //        switch (cmd.Substring(0, 2))
            //        {
            //            case "\\e":
            //                try
            //                {
            //                    Nullable<long> eventID = Utils.ToNullableLong(cmd.Substring(2));
            //                    if (eventID.HasValue)
            //                    {
            //                        EventList.ShowEventDetail(System.Convert.ToInt32(eventID));
            //                    }
            //                }
            //                catch (Exception)
            //                {
            //                    ErrorForm.ShowError(new EIDSSErrorMessage("errFailToOpenEventDetail", "Fail to open EIDSS notification details."));
            //                }
            //                break;
            //        }
            //    }
            //}


            m_Loaded = true;
        }
示例#3
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);
        }