コード例 #1
0
ファイル: Setting.cs プロジェクト: Ales-hon-ne/SIinformer
        /// <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
            {
            }
        }
コード例 #2
0
ファイル: Setting.cs プロジェクト: Lonli-Lokli/SIinformer
 public void SetAuthorWindowLocationSetting(Author author, Point location)
 {
     if (author == null)
     {
         return;
     }
     if (location == AuthorWindowSettingDictionary["Default"].Location)
     {
         return;
     }
     if (Keyboard.Modifiers == (ModifierKeys.Control ^ ModifierKeys.Shift))
     {
         foreach (AuthorWindowSetting authorWindowSetting in AuthorWindowSettingDictionary.Values)
         {
             authorWindowSetting.Location = location;
         }
         return;
     }
     if (Keyboard.Modifiers == ModifierKeys.Control)
     {
         AuthorWindowSettingDictionary["Default"].Location = location;
         return;
     }
     if (AuthorWindowSettingDictionary.ContainsKey(author.URL))
     {
         AuthorWindowSettingDictionary[author.URL].Location = location;
     }
     else
     {
         AuthorWindowSetting newSetting = new AuthorWindowSetting
         {
             Size          = AuthorWindowSettingDictionary["Default"].Size,
             Location      = location,
             HeightComment =
                 AuthorWindowSettingDictionary["Default"].HeightComment
         };
         AuthorWindowSettingDictionary.Add(author.URL, newSetting);
     }
 }
コード例 #3
0
ファイル: Setting.cs プロジェクト: Lonli-Lokli/SIinformer
 public void SetAuthorWindowSizeSetting(Author author, Size size)
 {
     if (author == null) return;
     if (size == AuthorWindowSettingDictionary["Default"].Size) return;
     if (Keyboard.Modifiers == (ModifierKeys.Control ^ ModifierKeys.Shift))
     {
         foreach (AuthorWindowSetting authorWindowSetting in AuthorWindowSettingDictionary.Values)
         {
             authorWindowSetting.Size = size;
         }
         return;
     }
     if (Keyboard.Modifiers == ModifierKeys.Control)
     {
         AuthorWindowSettingDictionary["Default"].Size = size;
         return;
     }
     if (AuthorWindowSettingDictionary.ContainsKey(author.URL))
         AuthorWindowSettingDictionary[author.URL].Size = size;
     else
     {
         AuthorWindowSetting newSetting = new AuthorWindowSetting
                                              {
                                                  Size = size,
                                                  Location = AuthorWindowSettingDictionary["Default"].Location,
                                                  HeightComment =
                                                      AuthorWindowSettingDictionary["Default"].HeightComment
                                              };
         AuthorWindowSettingDictionary.Add(author.URL, newSetting);
     }
 }