/// <summary> /// 顯示分析成分設定的對話框 /// </summary> /// <param name="obj"></param> private void ShowCompSelectionDialog(object obj) { if (_selectedProps == null || _selectedProps.Count == 0) { System.Windows.MessageBox.Show("請至少選擇一個分析項目", "物性分析", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Asterisk); return; } using (View.SelectItemView2 f = new View.SelectItemView2(_selectedCompViewModel)) { f.ShowDialog(); Dictionary <int, string> tmpSelectedComps = ((SelectItemViewModel)f.DataContext).SelectedItemList; if (tmpSelectedComps != null && tmpSelectedComps.Count > 0) { if (_selectedComps == null || !tmpSelectedComps.SequenceEqual(_selectedComps)) { _selectedComps = tmpSelectedComps; string lab = string.Join(",", tmpSelectedComps.Select(x => x.Value)); if (lab.Length > 60) { lab = lab.Substring(0, 57) + "..."; } SelectedCompInfoString = lab; } } } }
/// <summary> /// 顯示項目設定的對話框 /// </summary> /// <param name="obj"></param> private void ShowPropSelectionDialog(object obj) { if (CATE_NAME == null || string.IsNullOrWhiteSpace(CATE_NAME)) { System.Windows.MessageBox.Show("請先指定分析儀器/方法", "物性分析", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Asterisk); return; } using (View.SelectItemView2 f = new View.SelectItemView2(_selectedPropViewModel)) { f.ShowDialog(); Dictionary <int, string> tmpSelectedProps = ((SelectItemViewModel)f.DataContext).SelectedItemList; //_selectedProps = ((SelectItemViewModel)f.DataContext).SelectedItemList; if (tmpSelectedProps != null && tmpSelectedProps.Count > 0) { if (_selectedProps == null || !tmpSelectedProps.SequenceEqual(_selectedProps)) { _selectedProps = tmpSelectedProps; string lab = string.Join(",", tmpSelectedProps.Select(x => x.Value)); if (lab.Length > 60) { lab = lab.Substring(0, 57) + "..."; } SelectedPropInfoString = lab; OnPropChanged(); } } } }