示例#1
0
        public static void RemoveFont(ObservableCollection <KeyName> fontListSource, KeyName pickerItem)
        {
            List <KeyName> removedFontList = new List <KeyName>();

            if (pickerItem.Payload is StorageFile)
            {
                var file = pickerItem.Payload as StorageFile;
                FontDAO.InsertTempFont(file.Path);
            }

            if (fontListSource != null)
            {
                //공유되는 폰트를 모두 삭제
                foreach (var font in fontListSource.Where(x => x.Payload == pickerItem.Payload).ToList())
                {
                    fontListSource.Remove(font);

                    if (!removedFontList.Contains(font))
                    {
                        removedFontList.Add(font);
                    }
                }
            }

            if (FontList != null)
            {
                foreach (var font in FontList.Where(x => x.Payload == pickerItem.Payload).ToList())
                {
                    FontList.Remove(font);

                    if (!removedFontList.Contains(font))
                    {
                        removedFontList.Add(font);
                    }
                }
            }

            //이벤트 처리
            if (FontFamilyListChanged != null)
            {
                FontFamilyListChanged(FontList, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, removedFontList));
            }
        }