void grdCollections_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { Collection collection = grdCollections.SelectedItem as Collection; if (collection == null) { selectedcollection = null; items.Clear(); blockeditems.Clear(); ctxRemoveCollection.IsEnabled = false; } else { selectedcollection = collection.Name; items.Clear(); blockeditems.Clear(); foreach (CollectionItem item in module.GetItems(collection.Name)) { items.Add(item); } foreach (BlockedCollectionItem item in module.GetBlockedItems(collection.Name)) { blockeditems.Add(new BlockedItemEditor(item)); } ctxRemoveCollection.IsEnabled = true; } }
void OnPollCleared(Poll poll) { Dispatcher.BeginInvoke((Action)(() => { if (poll.Name != selectedpoll) { return; } votes.Clear(); })); }
void ReloadPollData(Poll poll) { selectedpoll = null; votes.Clear(); options.Clear(); if (poll == null) { ctxRemovePoll.IsEnabled = false; ctxClearPoll.IsEnabled = false; return; } selectedpoll = poll.Name; foreach (PollVote vote in context.GetModule <PollModule>().GetVotes(poll.Name)) { votes.Add(vote); } foreach (PollOption option in context.GetModule <PollModule>().GetOptions(poll.Name)) { options.Add(new PollOptionEditor(option)); } ctxRemovePoll.IsEnabled = true; ctxClearPoll.IsEnabled = true; }
public void DeleteAll() { DialogResult result = MessageBox.Show("Er du sikker på at du vil slette alle notifikationer?", "Slet alle notifikationer", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { Notifications.Clear(); NotificationList.Clear(); } }
void LoadList() { lock (gameslock) { games.Clear(); foreach (Game game in JSON.Read <Game[]>(context.Settings.Get(this, "games", "[]"))) { AddGame(game.Name); } } }
public async Task Init() { var DentalClinic = await _clinicService.GetById <DentalClinic>(1); Name = DentalClinic.Name; Address = DentalClinic.Address; Phone = DentalClinic.Phone; Email = DentalClinic.Email; if (NotificationList.Count > 0) { NotificationList.Clear(); } var list = await _notificationService.GetAll <List <Notification> >(null); foreach (var notification in list) { NotificationList.Add(notification); } }
public void Start() { PollModule module = context.GetModule <PollModule>(); module.PollCreated += OnPollAdded; module.PollRemoved += OnPollRemoved; module.PollCleared += OnPollCleared; module.OptionAdded += OnOptionAdded; module.OptionRemoved += OnOptionRemoved; module.VoteAdded += OnVoteAdded; module.VoteRemoved += OnVoteRemoved; polls.Clear(); foreach (Poll poll in module.GetPolls()) { polls.Add(new PollEditor(poll)); } context.GetModuleByKey <IMainWindow>(ModuleKeys.MainWindow).AddMenuItem("Manage.Polls", (sender, args) => Show()); }
void OnReviewChanged() { items.Clear(); double sum = module.Entries.Sum(e => e.Weight); double value = 0.0f; foreach (ReviewEntry entry in module.Entries) { items.Add(new ReviewItem { Topic = entry.Name, Value = entry.Value }); value += entry.Value * entry.Weight / sum; } items.Add(new ReviewItem { Topic = "Result", Value = (int)Math.Round(value) }); grdItems.Visibility = Visibility.Visible; dispatcherTimer.Start(); }