/**********************************************************************************************//** * Event handler. Called by Button_PresentedSources_List for click events. * * \author Ilan Hindy * \date 16/01/2017 * * \param sender Source of the event. * \param e Routed event information. **************************************************************************************************/ private void Button_PresentedSources_List_Click(object sender, RoutedEventArgs e) { // Retrieve all senders to list List <string> senders = ListBox_Messages.Items.Cast <ListBoxItem>().ToList() .Select(item => SenderOfItem(item)) .ToList().Distinct().ToList(); // Select the senders to present SelectDialog selectDialog = new SelectDialog("Select the sources", "DebugWindow Window Select Source", senders, null, null, SelectionMode.Multiple); selectDialog.ShowDialog(); if (selectDialog.Result == SelectDialog.SelectDialogResult.Quit) { return; } // Set the presentedSenders according to the selected presentedSenders = senders.Select((s, idx) => new { s, idx }). Where(p => selectDialog.Selection.IndexOf(p.idx) > -1). Select(p => p.s).ToList(); // presented sender status only messages from the selected senders will be shown presentedSenderStatus = PresentedSenderStatus.Filtered; // Refresh the presentation NewPresentedSendersSelected(); }
/**********************************************************************************************//** * Event handler. Called by Button_CancelPresentedSourcesFilter for click events. * * \author Ilan Hindy * \date 16/01/2017 * * \param sender Source of the event. * \param e Routed event information. **************************************************************************************************/ private void Button_CancelPresentedSourcesFilter_Click(object sender, RoutedEventArgs e) { // Retrieve all senders to list List <string> presentedSenders = ListBox_Messages.Items.Cast <ListBoxItem>().ToList() .Select(item => SenderOfItem(item)) .ToList().Distinct().ToList(); // Presented sender status - all messages will be shown and new senders will be added to the list presentedSenderStatus = PresentedSenderStatus.NotFiltered; // Refresh the presentation NewPresentedSendersSelected(); }