/// <summary> /// Recharge l'interface /// </summary> /// <param name="reload">Indique s'il faut recharger les options</param> public void RefreshAccount(bool reload) { bool minOneActive = false; if (reload) { ProgramSettings.Reload(); } // Faire un backup de l'historique des messages Dictionary <Guid, object> history = new Dictionary <Guid, object>(); // Si c'est le rectangle, on ne fait rien if (!((wpClients.Children.Count == 1) && (wpClients.Children[0] as ClientDashboard) == null)) { foreach (ClientDashboard client in wpClients.Children) { history.Add(client.Account.Id, client.Messages); client.Dispose(); } } wpClients.Children.Clear(); ClientDashboard newClient; foreach (CIVAccount account in ProgramSettings.Instance.Accounts) { if (account.IsActive) { minOneActive = true; newClient = new ClientDashboard(account); if (history.ContainsKey(newClient.Account.Id)) { newClient.Messages = (ObservableCollection <ScreenMessage>)history[newClient.Account.Id]; } newClient.UpdateEnd = ClientUpdateEnd; wpClients.Children.Add(newClient); } } // Dans le cas où il n'y a pas de compte affiché, il faut mettre quelque chose dans le WrapPanel. // Sinon l'affichage est miniature. if (!minOneActive) { wpClients.Children.Add(new Rectangle() { Width = 440, Height = 530 }); } RefreshSecondaryView(true); }
/// <summary> /// Recharge l'interface /// </summary> /// <param name="reload">Indique s'il faut recharger les options</param> public void RefreshAccount(bool reload) { bool minOneActive = false; if (reload) ProgramSettings.Reload(); // Faire un backup de l'historique des messages Dictionary<Guid, object> history = new Dictionary<Guid, object>(); // Si c'est le rectangle, on ne fait rien if (!((wpClients.Children.Count == 1) && (wpClients.Children[0] as ClientDashboard) == null)) foreach (ClientDashboard client in wpClients.Children) { history.Add(client.Account.Id, client.Messages); client.Dispose(); } wpClients.Children.Clear(); ClientDashboard newClient; foreach (CIVAccount account in ProgramSettings.Instance.Accounts) if (account.IsActive) { minOneActive = true; newClient = new ClientDashboard(account); if (history.ContainsKey(newClient.Account.Id)) newClient.Messages = (ObservableCollection<ScreenMessage>)history[newClient.Account.Id]; newClient.UpdateEnd = ClientUpdateEnd; wpClients.Children.Add(newClient); } // Dans le cas où il n'y a pas de compte affiché, il faut mettre quelque chose dans le WrapPanel. // Sinon l'affichage est miniature. if (!minOneActive) wpClients.Children.Add(new Rectangle() { Width=440, Height=530}); RefreshSecondaryView(true); }