public void AddNGEntry(NGType type, string content) { var entry = new NGCommentEntry(); entry.IsEnabled = true; entry.Type = type; entry.Content = content; NGFilter.AddNGEntry(entry); }
public void AddEmptyNGEntry() { var entry = new NGCommentEntry(); entry.IsEnabled = false; entry.Type = NGType.Word; entry.Content = ""; NGFilter.AddNGEntry(entry); }
public void AddNGEntry(NGType type, string content) { var entry = new NGCommentEntry(); entry.IsEnabled = true; entry.Type = type; entry.Content = content; Settings.Instance.NGList.Add(entry); }
public void AddEmptyNGEntry() { var entry = new NGCommentEntry(); entry.IsEnabled = false; entry.Type = NGType.Word; entry.Content = ""; Settings.Instance.NGList.Add(entry); }
public void DeleteNGEntry(NGCommentEntry target) { Settings.Instance.NGList.Remove(target); }
//設定ファイルの値からインスタンスを生成する private object GetNeedValue(string name, PropertyInfo property, object value) { switch (name) { case "FontFamily": return(new FontFamily((string)value)); case "GridLength": return(new GridLengthConverter().ConvertFrom(value)); case "Uri": return(new Uri((string)value)); case "DispatcherCollection<NGCommentEntry>": { var col = new DispatcherCollection <NGCommentEntry>(DispatcherHelper.UIDispatcher); dynamic entries = (DynamicJson)value; //NGフィルターのエントリを設定ファイルからパースする foreach (var entry in entries) { var ng = new NGCommentEntry(); ng.Type = Enum.Parse(typeof(NGType), entry.Type); ng.Content = entry.Content; ng.IsEnabled = entry.IsEnabled; //NGフィルターの内容が更新されたら即セーブする ng.PropertyChanged += ((sender, e) => Save()); col.Add(ng); } //新しくフィルターリストにエントリが追加/削除されたらセーブする //追加だったら新しいエントリに即セーブするイベントを設定 col.CollectionChanged += ((sender, e) => { if (e.Action == NotifyCollectionChangedAction.Add && e.NewItems.Count != 0 && e.NewItems[0] is NGCommentEntry) { var ng = e.NewItems[0] as NGCommentEntry; ng.PropertyChanged += ((sdr, ee) => Save()); Save(); } else { Save(); } }); return(col); } case "DispatcherCollection<String>": { var col = new DispatcherCollection <string>(DispatcherHelper.UIDispatcher); dynamic entries = (DynamicJson)value; //NGフィルターのエントリを設定ファイルからパースする foreach (var entry in entries) { col.Add(entry); } //新しくフィルターリストにエントリが追加/削除されたらセーブする col.CollectionChanged += ((sender, e) => { Save(); }); return(col); } default: return(value); } }
public void DeleteNGEntry(NGCommentEntry target) { NGFilter.NGList.Remove(target); NGFilter.Save(); }