Esempio n. 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;
        }
Esempio n. 2
0
        public void ResetLanguage(string langID)
        {
            if (Localizer.SupportedLanguages.ContainsKey(langID) == false)
            {
                langID = Localizer.lngEn;
            }
            if (m_LangageInitialized && ModelUserContext.CurrentLanguage == langID)
            {
                return;
            }
            if (!BaseFormManager.CloseNonListForms(true))
            {
                return;
            }
            //if (BaseForm.SaveAllOpenedForms == false)
            //{
            //    return;
            //}
            Cursor = Cursors.WaitCursor;
            try
            {
                Enabled = false;
                //BaseForm.SetEnabled(false);
                SuspendLayout();
                ModelUserContext.CurrentLanguage = langID;
                //Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName
                if (LookupCache.Language != langID)
                {
                    LookupCache.Reload();
                }

                langID = CustomCultureHelper.GetCustomCultureName(langID);
                var cultureInfo = new CultureInfo(langID);
                EidssSiteContext.Instance.UpdateDateTimeFormat(cultureInfo);

                //EidssSiteContext.Instance.Clear();
                if (m_LangageInitialized)
                {
                    EidssEventLog.Instance.CreateEvent(EventType.ClientUILanguageChanged, null, null);
                }
                m_LangageInitialized = true;

                Thread.CurrentThread.CurrentUICulture = cultureInfo;
                Thread.CurrentThread.CurrentCulture   = cultureInfo;
                WinClientContext.InitFont();
                CommonResourcesCache.Reset();
                ToolTipController.InitTooltipController();
                DefaultBarAndDockingController1.InitBarAppearance();
                tbToolbar.Appearance.InitAppearance();
                tbMenu.Appearance.InitAppearance();
                tbStatusbar.Appearance.InitAppearance();
                Appearance.InitAppearance();
                WinClientContext.ApplicationCaption = EidssMessages.Get("EIDSS_Caption",
                                                                        "Electronic Integrated Disease Surveillance System");
                Text = GetCaption(WinClientContext.ApplicationCaption);

                barManager1.RightToLeft = (Localizer.IsRtl) ? DefaultBoolean.True : DefaultBoolean.False;
                RightToLeft             = (Localizer.IsRtl) ? RightToLeft.Yes : RightToLeft.No;
                RightToLeftLayout       = Localizer.IsRtl;

                sbiUser.Caption         = EidssUserContext.User.FullName;
                sbiOrganization.Caption = EidssSiteContext.Instance.OrganizationName;
                sbiSite.Caption         = (EidssSiteContext.Instance.SiteType + @"-" + EidssSiteContext.Instance.SiteCode);
                sbiCountry.Caption      = EidssSiteContext.Instance.CountryName;
                var resources = new ResourceManager(typeof(MainForm));
                sbiCountryLabel.Caption          = resources.GetString("sbiCountryLabel.Caption");
                sbiCountryLabel.Description      = resources.GetString("sbiCountryLabel.Description");
                sbiCountryLabel.Hint             = resources.GetString("sbiCountryLabel.Hint");
                sbiSiteLable.Caption             = resources.GetString("sbiSiteLable.Caption");
                sbiSiteLable.Description         = resources.GetString("sbiSiteLable.Description");
                sbiSiteLable.Hint                = resources.GetString("sbiSiteLable.Hint");
                sbiOrganizationLable.Caption     = resources.GetString("sbiOrganizationLable.Caption");
                sbiOrganizationLable.Description = resources.GetString("sbiOrganizationLable.Description");
                sbiOrganizationLable.Hint        = resources.GetString("sbiOrganizationLable.Hint");
                sbiUserLabel.Caption             = resources.GetString("sbiUserLabel.Caption");
                sbiUserLabel.Description         = resources.GetString("sbiUserLabel.Description");
                sbiUserLabel.Hint                = resources.GetString("sbiUserLabel.Hint");

                DesignControlManager.Create(this);
                RegisterActions();
                BaseFormManager.ResetLanguage();
                EidssSiteContext.ReportFactory.ResetLanguage();
                WinUtils.SwitchInputLanguage();
                BasicSyndromicSurveillanceListItem.Init();
            }
            catch (Exception ex)
            {
                Dbg.Debug(ex.ToString());
            }
            finally
            {
                if (m_LanguageMenu.ToolbarItem != null && m_LanguageMenu.MenuItem != null)
                {
                    if (IsLangMenuWithoutFlags)
                    {
                        m_LanguageMenu.ToolbarItem.Caption = Localizer.GetMenuLanguageName(ModelUserContext.CurrentLanguage);
                    }
                    else
                    {
                        if (ModelUserContext.CurrentLanguage == Localizer.lngEn)
                        {
                            m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.English;
                            m_LanguageMenu.MenuItem.ImageIndex         = (int)MenuIconsSmall.English;
                        }
                        else if (ModelUserContext.CurrentLanguage == Localizer.lngRu)
                        {
                            m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Russian;
                            m_LanguageMenu.MenuItem.ImageIndex         = (int)MenuIconsSmall.Russian;
                        }
                        else if (ModelUserContext.CurrentLanguage == Localizer.lngAzLat)
                        {
                            m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Azery;
                            m_LanguageMenu.MenuItem.ImageIndex         = (int)MenuIconsSmall.Azery;
                        }
                        else if (ModelUserContext.CurrentLanguage == Localizer.lngGe)
                        {
                            m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Georgian;
                            m_LanguageMenu.MenuItem.ImageIndex         = (int)MenuIconsSmall.Georgian;
                        }
                        else if (ModelUserContext.CurrentLanguage == Localizer.lngKz)
                        {
                            m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Kazakhstan;
                            m_LanguageMenu.MenuItem.ImageIndex         = (int)MenuIconsSmall.Kazakhstan;
                        }
                        else if (ModelUserContext.CurrentLanguage == Localizer.lngAr)
                        {
                            m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Armenian;
                            m_LanguageMenu.MenuItem.ImageIndex         = (int)MenuIconsSmall.Armenian;
                        }
                        else if (ModelUserContext.CurrentLanguage == Localizer.lngUk)
                        {
                            m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Ukrainian;
                            m_LanguageMenu.MenuItem.ImageIndex         = (int)MenuIconsSmall.Ukrainian;
                        }
                        else if (ModelUserContext.CurrentLanguage == Localizer.lngIraq)
                        {
                            m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Iraq;
                            m_LanguageMenu.MenuItem.ImageIndex         = (int)MenuIconsSmall.Iraq;
                        }
                        else if (ModelUserContext.CurrentLanguage == Localizer.lngLaos)
                        {
                            m_LanguageMenu.ToolbarItem.LargeImageIndex = -1;
                            m_LanguageMenu.MenuItem.ImageIndex         = -1;
                        }
                        else if (ModelUserContext.CurrentLanguage == Localizer.lngVietnam)
                        {
                            m_LanguageMenu.ToolbarItem.LargeImageIndex = -1;
                            m_LanguageMenu.MenuItem.ImageIndex         = -1;
                        }
                        else if (ModelUserContext.CurrentLanguage == Localizer.lngThai)
                        {
                            m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Thailand;
                            m_LanguageMenu.MenuItem.ImageIndex         = (int)MenuIconsSmall.Thailand;
                        }
                        else
                        {
                            m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.English;
                            m_LanguageMenu.MenuItem.ImageIndex         = (int)MenuIconsSmall.English;
                        }
                    }
                    m_LanguageMenu.ToolbarItem.Hint = Localizer.GetLanguageName(ModelUserContext.CurrentLanguage);
                }
                Enabled = true;
                //BaseForm.SetEnabled(true);
                Cursor = Cursors.Default;
                ResumeLayout();
                BringToFront();
                Activate();
            }
        }