private bool PopFromGrid(ScheduleBox sb) { if (timeGrid.Children.Contains(sb)) { timeGrid.Children.Remove(sb); theCanvas.Children.Add(sb); return true; } else if (eventGrid.Children.Contains(sb)) { /* Adding events to the event list, will leave them there * As resources to be chosen and dragged on to the schedule grid * So here we clone the schedule box and add it to the canvas * at the location of the original Event Box */ ScheduleBox nsb = new ScheduleBox(sb.Title(), sb.Description(), sb.ScheduleID, sb.BgColor()); nsb.ScheduleBoxEvent += this.ScheduleBox_Event; Canvas.SetLeft(nsb, Canvas.GetLeft(sb)); Canvas.SetTop(nsb, Canvas.GetTop(sb)); ((ArrayList)UsedEventsList[EventList.IndexOf(sb)]).Add(nsb); theCanvas.Children.Add(nsb); return true; } return false; }
public bool ChangeScheduleBox(ScheduleBox sb) { if (timeGrid.Children.Contains(sb)) { //Do Nothing yet return true; } else if (eventGrid.Children.Contains(sb)) { int nID = ScheduleIDToEventID(sb.ScheduleID); foreach (ScheduleBox tb in ((ArrayList)UsedEventsList[nID])) { tb.Title(sb.Title()); tb.BgColor(sb.BgColor()); } return true; } else if (theCanvas.Children.Contains(sb)) { //Do Nothing yet ... though Nothing should need done here return true; } return false; }