/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btSave_Click(object sender, RoutedEventArgs e) { try { PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.Setting.I_CO_IA_Setting>(channel => { SecurityGrade[] grades = new SecurityGrade[SecurityGradeItemsSource.Count]; SecurityGradeItemsSource.CopyTo(grades, 0); channel.SaveSecurityGrade(grades); }); MessageBox.Show("保存成功!", "提示", MessageBoxButton.OK); } catch (System.Exception ex) { MessageBox.Show(ex.GetExceptionMessage(), "提示", MessageBoxButton.OK); } }
/// <summary> /// 上移 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btUp_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(SelectedSecurityGrade.Name)) { int index = SecurityGradeItemsSource.IndexOf(SelectedSecurityGrade); if (index > 0) { SecurityGrade upsecuritygrade = SecurityGradeItemsSource[index - 1]; SecurityGradeItemsSource.Insert(index - 1, SelectedSecurityGrade); SecurityGradeItemsSource.Insert(index, upsecuritygrade); SecurityGradeItemsSource.RemoveAt(index + 1); SecurityGradeItemsSource.RemoveAt(index + 1); SelectedSecurityGrade = SecurityGradeItemsSource[index - 1]; } } }
/// <summary> /// 下移 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btDown_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(SelectedSecurityGrade.Name)) { int index = SecurityGradeItemsSource.IndexOf(SelectedSecurityGrade); if (index < SecurityGradeItemsSource.Count - 1) { SecurityGrade downsecuritygrade = SecurityGradeItemsSource[index + 1]; if (downsecuritygrade.Name != null) { SecurityGradeItemsSource.Insert(index + 1, SelectedSecurityGrade); SecurityGradeItemsSource.Insert(index, downsecuritygrade); SecurityGradeItemsSource.RemoveAt(index + 1); SecurityGradeItemsSource.RemoveAt(index + 2); } } } }