/// <summary> /// 保存所有便签设置 /// </summary> public static void SaveSetings(WindowNotepad windowNotepad = null) { WindowSettingsAllM windowSettingsAll = ReadSetings(); if (windowSettingsAll == null) { windowSettingsAll = new WindowSettingsAllM(); } if (windowSettingsAll.WindowSettingses == null) { windowSettingsAll.WindowSettingses = new List <WindowSettingsM>(); } windowSettingsAll.SystemSetting = SystemSetting; List <WindowNotepad> list; if (windowNotepad != null) { list = WindowList.FindAll(m => m.WindowSettings.ID == windowNotepad.WindowSettings.ID); } else { list = WindowList; } foreach (WindowNotepad notepad in list) { notepad.WindowSettings.Top = notepad.Top; notepad.WindowSettings.Left = notepad.Left; notepad.WindowSettings.BackColorName = notepad.SkinM.Name; notepad.WindowSettings.Width = notepad.Width; notepad.WindowSettings.Height = notepad.Height; //替换为新设置 int index = windowSettingsAll.WindowSettingses.FindIndex(t => t.ID == notepad.WindowSettings.ID); if (index > 0) { windowSettingsAll.WindowSettingses.RemoveAt(index); } windowSettingsAll.WindowSettingses.Add(notepad.WindowSettings); } XMLSerializer.Serializer(windowSettingsAll); }
/// <summary> /// 读取所有便签设置 /// </summary> public static WindowSettingsAllM ReadSetings() { return(XMLSerializer.Deserialize <WindowSettingsAllM>()); }