Пример #1
0
 public override void ApplyResources(string cultureCode)
 {
     ResourcesList.Clear();
     EditableControlsList.Clear();
     foreach (GridColumn col in GridView.Columns)
     {
         string captionId = GetKeyForComponent(col, DesignElement.Caption);
         var    resValue  = CommonResourcesCache.Get("EidssFields", cultureCode, captionId, GetViewNameForSplittedResources());
         string propName  = TranslationToolHelper.GetPropertyName(col.Name, TranslationToolHelper.CaptionPropName);
         if (resValue != null && resValue.Value is string)
         {
             if (!ResourcesList.ContainsKey(propName))
             {
                 ResourcesList.Add(propName, resValue);
             }
             col.Caption = resValue.Value.ToString();
         }
         else
         {
             if (!ResourcesList.ContainsKey(propName))
             {
                 ResourcesList.Add(propName, new ResourceValue
                 {
                     Value = col.Caption,
                     //RawValue = col.Caption,
                     //SourceFileName = string.Format("EidssFields.{0}.resx", cultureCode),
                     EnglishText  = WinClientContext.FieldCaptions.GetString(captionId, null, common.Core.Localizer.lngEn),
                     SourceKey    = captionId,
                     ResourceName = CommonResource.EidssFields.ToString()
                 });
             }
         }
         EditableControlsList.Add(propName, col);
     }
 }
Пример #2
0
        public override void ApplyResources(string cultureCode)
        {
            ResourcesList.Clear();
            foreach (Control ctl in Controls)
            {
                var action = ctl.Tag as ActionMetaItem;
                if (action != null)
                {
                    string s        = action.CaptionId(BusinessObject, Permissions);
                    var    resValue = CommonResourcesCache.Get(CommonResource.BvMessages.ToString(), cultureCode, s, GetViewNameForSplittedResources());
                    var    propName = TranslationToolHelper.GetPropertyName(ctl.Name, TranslationToolHelper.TextPropName);
                    if (resValue == null && Messages != null)
                    {
                        resValue = CommonResourcesCache.Get(Messages.GetType().Name, cultureCode, s, GetViewNameForSplittedResources());
                    }
                    if (resValue != null)
                    {
                        ResourcesList.Add(propName, resValue);
                        ctl.Text = resValue.Value.ToString();

                        if (!EditableControlsList.ContainsKey(propName))
                        {
                            EditableControlsList.Add(propName, ctl);
                        }
                    }
                }
                else if (BasePanel != null && !(ctl is TranslationButton))
                {
                    TranslationToolHelperWinClient.ApplyResources(ctl, BasePanel as ITranslationView, cultureCode);
                }
            }
        }
Пример #3
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();
            }
        }
Пример #4
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);
        }