private void bt_removeSelected_Click(object sender, RoutedEventArgs e) { try { List <int> _Indexs = GetSelectedIndexs(); if (_Indexs.Count > 0) { //CopyPartitionInfoList.RemoveAll(aCPI => _Indexs.Contains(aCPI.Index)); for (int i = 0; i < _Indexs.Count; i++) { CopyPartitionInfoList.RemoveAt(_Indexs[i] - i); } UpdateIndex(); } } catch (Exception _ex) { GeneralTools.Tools.WriteToLog(_ex); } }
private void SortElements(string sortBy, ListSortDirection direction) { try { if (CopyPartitionInfoList != null && sortBy != "State" && sortBy != "Visualize" && sortBy != "Index") { IOrderedEnumerable <CopyPartitionInfo> _CopyPartitionInfoList = null; if (direction == ListSortDirection.Ascending) { switch (sortBy) { //case "Index": // _CopyPartitionInfoList = CopyPartitionInfoList.OrderBy(_cpi => _cpi.Index); // break; case "Algorithm Type": _CopyPartitionInfoList = CopyPartitionInfoList.OrderBy(_cpi => _cpi.PartitionInfo.AlgorithmType); break; case "Algorithm": _CopyPartitionInfoList = CopyPartitionInfoList.OrderBy(_cpi => _cpi.PartitionInfo.AlgorithmName); break; } } else if (direction == ListSortDirection.Descending) { switch (sortBy) { //case "Index": // _CopyPartitionInfoList = CopyPartitionInfoList.OrderByDescending(_cpi => _cpi.Index); // break; case "Algorithm Type": _CopyPartitionInfoList = CopyPartitionInfoList.OrderByDescending(_cpi => _cpi.PartitionInfo.AlgorithmType); break; case "Algorithm": _CopyPartitionInfoList = CopyPartitionInfoList.OrderByDescending(_cpi => _cpi.PartitionInfo.AlgorithmName); break; } } //Actualizar CopyPartitionInfoList con la nueva lista ordenada CopyPartitionInfoList = new List <CopyPartitionInfo>(); foreach (CopyPartitionInfo _cpi in _CopyPartitionInfoList) { CopyPartitionInfoList.Add(_cpi); } UpdateIndex(); this.lv_Alg.ItemsSource = null; this.lv_Alg.ItemsSource = CopyPartitionInfoList; if (CopyPartitionInfoList.Count > 0) { this.chb_selectAll.IsChecked = true; } this.lv_Alg.SelectAll(); } } catch (Exception _ex) { GeneralTools.Tools.WriteToLog(_ex); } }