Changeset 11594 for branches/Breadcrumbs/HeuristicLab.Problems.Scheduling.Views/3.3/JobShopSchedulingProblemView.cs
- Timestamp:
- 11/27/14 11:23:37 (10 years ago)
- Location:
- branches/Breadcrumbs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Breadcrumbs
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll 10 11 HeuristicLab 3.3.5.1.ReSharper.user 11 12 HeuristicLab 3.3.6.0.ReSharper.user 12 13 HeuristicLab.4.5.resharper.user 13 14 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development 14 16 HeuristicLab.resharper.user 15 17 ProtoGen.exe … … 17 19 _ReSharper.HeuristicLab 18 20 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests 19 22 _ReSharper.HeuristicLab.ExtLibs 20 23 bin 21 24 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/Breadcrumbs/HeuristicLab.Problems.Scheduling.Views/3.3/JobShopSchedulingProblemView.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 22 23 using System.Windows.Forms; 24 using HeuristicLab.Collections; 25 using HeuristicLab.Encodings.ScheduleEncoding; 23 26 using HeuristicLab.MainForm; 24 27 using HeuristicLab.Optimization.Views; … … 43 46 protected override void OnContentChanged() { 44 47 base.OnContentChanged(); 45 if (Content == null) { 46 ganttChart.Reset(); 47 } else { 48 FillGanttChart(Content); 48 FillGanttChart(); 49 } 50 51 protected override void DeregisterContentEvents() { 52 Content.JobDataParameter.ValueChanged -= JobDataParameterOnValueChanged; 53 Content.JobData.ItemsAdded -= JobsOnChanged; 54 Content.JobData.ItemsRemoved -= JobsOnRemoved; 55 Content.JobData.ItemsReplaced -= JobsOnChanged; 56 Content.JobData.CollectionReset -= JobsOnChanged; 57 foreach (var job in Content.JobData) { 58 job.TasksChanged -= JobOnTasksChanged; 59 } 60 base.DeregisterContentEvents(); 61 } 62 protected override void RegisterContentEvents() { 63 base.RegisterContentEvents(); 64 Content.JobDataParameter.ValueChanged += JobDataParameterOnValueChanged; 65 Content.JobData.ItemsAdded += JobsOnChanged; 66 Content.JobData.ItemsRemoved += JobsOnRemoved; 67 Content.JobData.ItemsReplaced += JobsOnChanged; 68 Content.JobData.CollectionReset += JobsOnChanged; 69 foreach (var job in Content.JobData) { 70 job.TasksChanged += JobOnTasksChanged; 49 71 } 50 72 } 51 73 52 private void FillGanttChart(JobShopSchedulingProblem content) { 74 private void JobsOnChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<Job>> e) { 75 foreach (var job in e.OldItems) 76 job.Value.TasksChanged -= JobOnTasksChanged; 77 foreach (var job in e.Items) 78 job.Value.TasksChanged += JobOnTasksChanged; 79 FillGanttChart(); 80 } 81 82 private void JobsOnRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Job>> e) { 83 foreach (var job in e.Items) 84 job.Value.TasksChanged -= JobOnTasksChanged; 85 FillGanttChart(); 86 } 87 88 private void JobDataParameterOnValueChanged(object sender, EventArgs e) { 89 Content.JobData.ItemsAdded += JobsOnChanged; 90 Content.JobData.ItemsRemoved += JobsOnRemoved; 91 Content.JobData.ItemsReplaced += JobsOnChanged; 92 Content.JobData.CollectionReset += JobsOnChanged; 93 foreach (var job in Content.JobData) { 94 job.TasksChanged += JobOnTasksChanged; 95 } 96 FillGanttChart(); 97 } 98 99 private void JobOnTasksChanged(object sender, EventArgs e) { 100 FillGanttChart(); 101 } 102 103 private void FillGanttChart() { 53 104 ganttChart.Reset(); 105 if (Content == null) return; 54 106 int jobCount = 0; 55 foreach (var j in content.JobData) {107 foreach (var j in Content.JobData) { 56 108 double lastEndTime = 0; 57 foreach (var t in content.JobData[jobCount].Tasks) {109 foreach (var t in Content.JobData[jobCount].Tasks) { 58 110 int categoryNr = t.JobNr; 59 111 string categoryName = "Job" + categoryNr; … … 63 115 lastEndTime + 1, 64 116 lastEndTime + t.Duration, 65 "Job" + t.JobNr + " - " + "Task#" + t.TaskNr .ToString());117 "Job" + t.JobNr + " - " + "Task#" + t.TaskNr); 66 118 lastEndTime += t.Duration; 67 119 }
Note: See TracChangeset
for help on using the changeset viewer.