private void UpdateControls()
        {
            var parts = GKUtils.GetNameParts(fPersonalName);

            txtSurname.Text           = parts.Surname;
            txtName.Text              = parts.Name;
            txtPatronymic.Text        = parts.Patronymic;
            cmbNameType.SelectedIndex = (int)fPersonalName.NameType;

            txtNamePrefix.Text    = fPersonalName.Pieces.Prefix;
            txtNickname.Text      = fPersonalName.Pieces.Nickname;
            txtSurnamePrefix.Text = fPersonalName.Pieces.SurnamePrefix;
            txtNameSuffix.Text    = fPersonalName.Pieces.Suffix;

            txtMarriedSurname.Text = fPersonalName.Pieces.MarriedName;

            if (!IsExtendedWomanSurname())
            {
                lblSurname.Text           = LangMan.LS(LSID.LSID_Surname);
                txtMarriedSurname.Enabled = false;
            }
            else
            {
                lblSurname.Text           = LangMan.LS(LSID.LSID_MaidenSurname);
                txtMarriedSurname.Enabled = true;
            }

            ICulture culture = fBase.Context.Culture;

            txtSurname.Enabled    = txtSurname.Enabled && culture.HasSurname();
            txtPatronymic.Enabled = txtPatronymic.Enabled && culture.HasPatronymic();
        }
Example #2
0
 private void InitFields(StreamingContext context)
 {
     if (_culture == null)
     {
         _culture = new Culture();
     }
 }
        public void _loadUdl <__t>(__t nT, string nUrl) where __t : IUdl
        {
            if (!this._isUdl(nUrl))
            {
                return;
            }
            if (!this._haveUdl(nUrl))
            {
                return;
            }
            string        udlHeadstreamUrl_ = nUrl + @"*$descriptor.xml";
            UdlHeadstream udlHeadstream_    = nT._getUdlHeadstream();

            this._readHeadstream(udlHeadstream_, udlHeadstreamUrl_);

            ICulture culture_        = this._currentCulture();
            string   cultureName_    = culture_._cultureName();
            string   stringTableUrl_ = nUrl + "*$";

            stringTableUrl_ += cultureName_;
            stringTableUrl_ += ".stringTable.xml";
            if (!this._haveUfl(stringTableUrl_))
            {
                stringTableUrl_ = nUrl + "*$stringTable.xml";
            }
            if (this._haveUfl(stringTableUrl_))
            {
                StringTable stringTable_ = nT._getStringTable();
                this._readHeadstream(stringTable_, stringTableUrl_);
            }
        }
 public ImplementerController(ApplicationDbContext context,
                              IUserSession session,
                              ICulture culture)
 {
     _context = context;
     _session = session;
     _culture = culture;
 }
 public LookupsController(ApplicationDbContext context,
                          ICulture culture,
                          IUserSession session)
 {
     _context = context;
     _culture = culture;
     _session = session;
 }
Example #6
0
 public NamePartsRet(string maidenSurname, string marriedSurname, string name, string patronymic, ICulture culture)
 {
     Surname        = maidenSurname;
     MarriedSurname = marriedSurname;
     Name           = name;
     Patronymic     = patronymic;
     Culture        = culture;
 }
 public ProvinceController(ApplicationDbContext context,
                           IUserSession session,
                           ICulture culture)
 {
     _context = context;
     _session = session;
     _culture = culture;
 }
Example #8
0
        private void SetTarget(GEDCOMIndividualRecord value)
        {
            try
            {
                fTarget = value;

                if (fTarget != null)
                {
                    ICulture    culture    = fBase.Context.Culture;
                    INamesTable namesTable = AppHost.NamesTable;

                    var parts = GKUtils.GetNameParts(fTarget);
                    txtSurname.Text = parts.Surname;
                    GEDCOMSex sx = (GEDCOMSex)cmbSex.SelectedIndex;

                    switch (fTargetMode)
                    {
                    case TargetMode.tmParent:
                        if (sx == GEDCOMSex.svFemale)
                        {
                            SetMarriedSurname(parts.Surname);
                        }
                        if (culture.HasPatronymic())
                        {
                            cmbPatronymic.Items.Add(namesTable.GetPatronymicByName(parts.Name, GEDCOMSex.svMale));
                            cmbPatronymic.Items.Add(namesTable.GetPatronymicByName(parts.Name, GEDCOMSex.svFemale));
                            cmbPatronymic.Text = namesTable.GetPatronymicByName(parts.Name, sx);
                        }
                        break;

                    case TargetMode.tmChild:
                        switch (sx)
                        {
                        case GEDCOMSex.svMale:
                            if (culture.HasPatronymic())
                            {
                                txtName.Text = namesTable.GetNameByPatronymic(parts.Patronymic);
                            }
                            break;

                        case GEDCOMSex.svFemale:
                            SetMarriedSurname(parts.Surname);
                            break;
                        }
                        break;

                    case TargetMode.tmWife:
                        SetMarriedSurname(parts.Surname);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogWrite("PersonEditDlg.SetTarget(" + fTargetMode.ToString() + "): " + ex.Message);
            }
        }
 public UserSession(ApplicationDbContext context, ICulture culture, UserManager <AppUser> userManager
                    , SignInManager <AppUser> signInManager, IHttpContextAccessor httpContextAccessor)
 {
     _context             = context;
     _culture             = culture;
     _userManager         = userManager;
     _signInManager       = signInManager;
     _httpContextAccessor = httpContextAccessor;
 }
Example #10
0
        private void SetTarget(GDMIndividualRecord value)
        {
            try {
                fTarget = value;

                if (fTarget != null)
                {
                    ICulture    culture    = fBase.Context.Culture;
                    INamesTable namesTable = AppHost.NamesTable;

                    var parts = GKUtils.GetNameParts(fTarget);
                    fView.Surname.Text = parts.Surname;
                    GDMSex sx = (GDMSex)fView.SexCombo.SelectedIndex;

                    switch (fTargetMode)
                    {
                    case TargetMode.tmParent:
                        if (sx == GDMSex.svFemale)
                        {
                            SetMarriedSurname(parts.Surname);
                        }
                        if (culture.HasPatronymic())
                        {
                            AddPatronymic(namesTable.GetPatronymicByName(parts.Name, GDMSex.svMale));
                            AddPatronymic(namesTable.GetPatronymicByName(parts.Name, GDMSex.svFemale));
                            fView.Patronymic.Text = namesTable.GetPatronymicByName(parts.Name, sx);
                        }
                        break;

                    case TargetMode.tmChild:
                        switch (sx)
                        {
                        case GDMSex.svMale:
                            if (culture.HasPatronymic())
                            {
                                fView.Name.Text = namesTable.GetNameByPatronymic(parts.Patronymic);
                            }
                            break;

                        case GDMSex.svFemale:
                            SetMarriedSurname(parts.Surname);
                            break;
                        }
                        break;

                    case TargetMode.tmSpouse:
                        if (sx == GDMSex.svFemale)
                        {
                            SetMarriedSurname(parts.Surname);
                        }
                        break;
                    }
                }
            } catch (Exception ex) {
                Logger.WriteError("PersonEditDlg.SetTarget(" + fTargetMode.ToString() + ")", ex);
            }
        }
Example #11
0
        public bool Add(ICulture value)
        {
            if (this.m_Cultures.ContainsKey(value.CultureName))
            {
                return(false);
            }

            this.m_Cultures.Add(value.CultureName, value);
            return(true);
        }
        public void UpdateControls(bool totalUpdate = false)
        {
            UpdateParents();

            if (totalUpdate)
            {
                fView.EventsList.UpdateSheet();
                fView.NotesList.UpdateSheet();
                fView.MediaList.UpdateSheet();
                fView.SourcesList.UpdateSheet();
                fView.AssociationsList.UpdateSheet();

                fView.GroupsList.UpdateSheet();
                fView.NamesList.UpdateSheet();
                fView.SpousesList.UpdateSheet();
                fView.UserRefList.UpdateSheet();
                fView.ParentsList.UpdateSheet();
            }

            UpdatePortrait(totalUpdate);

            bool locked = (fView.RestrictionCombo.SelectedIndex == (int)GEDCOMRestriction.rnLocked);

            // controls lock
            fView.Name.Enabled       = !locked;
            fView.Patronymic.Enabled = !locked;
            fView.Surname.Enabled    = !locked;

            fView.SexCombo.Enabled  = !locked;
            fView.Patriarch.Enabled = !locked;
            fView.Bookmark.Enabled  = !locked;

            fView.NamePrefix.Enabled    = !locked;
            fView.Nickname.Enabled      = !locked;
            fView.SurnamePrefix.Enabled = !locked;
            fView.NameSuffix.Enabled    = !locked;

            fView.EventsList.ReadOnly       = locked;
            fView.NotesList.ReadOnly        = locked;
            fView.MediaList.ReadOnly        = locked;
            fView.SourcesList.ReadOnly      = locked;
            fView.SpousesList.ReadOnly      = locked;
            fView.AssociationsList.ReadOnly = locked;
            fView.GroupsList.ReadOnly       = locked;
            fView.UserRefList.ReadOnly      = locked;
            fView.ParentsList.ReadOnly      = locked;

            ICulture culture = fBase.Context.Culture;

            fView.Surname.Enabled    = fView.Surname.Enabled && culture.HasSurname();
            fView.Patronymic.Enabled = fView.Patronymic.Enabled && culture.HasPatronymic();
        }
Example #13
0
 public override void Update()
 {
     if (GlobalConstants.GameManager?.Initialised == true)
     {
         this.Done = true;
         ICulture culture = GlobalConstants.GameManager.Roller.SelectFromCollection(
             GlobalConstants.GameManager.CultureHandler.Values);
         this.GUIManager.SetUIColours(
             culture.BackgroundColours,
             culture.CursorColours,
             culture.FontColours);
     }
 }
Example #14
0
        public void LoadGame()
        {
            WorldSerialiser worldSerialiser = new WorldSerialiser(GlobalConstants.GameManager.ObjectIconHandler);
            IWorldInstance  overworld       = worldSerialiser.Deserialise("Everse");
            ICulture        playerCulture   = GlobalConstants.GameManager.EntityHandler.GetPlayer().Cultures.First();

            GlobalConstants.GameManager.GUIManager.CloseAllGUIs();
            GlobalConstants.GameManager.GUIManager.SetUIColours(
                playerCulture.BackgroundColours,
                playerCulture.CursorColours,
                playerCulture.FontColours);
            GlobalConstants.GameManager.SetNextState(new WorldInitialisationState(overworld, overworld.GetPlayerWorld(overworld)));
        }
Example #15
0
        private void SetMarriedSurname(ICulture culture, string husbSurname)
        {
            string surname = culture.GetMarriedSurname(husbSurname);

            if (IsExtendedWomanSurname())
            {
                fView.MarriedSurname.Text = surname;
            }
            else
            {
                fView.Surname.Text = "(" + surname + ")";
            }
        }
Example #16
0
        private void UnitsFetched(object sender, StatsListFetchedEvent e)
        {
            var      rows    = e.Rows;
            ICulture culture = Resolver.Instance.Get <ICulture>();

            if (rows == null || rows.Count <= 0)
            {
                this._swipeRefreshable.SetIsBusy(false);
                if (!ActivityBase.ConnectedToNetwork && this._historyTable.ChildCount == 0)
                {
                    this._snackBar = this.ActivityBase.ShowSnackbar(Resource.Id.pager, Resource.String.stats_refresh_prompt);
                }
                else if (!ActivityBase.ConnectedToNetwork && this._historyTable.ChildCount > 0)
                {
                    Toast.MakeText(this.Activity, Resource.String.unable_to_sync_internet, ToastLength.Long).Show();
                }

                return;
            }

            _historyTable.RemoveAllViews();

            foreach (var item in rows.Take(_displayCount))
            {
                DateTime rowDate;
                DateTime.TryParseExact(item.Items[1], culture.GetShortDateFormat(), CultureInfo.InvariantCulture, DateTimeStyles.None, out rowDate);
                View rowView = this.BindingInflate(Resource.Layout.layout_units_history_row, null);

                rowView.FindViewById <TextView>(Resource.Id.valueDay).Text = item.Items[0];

                rowView.FindViewById <TextView>(Resource.Id.valueDate).Text = item.Items[1];

                rowView.FindViewById <TextView>(Resource.Id.valueAcquired).Text = item.Items[2];
                rowView.FindViewById <TextView>(Resource.Id.valueStarted).Text  = item.Items[3];
                rowView.FindViewById <TextView>(Resource.Id.valueRemoved).Text  = item.Items[4];

                if (rowDate == DateTime.Today)
                {
                    rowView.FindViewById <TextView>(Resource.Id.today_text).Visibility =
                        ViewStates.Visible;
                }

                _historyTable.AddView(rowView);
            }

            this._swipeRefreshable.SetIsBusy(false);
            if (this._snackBar != null)
            {
                this._snackBar.Dismiss();
            }
        }
        protected override ITopic[] FetchNextTopics()
        {
            IEntity listener   = this.ConversationEngine.Listener;
            IEntity instigator = this.ConversationEngine.Instigator;
            List <IRelationship> relationships = this.RelationshipHandler
                                                 .Get(new[] { instigator.Guid, listener.Guid })
                                                 .ToList();

            if (listener.Romance.WillRomance(listener, instigator, relationships) &&
                instigator.Romance.WillRomance(instigator, listener, relationships))
            {
                ICulture cultureResult    = this.Roller.SelectFromCollection(listener.Cultures);
                string   relationshipType = this.Roller.SelectFromCollection(cultureResult.RelationshipTypes);

                IRelationship selectedRelationship = this.RelationshipHandler.RelationshipTypes.First(relationship =>
                                                                                                      relationship.Name.Equals(relationshipType, StringComparison.OrdinalIgnoreCase));

                relationships = this.RelationshipHandler.GetAllForObject(instigator.Guid).ToList();

                bool unique = relationships.Any(relationship =>
                                                relationship.Name.Equals(selectedRelationship.Name) &&
                                                relationship.UniqueTags.Intersect(selectedRelationship.UniqueTags).Any());

                relationships = this.RelationshipHandler.GetAllForObject(listener.Guid).ToList();

                unique |= relationships.Any(relationship =>
                                            relationship.Name.Equals(selectedRelationship.Name) &&
                                            relationship.UniqueTags.Intersect(selectedRelationship.UniqueTags).Any());

                if (unique == false)
                {
                    return(new ITopic[]
                    {
                        new RomancePresentation(selectedRelationship)
                    });
                }
            }
            return(new ITopic[]
            {
                new TopicData(
                    new ITopicCondition[0],
                    "RomanceTurnDown",
                    new[] { "BaseTopics" },
                    "Uh, no thanks.",
                    new [] { "relationship", "negative", "romance" },
                    0,
                    null,
                    Speaker.LISTENER)
            });
        }
Example #18
0
        public ICulture GetCultureByNameOrGetDefault(string cultureName)
        {
            ICulture resultCulture = m_cultureUoW.GetCultureByName(cultureName);

            if (resultCulture == null)
            {
                if (m_logger.IsErrorEnabled())
                {
                    m_logger.LogError(
                        $"Culture {cultureName} from library configuration is not in database.");
                }

                resultCulture = GetDefaultCulture();
            }

            return(resultCulture);
        }
Example #19
0
        public void ImportNames(IBaseContext context, GDMIndividualRecord iRec)
        {
            if (context == null || iRec == null)
            {
                return;
            }

            var persName = (iRec.PersonalNames.Count > 0) ? iRec.PersonalNames[0] : null;

            if (persName == null)
            {
                return;
            }

            ICulture culture = GKUtils.DefineCulture(context.Tree, persName);

            if (culture == null || !culture.HasPatronymic())
            {
                return;
            }

            try {
                var    parts     = GKUtils.GetNameParts(context.Tree, iRec, persName, false);
                string childName = parts.Name;
                string childPat  = parts.Patronymic;

                GDMSex iSex = iRec.Sex;
                SetNameSex(childName, iSex);

                GDMFamilyRecord     fam    = context.Tree.GetParentsFamily(iRec);
                GDMIndividualRecord father = (fam == null) ? null : context.Tree.GetPtrValue(fam.Husband);

                if (father != null)
                {
                    parts = GKUtils.GetNameParts(context.Tree, father, false);
                    string fatherName = parts.Name;

                    if (IsComparable(fatherName, childPat))
                    {
                        SetName(fatherName, childPat, iSex);
                    }
                }
            } catch (Exception ex) {
                Logger.WriteError("NamesTable.ImportName()", ex);
            }
        }
Example #20
0
        void _cidUrl(string nUrl)
        {
            string temp_ = nUrl.Substring(6);

            if (null == temp_ || @"" == temp_)
            {
                return;
            }
            PlatformSingleton platformSingleton_ = __singleton <PlatformSingleton> ._instance();

            ICulture culture_ = platformSingleton_._currentCulture();

            mResult_  = culture_._cultureName();
            mResult_ += @".";
            mResult_ += temp_;
            mUrlType  = UrlType_.mCid_;
        }
 private void Culture_SelectedIndexChanged(object sender, EventArgs e)
 {
     selectedCulture = Culture.CreateCulture(GenerationConfiguration.Culture, GenerationConfiguration.UseCitizens, GenerationConfiguration.UseMishaps);
     if (selectedCulture is Classic.Zhodani.Culture)
     {
         // Psionic training and the like are handled at the "Culture" level
         ((Classic.Zhodani.Culture)selectedCulture).SkillOffered += SkillOffered;
     }
     if (selectedCulture != null)
     {
         Species.Clear();
         var list = selectedCulture.Species(generationStyle).Keys.ToList();
         foreach (var s in list)
         {
             Species.Add(s);
         }
     }
 }
        public void UpdateStatsTypes()
        {
            ICulture culture = fBase.Context.Culture;

            fView.StatsType.BeginUpdate();
            fView.StatsType.Clear();
            for (StatsMode sm = StatsMode.smAncestors; sm <= StatsMode.smLast; sm++)
            {
                if (sm == StatsMode.smPatronymics && !culture.HasPatronymic())
                {
                    continue;
                }

                GKData.StatsTitleStruct tr = GKData.StatsTitles[(int)sm];
                fView.StatsType.Add(LangMan.LS(tr.Title));
            }
            fView.StatsType.EndUpdate();
        }
        public __t _loadStdUdl <__t>(string nStdUdl, string nUrl) where __t : IStdUdl
        {
            if (!this._isUdl(nUrl))
            {
                return(default(__t));
            }
            if (!this._haveUdl(nUrl))
            {
                return(default(__t));
            }
            __t result_ = this._findInterface <__t>(nStdUdl);

            string        udlHeadstreamUrl_ = nUrl + @"*$descriptor.xml";
            UdlHeadstream udlHeadstream_    = result_._getUdlHeadstream();

            this._readHeadstream(udlHeadstream_, udlHeadstreamUrl_);

            ICulture culture_        = this._currentCulture();
            string   cultureName_    = culture_._cultureName();
            string   stringTableUrl_ = nUrl + "*$";

            stringTableUrl_ += cultureName_;
            stringTableUrl_ += ".stringTable.xml";
            if (!this._haveUfl(stringTableUrl_))
            {
                stringTableUrl_ = nUrl + "*$stringTable.xml";
            }
            if (this._haveUfl(stringTableUrl_))
            {
                StringTable stringTable_ = result_._getStringTable();
                this._readHeadstream(stringTable_, stringTableUrl_);
            }

            string udlUrl_ = nUrl + @"*";

            udlUrl_ += udlHeadstream_._getFileName();
            this._readHeadstream(result_, udlUrl_);

            return(result_);
        }
        public override void UpdateView()
        {
            GDMIndividualRecord iRec = fPersonalName.Owner as GDMIndividualRecord;

            var parts = GKUtils.GetNameParts(iRec, fPersonalName, false);

            fView.Surname.Text           = parts.Surname;
            fView.Name.Text              = parts.Name;
            fView.Patronymic.Text        = parts.Patronymic;
            fView.NameType.SelectedIndex = (sbyte)fPersonalName.NameType;

            fView.NamePrefix.Text    = fPersonalName.Pieces.Prefix;
            fView.Nickname.Text      = fPersonalName.Pieces.Nickname;
            fView.SurnamePrefix.Text = fPersonalName.Pieces.SurnamePrefix;
            fView.NameSuffix.Text    = fPersonalName.Pieces.Suffix;

            fView.MarriedSurname.Text = fPersonalName.Pieces.MarriedName;

            if (!IsExtendedWomanSurname())
            {
                fView.SurnameLabel.Text      = LangMan.LS(LSID.LSID_Surname);
                fView.MarriedSurname.Enabled = false;
            }
            else
            {
                fView.SurnameLabel.Text      = LangMan.LS(LSID.LSID_MaidenSurname);
                fView.MarriedSurname.Enabled = true;
            }

            ICulture culture = fBase.Context.Culture;

            fView.Surname.Enabled    = fView.Surname.Enabled && culture.HasSurname();
            fView.Patronymic.Enabled = fView.Patronymic.Enabled && culture.HasPatronymic();

            GDMLanguageID langID = fPersonalName.Language;

            fView.Language.Text = GEDCOMUtils.GetLanguageStr(langID);
        }
Example #25
0
        private void UpdateStatsTypes()
        {
            ICulture culture = fBase.Context.Culture;

            //cmStatTypes.Items.Clear();
            cbType.Items.Clear();
            for (StatsMode sm = StatsMode.smAncestors; sm <= StatsMode.smLast; sm++)
            {
                if (sm == StatsMode.smPatronymics && !culture.HasPatronymic())
                {
                    continue;
                }

                GKData.StatsTitleStruct tr = GKData.StatsTitles[(int)sm];

                /*var menuItem = new MenuItemEx(LangMan.LS(tr.Title));
                 * menuItem.Click += miStatType_Click;
                 * menuItem.Tag = sm;
                 * cmStatTypes.Items.Add(menuItem);*/

                cbType.Items.Add(new GKComboItem(LangMan.LS(tr.Title), sm));
            }
        }
 public static void SetICulture(ICulture culture)
 {
     _culture = culture;
 }
Example #27
0
        private void UpdateControls(bool totalUpdate = false)
        {
            bool locked = (cmbRestriction.SelectedIndex == (int)GEDCOMRestriction.rnLocked);

            if (fPerson.ChildToFamilyLinks.Count != 0)
            {
                GEDCOMFamilyRecord family = fPerson.ChildToFamilyLinks[0].Family;
                btnParentsAdd.Enabled    = false;
                btnParentsEdit.Enabled   = true && !locked;
                btnParentsDelete.Enabled = true && !locked;

                GEDCOMIndividualRecord relPerson = family.GetHusband();
                if (relPerson != null)
                {
                    btnFatherAdd.Enabled    = false;
                    btnFatherDelete.Enabled = true && !locked;
                    btnFatherSel.Enabled    = true && !locked;
                    txtFather.Text          = GKUtils.GetNameString(relPerson, true, false);
                }
                else
                {
                    btnFatherAdd.Enabled    = true && !locked;
                    btnFatherDelete.Enabled = false;
                    btnFatherSel.Enabled    = false;
                    txtFather.Text          = "";
                }

                relPerson = family.GetWife();
                if (relPerson != null)
                {
                    btnMotherAdd.Enabled    = false;
                    btnMotherDelete.Enabled = true && !locked;
                    btnMotherSel.Enabled    = true && !locked;
                    txtMother.Text          = GKUtils.GetNameString(relPerson, true, false);
                }
                else
                {
                    btnMotherAdd.Enabled    = true && !locked;
                    btnMotherDelete.Enabled = false;
                    btnMotherSel.Enabled    = false;
                    txtMother.Text          = "";
                }
            }
            else
            {
                btnParentsAdd.Enabled    = true && !locked;
                btnParentsEdit.Enabled   = false;
                btnParentsDelete.Enabled = false;

                btnFatherAdd.Enabled    = true && !locked;
                btnFatherDelete.Enabled = false;
                btnFatherSel.Enabled    = false;

                btnMotherAdd.Enabled    = true && !locked;
                btnMotherDelete.Enabled = false;
                btnMotherSel.Enabled    = false;

                txtFather.Text = "";
                txtMother.Text = "";
            }

            if (totalUpdate)
            {
                fEventsList.UpdateSheet();
                fNotesList.UpdateSheet();
                fMediaList.UpdateSheet();
                fSourcesList.UpdateSheet();
                fAssociationsList.UpdateSheet();

                fGroupsList.UpdateSheet();
                fNamesList.UpdateSheet();
                fSpousesList.UpdateSheet();
                fUserRefList.UpdateSheet();
            }

            UpdatePortrait(totalUpdate);

            // controls lock
            txtName.Enabled       = !locked;
            cmbPatronymic.Enabled = !locked;
            txtSurname.Enabled    = !locked;

            cmbSex.Enabled       = !locked;
            chkPatriarch.Enabled = !locked;
            chkBookmark.Enabled  = !locked;

            txtNamePrefix.Enabled    = !locked;
            txtNickname.Enabled      = !locked;
            txtSurnamePrefix.Enabled = !locked;
            txtNameSuffix.Enabled    = !locked;

            fEventsList.ReadOnly       = locked;
            fNotesList.ReadOnly        = locked;
            fMediaList.ReadOnly        = locked;
            fSourcesList.ReadOnly      = locked;
            fSpousesList.ReadOnly      = locked;
            fAssociationsList.ReadOnly = locked;
            fGroupsList.ReadOnly       = locked;
            fUserRefList.ReadOnly      = locked;

            ICulture culture = fBase.Context.Culture;

            txtSurname.Enabled    = txtSurname.Enabled && culture.HasSurname();
            cmbPatronymic.Enabled = cmbPatronymic.Enabled && culture.HasPatronymic();
        }
Example #28
0
 /// <summary>
 /// Links the culture to region.
 /// </summary>
 /// <param name="cult">The cult.</param>
 /// <param name="region">The region.</param>
 public void LinkCultureToRegion(ICulture cult, IRegion region)
 {
     AddRegionCulture(new RegionCulture(cult, region));
 }
        /// <summary>
        /// Executes an action on default culture text if it does not exist. Actions include - nothing, create empty string, copy current culture text
        /// </summary>
        /// <param name="actionForDefaultCulture">Specific action</param>
        /// <param name="dynamicText">Current dynamic text entity</param>
        /// <param name="currentCulture">Current culture entity</param>
        /// <param name="dictionaryScope">Current dictionary scope entity</param>
        private void ExecuteDefaultCultureAction(
            IfDefaultNotExistAction actionForDefaultCulture,
            DynamicText dynamicText,
            ICulture currentCulture,
            IDictionaryScope dictionaryScope
            )
        {
            if (actionForDefaultCulture == IfDefaultNotExistAction.DoNothing)
            {
                return;
            }

            var defaultCulture = GetDefaultCulture();

            if (currentCulture.Equals(defaultCulture))
            {
                return;
            }

            var defaultText = m_staticTextUoW.GetByNameAndCultureAndScope(
                dynamicText.Name, defaultCulture.Name, dictionaryScope.Name
                );

            if (defaultText != null)
            {
                return;
            }

            string text;

            switch (actionForDefaultCulture)
            {
            case IfDefaultNotExistAction.DoNothing:
                return;

            case IfDefaultNotExistAction.CreateEmpty:
                text = string.Empty;
                break;

            case IfDefaultNotExistAction.CreateTextCopy:
                text = dynamicText.Text;
                break;

            default:
                throw new ArgumentOutOfRangeException(
                          nameof(actionForDefaultCulture),
                          actionForDefaultCulture,
                          "Invalid default language save action"
                          );
            }

            m_staticTextUoW.AddStaticText(
                dynamicText.Name,
                dynamicText.Format,
                text,
                defaultCulture.Name,
                dictionaryScope.Name,
                dynamicText.ModificationUser,
                DateTime.UtcNow
                );
        }
 public static CultureInfo ToCultureInfo(this ICulture culture)
 => new CultureInfo(culture?.Code);
Example #31
0
 public static void AddResource(string lang, ICulture resource)
 {
     _cultures.Add(lang, resource);
 }