/// <summary> /// Очистка размеров и положений окон авторов от удаленных авторов /// и дефолтных размеров /// </summary> /// <param name="authors"></param> private void Cleaning(AuthorList authors) { try { string[] keys = new string[AdvancedWindowSettingDictionary.Keys.Count]; AdvancedWindowSettingDictionary.Keys.CopyTo(keys, 0); foreach (string key in keys) { if ((key != "Default") && (authors.FindAuthor(key) == null)) { AdvancedWindowSettingDictionary.Remove(key); } } Dictionary <string, AdvancedWindowSetting> copy = new Dictionary <string, AdvancedWindowSetting>(AdvancedWindowSettingDictionary); AdvancedWindowSetting @default = AdvancedWindowSettingDictionary["Default"]; foreach (KeyValuePair <string, AdvancedWindowSetting> pair in copy) { if ((pair.Key != "Default") && (pair.Value.Size == @default.Size) && (pair.Value.HeightComment == @default.HeightComment)) { AdvancedWindowSettingDictionary.Remove(pair.Key); } } keys = new string[AuthorWindowSettingDictionary.Keys.Count]; AuthorWindowSettingDictionary.Keys.CopyTo(keys, 0); foreach (string key in keys) { try { if ((key != "Default") && (authors.FindAuthor(key) == null)) { AuthorWindowSettingDictionary.Remove(key); } } catch { } } var copy1 = new Dictionary <string, AuthorWindowSetting>(AuthorWindowSettingDictionary); AuthorWindowSetting @default1 = AuthorWindowSettingDictionary["Default"]; foreach (var pair in copy1) { if ((pair.Key != "Default") && (pair.Value.Size == @default1.Size) && (pair.Value.Location == @default1.Location) && (pair.Value.HeightComment == @default1.HeightComment)) { AuthorWindowSettingDictionary.Remove(pair.Key); } } } catch { } }
public void SetAdvancedWindowSizeSetting(Author author, Size size) { if (author == null) { return; } if (size == AdvancedWindowSettingDictionary["Default"].Size) { return; } if (Keyboard.Modifiers == (ModifierKeys.Control ^ ModifierKeys.Shift)) { foreach (AdvancedWindowSetting advancedWindowSetting in AdvancedWindowSettingDictionary.Values) { advancedWindowSetting.Size = size; } return; } if (Keyboard.Modifiers == ModifierKeys.Control) { AdvancedWindowSettingDictionary["Default"].Size = size; return; } if (AdvancedWindowSettingDictionary.ContainsKey(author.URL)) { AdvancedWindowSettingDictionary[author.URL].Size = size; } else { AdvancedWindowSetting newSetting = new AdvancedWindowSetting { Size = size, HeightComment = AdvancedWindowSettingDictionary["Default"].HeightComment }; AdvancedWindowSettingDictionary.Add(author.URL, newSetting); } }
public void SetAdvancedWindowSizeSetting(Author author, Size size) { if (author == null) return; if (size == AdvancedWindowSettingDictionary["Default"].Size) return; if (Keyboard.Modifiers == (ModifierKeys.Control ^ ModifierKeys.Shift)) { foreach (AdvancedWindowSetting advancedWindowSetting in AdvancedWindowSettingDictionary.Values) { advancedWindowSetting.Size = size; } return; } if (Keyboard.Modifiers == ModifierKeys.Control) { AdvancedWindowSettingDictionary["Default"].Size = size; return; } if (AdvancedWindowSettingDictionary.ContainsKey(author.URL)) AdvancedWindowSettingDictionary[author.URL].Size = size; else { AdvancedWindowSetting newSetting = new AdvancedWindowSetting { Size = size, HeightComment = AdvancedWindowSettingDictionary["Default"].HeightComment }; AdvancedWindowSettingDictionary.Add(author.URL, newSetting); } }