private void Button_EditList(object sender, RoutedEventArgs e) { //Get the attribute that the input field represent Attribute attribute = findAttribute(((Button)sender).Name); if (attribute != null) { ListInput listInput = new ListInput(attribute.Value, network, attribute.Editable); listInput.ShowDialog(); if (listInput.Updated) { Updated = true; } } }
/**********************************************************************************************//** * Event handler. Called by Button_Filter_Or for click events. * * \author Ilan Hindy * \date 29/09/2016 * * \param sender Source of the event. * \param e Routed event information. * **************************************************************************************************/ private void Button_Filter_Or_Click(object sender, RoutedEventArgs e) { ListInput filtersWindow = new ListInput(filters, null); filtersWindow.ShowDialog(); foreach (ListBoxItem item in ListBox_Messages.Items) { // If the item should be presented according to the presentedSenders if (presentedSenders.Any(s => SenderOfItem(item) == s)) { if (filters.All(f => ((string)item.Content).Contains(f))) { item.Visibility = Visibility.Visible; continue; } } item.Visibility = Visibility.Collapsed; } }
/**********************************************************************************************//** * Event handler. Called by Button_Edit for click events. * * \author Ilan Hindy * \date 29/09/2016 * * \param sender Source of the event. * \param e Routed event information. * **************************************************************************************************/ private void Button_Edit_Click(object sender, RoutedEventArgs e) { if (!EditableCheck()) { return; } if (listOfAttributes) { Attribute attribute = ((List <Attribute>)list)[ListBox_Elements.SelectedIndex]; Type type = attribute.Value.GetType(); if (typeof(IList).IsAssignableFrom(type)) { ListInput listInput = new ListInput(attribute.Value, network, editable); listInput.ShowDialog(); return; } if (typeof(NetworkElement).IsAssignableFrom(type)) { ElementInputWindow elementInput = new ElementInputWindow(attribute.Value); elementInput.ShowDialog(); return; } } }