Interaction logic for ChatsControl.xaml
Inheritance: System.Windows.Controls.UserControl
        public void Initialize(Controls.ChatsControl ChatsControl, string LayoutStore)
        {
            ChatConfigStorage.Load(LayoutStore);

            foreach (string file in Directory.GetFiles(App.RootFolder + "/Chats/", "*.dll"))
            {
                try {
                    Assembly a = Assembly.LoadFile(file);
                    foreach (Type t in a.GetTypes())
                    {
                        Type iface = t.GetInterface("RatChat.Core.IChatSource");
                        if (iface != null)
                        {
                            var v = RatChat.Core.ChatNameAttribute.GetAttribute(t);
                            if (v != null)
                            {
                                Sources[v.Name] = t;
                            }
                            else
                            {
                                //Sources[Path.GetFileNameWithoutExtension(file)] = t;
                            }
                        }
                    }
                } catch {
                    //////
                }
            }

            RestoreChats(ChatsControl);
        }
        public void StoreChats(Controls.ChatsControl ChatsControl)
        {
            StringBuilder sb = new StringBuilder();

            for (int j = 0; j < Chats.Count; ++j)
            {
                var data = Chats[j].Tag as Tuple <RatChat.Core.IChatSource, string>;

                sb.AppendFormat(
                    CultureInfo.InvariantCulture,
                    "|{0}={1}={2}",
                    data.Item2,
                    data.Item1.ConfigPrefix,
                    ChatsControl.GetChatHeightByIndex(j));
            }
            ChatConfigStorage["ChatManager.UberChatList"] = sb.ToString();
        }
        public void RestoreChats(Controls.ChatsControl ChatsControl)
        {
            string Settings = ChatConfigStorage.GetDefault("ChatManager.UberChatList", "");

            if (string.IsNullOrEmpty(Settings))
            {
                return;
            }

            string[] chats = Settings.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);

            for (int j = 0; j < chats.Length; ++j)
            {
                string[] vals = chats[j].Split('=');
                CreateChat(vals[1], vals[0]);

                if (vals.Length > 2)
                {
                    ChatsControl.SetChatHeightByIndex(j, double.Parse(vals[2], CultureInfo.InvariantCulture));
                }
            }
        }