public EditorVM(List <Tuple <int, int, int> > bounds) { RandomSeriesConfigItems = new ObservableCollection <RandomSeriesConfigItem>(); for (int boundsIter = 0; boundsIter < bounds.Count; boundsIter++) { RandomSeriesConfigItems.Add(RandomSeriesConfigItem.ConvertFromTuple(bounds[boundsIter])); } OnPropertyChanged("RandomSeriesConfigItems"); }
public List <Tuple <int, int, int> > GetConfigTuples() { List <Tuple <int, int, int> > tuples = new List <Tuple <int, int, int> >(); for (int configItemIter = 0; configItemIter < editorVM.RandomSeriesConfigItems.Count; configItemIter++) { RandomSeriesConfigItem item = editorVM.RandomSeriesConfigItems[configItemIter]; tuples.Add(new Tuple <int, int, int>(item.mLow, item.mHigh, item.mNumPnts)); } return(tuples); }
public static RandomSeriesConfigItem ConvertFromTuple(Tuple <int, int, int> tuple) { RandomSeriesConfigItem item = new RandomSeriesConfigItem { mLow = tuple.Item1, mHigh = tuple.Item2, mNumPnts = tuple.Item3 }; return(item); }
private void ListItemDeleteBtnClick(object sender, RoutedEventArgs e) { // https://github.com/nagasudhirpulla/wpf_scada_dashboard/blob/master/WPFScadaDashboard/DashboardUserControls/DataPointsConfigWindow.xaml.cs if (MessageBox.Show("Remove Series ?", "Plot Series Configuration", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { //do no stuff return; } else { //a button on list view has been clicked Button button = sender as Button; //walk up the tree to find the ListboxItem DependencyObject tvi = Helpers.ListUtility.FindParentTreeItem(button, typeof(ListBoxItem)); //if not null cast the Dependancy object to type of Listbox item. if (tvi != null) { ListBoxItem lbi = tvi as ListBoxItem; // Delete the object from Observable Collection RandomSeriesConfigItem seriesConfigItem = (RandomSeriesConfigItem)lbi.DataContext; editorVM.RandomSeriesConfigItems.Remove(seriesConfigItem); } } }