예제 #1
0
        public void Dispose(bool clear)
        {
            lock (this)
            {
                if (clear)
                {
                    Clear();
                }

                if (accounts != null)
                {
                    Settings.Accounts.ValueChanged  -= Accounts_ValueChanged;
                    Settings.Accounts.ValueAdded    -= Accounts_ValueAdded;
                    Settings.Accounts.ValueRemoved  -= Accounts_ValueRemoved;
                    Settings.Sorting.ValueChanged   -= Sorting_ValueChanged;
                    Settings.JumpList.ValueChanged  -= JumpList_ValueChanged;
                    Client.Launcher.AccountLaunched -= Launcher_AccountLaunched;
                    Client.Launcher.AccountExited   -= Launcher_AccountExited;

                    foreach (var uid in accounts.Keys)
                    {
                        var a = Settings.Accounts[uid];
                        OnAccountRemoved(a, a.Value);
                    }

                    accounts = null;
                }

                jumplist = null;
            }
        }
예제 #2
0
        public JumpList(IntPtr window)
        {
            accounts = new Dictionary <ushort, JumpItem>();

            jumplist          = new Windows.JumpList(window);
            jumplist.Removed += jumplist_Removed;

            Settings.Accounts.ValueChanged  += Accounts_ValueChanged;
            Settings.Accounts.ValueAdded    += Accounts_ValueAdded;
            Settings.Accounts.ValueRemoved  += Accounts_ValueRemoved;
            Settings.Sorting.ValueChanged   += Sorting_ValueChanged;
            Settings.JumpList.ValueChanged  += JumpList_ValueChanged;
            Client.Launcher.AccountLaunched += Launcher_AccountLaunched;
            Client.Launcher.AccountExited   += Launcher_AccountExited;

            lock (this)
            {
                foreach (var uid in Settings.Accounts.GetKeys())
                {
                    var a = Settings.Accounts[uid];
                    if (a.HasValue)
                    {
                        var account = a.Value;
                        var j       = new JumpItem(account);

                        accounts[account.UID] = j;

                        j.IsActive = Client.Launcher.IsActive(account);

                        OnAccountAdded(a, account);
                    }
                }
            }

            if (accounts.Count > 0)
            {
                RefreshAsync();
            }
        }