private void btnDeleteBtn_Click(object sender, RoutedEventArgs e) { int index = listViewGroup.SelectedIndex; String str; if (GroupListItem.getInstance().Count == 1) { MessageBox.Show("모든 그룹을 삭제할 수는 없습니다", "오류"); } else if (index != -1) { str = "정말로 선택한 그룹(" + wordGroup.GroupInformation.GroupName[index] + ")을 삭제하겠습니까? 해당 그룹의 모든 단어가 삭제됩니다."; if (MessageBox.Show(str, "알림", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { wordGroup.GroupInformation.deleteGroup(wordGroup.CurrentSetting, index); GroupListItem.getInstance().RemoveAt(index); listViewGroup.Items.Refresh(); } } else { MessageBox.Show("선택된 그룹이 존재하지 않습니다.", "오류"); } }
public GroupWindow(WordGroup wordGroup) { InitializeComponent(); this.wordGroup = wordGroup; listViewGroup.ItemsSource = GroupListItem.getInstance(); listViewApplyingRule.ItemsSource = ApplyingRuleListItem.getInstance(); int i = 0; while ((i < wordGroup.MAX_GROUP_NUM) && (wordGroup.GroupInformation.GroupName[i] != null) && isListNotLoaded) { GroupListItem.getInstance().Add(new GroupListItem(wordGroup.GroupInformation.GroupName[i], wordGroup.getBoxRuleName(wordGroup.GroupInformation.GroupRule[i]))); i++; } i = 0; while ((i < wordGroup.MAX_BOXRULE_NUM) && (wordGroup.getBoxRuleName(i) != null) && isListNotLoaded) { ApplyingRuleListItem.getInstance().Add(new ApplyingRuleListItem(wordGroup.getBoxRuleName(i))); i++; } isListNotLoaded = false; listViewGroup.Items.Refresh(); listViewGroup.SelectedIndex = wordGroup.CurrentGroupNum; listViewApplyingRule.Items.Refresh(); RefreshWindow(wordGroup.CurrentGroupNum); }
private void BtnEditApply_Click(object sender, RoutedEventArgs e) { int[] temp = new int[3]; try { temp[0] = Int32.Parse(txtBoxDay.Text); temp[1] = Int32.Parse(txtBoxHour.Text); temp[2] = Int32.Parse(txtboxMinute.Text); wordGroup.GroupInformation.SetGroupFirstDelayByInt(listViewGroup.SelectedIndex, temp); wordGroup.GroupInformation.GroupName[listViewGroup.SelectedIndex] = txtBoxGroupName.Text; wordGroup.GroupInformation.GroupRule[listViewGroup.SelectedIndex] = listViewApplyingRule.SelectedIndex; switch (comboExamMode.SelectedIndex) { case 0: wordGroup.GroupInformation.ExamTypes[listViewGroup.SelectedIndex] = GroupInfo.ExamType.LetterOnly; break; case 1: wordGroup.GroupInformation.ExamTypes[listViewGroup.SelectedIndex] = GroupInfo.ExamType.MeanOnly; break; default: wordGroup.GroupInformation.ExamTypes[listViewGroup.SelectedIndex] = GroupInfo.ExamType.Both; break; } GroupListItem.getInstance()[listViewGroup.SelectedIndex].GroupName = txtBoxGroupName.Text; GroupListItem.getInstance()[listViewGroup.SelectedIndex].ApplyingRule = wordGroup.getBoxRuleName(listViewApplyingRule.SelectedIndex); listViewGroup.Items.Refresh(); isEditMode = false; listViewApplyingRule.IsEnabled = false; txtBoxDay.IsReadOnly = true; txtBoxHour.IsReadOnly = true; txtboxMinute.IsReadOnly = true; txtBoxGroupName.IsReadOnly = true; listViewGroup.IsEnabled = true; btnCreateGroup.IsEnabled = true; btnDeleteBtn.IsEnabled = true; btnEditGroup.IsEnabled = true; btnEditApply.IsEnabled = false; btnEnter.IsEnabled = true; comboExamMode.IsEnabled = false; MessageBox.Show("편집이 완료되었습니다.", "알림"); } catch (FormatException) { MessageBox.Show("시간은 숫자로 표현되어야 합니다.", "오류"); } }
private void BtnCreateGroup_Click(object sender, RoutedEventArgs e) { int lastIndex = wordGroup.GroupInformation.LastIndex; if (lastIndex != -1) { wordGroup.GroupInformation.createDefaultGroup(lastIndex); GroupListItem.getInstance().Add(new GroupListItem(wordGroup.GroupInformation.GroupName[lastIndex], wordGroup.getBoxRuleName(wordGroup.GroupInformation.GroupRule[lastIndex]))); listViewGroup.Items.Refresh(); } else { MessageBox.Show("그룹의 최대 생성 갯수를 초과하였습니다.", "오류"); } }