/// <summary> /// 缩放 /// </summary> /// <param name="scaleDuration"></param> private void ZoomScale(int scaleDuration) { if (TempTaskItemSource == null) { TempTaskItemSource = new ObservableCollection <TaskItem>(); } if (TaskItemSource == null) { TaskItemSource = new ObservableCollection <TaskItem>(); } TempTaskItemSource.Clear(); foreach (TaskItem item in TaskItemSource) { TempTaskItemSource.Add(item); } //TempTaskItemSource = Common.Common.Clone<ObservableCollection<TaskItem>>(TaskItemSource); BaseWidth = ScaleBaseWidth / scaleDuration; TaskItemSource.Clear(); foreach (TaskItem item in TempTaskItemSource) { TaskItemSource.Add(item); } //TaskItemSource = Common.Common.Clone<ObservableCollection<TaskItem>>(TempTaskItemSource); ReFreshScaleBar(); SetTimePara(); }
/// <summary> /// 新增任务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Add_OnClick(object sender, RoutedEventArgs e) { if (TaskItemSource == null) { TaskItemSource = new ObservableCollection <TaskItem>(); } TaskItemSource.Add(new TaskItem() { StartTime = 3, EndTime = 6, TaskName = "新增任务" }); }