Exemplo n.º 1
0
 public LostCousin(string name, int birthYear, string reference, int censusYear, string censusCountry, bool ftanalyzer)
 {
     Name           = name;
     BirthYear      = birthYear;
     Reference      = FixReference(reference ?? string.Empty);
     FTAnalyzerFact = ftanalyzer;
     if (censusYear == 1841 && Countries.IsEnglandWales(censusCountry))
     {
         CensusDate = CensusDate.EWCENSUS1841;
     }
     if (censusYear == 1881 && Countries.IsEnglandWales(censusCountry))
     {
         CensusDate = CensusDate.EWCENSUS1881;
     }
     if (censusYear == 1881 && censusCountry == Countries.SCOTLAND)
     {
         CensusDate = CensusDate.SCOTCENSUS1881;
     }
     if (censusYear == 1881 && censusCountry == Countries.CANADA)
     {
         CensusDate = CensusDate.CANADACENSUS1881;
     }
     //if(censusYear == 1911 && censusCountry == Countries.IRELAND)
     //    CensusDate = CensusDate.IRELANDCENSUS1911;
     if (censusYear == 1911 && Countries.IsEnglandWales(censusCountry))
     {
         CensusDate = CensusDate.EWCENSUS1911;
     }
     if (censusYear == 1880 && censusCountry == Countries.UNITED_STATES)
     {
         CensusDate = CensusDate.USCENSUS1880;
     }
     if (censusYear == 1940 && censusCountry == Countries.UNITED_STATES)
     {
         CensusDate = CensusDate.USCENSUS1940;
     }
     SetMetaphones();
 }
Exemplo n.º 2
0
        public TreeNode[] GetAllLocationsTreeNodes(Font defaultFont, bool mainform)
        {
            if (mainformTreeRootNode != null)
            {
                return(BuildTreeNodeArray(mainform));
            }

            mainformTreeRootNode = new TreeNode();
            placesTreeRootNode   = new TreeNode();
            Font regularFont = new Font(defaultFont, FontStyle.Regular);
            Font boldFont    = new Font(defaultFont, FontStyle.Bold);

            foreach (FactLocation location in FamilyTree.Instance.AllDisplayPlaces)
            {
                string[] parts    = location.GetParts();
                TreeNode currentM = mainformTreeRootNode;
                TreeNode currentP = placesTreeRootNode;
                foreach (string part in parts)
                {
                    if (part.Length == 0 && !Properties.GeneralSettings.Default.AllowEmptyLocations)
                    {
                        break;
                    }
                    TreeNode childM = currentM.Nodes.Find(part, false).FirstOrDefault();
                    TreeNode childP = currentP.Nodes.Find(part, false).FirstOrDefault();
                    if (childM == null)
                    {
                        TreeNode child = new TreeNode((part.Length == 0 ? "<blank>" : part))
                        {
                            Name        = part,
                            Tag         = location,
                            ToolTipText = "Geocoding Status : " + location.Geocoded
                        };
                        SetTreeNodeImage(location, child);
                        // Set everything other than known countries and known regions to regular
                        if ((currentM.Level == 0 && Countries.IsKnownCountry(part)) ||
                            (currentM.Level == 1 && Regions.IsKnownRegion(part)))
                        {
                            child.NodeFont = boldFont;
                        }
                        else
                        {
                            child.NodeFont = regularFont;
                        }
                        childM = child;
                        childP = (TreeNode)child.Clone();
                        currentM.Nodes.Add(childM);
                        currentP.Nodes.Add(childP);
                    }
                    currentM = childM;
                    currentP = childP;
                }
            }
            if (Properties.GeneralSettings.Default.AllowEmptyLocations)
            { // trim empty end nodes
                bool recheck = true;
                while (recheck)
                {
                    TreeNode[] emptyNodes = mainformTreeRootNode.Nodes.Find(string.Empty, true);
                    recheck = false;
                    foreach (TreeNode node in emptyNodes)
                    {
                        if (node.FirstNode == null)
                        {
                            node.Remove();
                            recheck = true;
                        }
                    }
                }
            }
            foreach (TreeNode node in mainformTreeRootNode.Nodes)
            {
                node.Text += "         "; // force text to be longer to fix bold bug
            }
            foreach (TreeNode node in placesTreeRootNode.Nodes)
            {
                node.Text += "         "; // force text to be longer to fix bold bug
            }
            return(BuildTreeNodeArray(mainform));
        }
 public bool IsValidLocation(string location) =>
 !CensusLocation.IsKnownCountry || Countries.IsUnitedKingdom(location) ? CensusLocation.IsUnitedKingdom : CensusLocation.Country.Equals(location);
Exemplo n.º 4
0
 public bool IsOverseasUKCensus(string country)
 {
     return(country.Equals(Countries.OVERSEAS_UK) || (!Countries.IsUnitedKingdom(country) && CensusReference != null && CensusReference.IsUKCensus));
 }