private void Data_Drop(object sender, DragEventArgs e) { if (e.Handled == false) { //StackPanel panel = sender as StackPanel; var panel = basketstack; ClassInfo curinfo = e.Data.GetData(nameof(ClassInfo)) as ClassInfo; ClassInfoPlus infoplus = new ClassInfoPlus(curinfo); if (Subject_Add(infoplus)) { return; } //Group.Children.Add(infoplus); if (panel != null && curinfo != null) { ClassInfoControl curcontrol = new ClassInfoControl(infoplus); curcontrol.AllowDrop = true; curcontrol.DragOver += DragSubject_DragOver; curcontrol.Drop += Data_Drop; curcontrol.ClassRemove += ClassRemoveMember; panel.Children.Add(curcontrol); e.Effects = DragDropEffects.Move; subjectpicknum.Items.Add(panel.Children.Count); //if (Questionbutton == true) Group.SelectCount = panel.Children.Count; } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { Sample.Info = TestData.GetClassInfos()[0]; ClassGroup group = new ClassGroup(); ClassInfoPlus info = new ClassInfoPlus(Sample.Info); group.AddGroup(info); //Mainlist.ClassDatalist = TestData.GetClassInfos(); //Mainlist.Update(); }
private void Data_Drop(object sender, DragEventArgs e) { if (e.Handled == false) { StackPanel panel = sender as StackPanel; ClassInfo curinfo = e.Data.GetData(nameof(ClassInfo)) as ClassInfo; ClassInfoPlus infoplus = new ClassInfoPlus(curinfo); if (panel != null && curinfo != null) { ClassInfoControl curcontrol = new ClassInfoControl(infoplus); curcontrol.AllowDrop = false; panel.Children.Add(curcontrol); e.Effects = DragDropEffects.Move; } } }
/// <summary> /// 새로운 과목이 들어오면 그룹에 접근해서 해당과목이 존재하는지 확인해주고 없을 경우 추가하는 이벤트를 위로 보내줌, 추가 : 1 /// </summary> /// <param name="Info"></param> private bool Subject_Add(ClassInfoPlus Info) { foreach (IGroupable g in Group.Children) { ClassInfoPlus g_plus = g as ClassInfoPlus; if (Info.Info == g_plus.Info) { return(true); } } ClassChangeMemberEventArgs changeargs = new ClassChangeMemberEventArgs(); changeargs.rootGroup = Group; changeargs.changeInfo = Info; changeargs.add_delete = 1; ChangeMember?.Invoke(this, changeargs); //info가 추가 되었을 때 추가 : 1 return(false); }
/// <summary> /// 과목 배열에 과목을 추가하는 매소드 /// </summary> /// <param name="target">타겟</param> public void ClassAddList(ClassInfoPlus target) { ClassList.Add(target); }