예제 #1
0
        private void SetFontStaticFontFamilies(NamedFontFamily value, FontFamilyControlData fontdata)
        {
            if (value != null && fontdata != null)
            {
                var matchFont = fontdata.FontFamilies.Where(f => f.Name == value.Name && f.IsRecent).FirstOrDefault();
                if (matchFont != null)
                {
                    var index = fontdata.FontFamilies.IndexOf(matchFont);
                    if (index != 0)
                    {
                        fontdata.FontFamilies.Move(index, 0);
                        this.PerformRecent(fontdata);
                        this.SaveRecentFont();
                    }
                }
                else
                {
                    if (fontdata.FontFamilies.Count(f => f.IsRecent) >= 5)
                    {
                        fontdata.FontFamilies.RemoveAt(4);
                    }

                    fontdata.FontFamilies.Insert(0, new NamedFontFamily {
                        Name = value.Name, IsRecent = true, FontFamily = value.FontFamily
                    });
                    this.PerformRecent(fontdata);
                    this.SaveRecentFont();
                }
            }
        }
예제 #2
0
        public void PerformRecent(FontFamilyControlData fontdata)
        {
            foreach (var f in fontdata.FontFamilies)
            {
                if (f.ShowSplitLine)
                {
                    f.ShowSplitLine = false;
                }
            }

            var lastRecent = fontdata.FontFamilies.LastOrDefault(f => f.IsRecent);

            if (lastRecent != null)
            {
                lastRecent.ShowSplitLine = true;
            }
        }