Changeset 5640 for branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/Views/OKBProblemView.cs
- Timestamp:
- 03/09/11 02:08:07 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/Views/OKBProblemView.cs
r5639 r5640 27 27 using HeuristicLab.MainForm.WindowsForms; 28 28 29 namespace HeuristicLab.Clients.OKB {29 namespace HeuristicLab.Clients.OKB.RunCreation { 30 30 [View("OKBProblem View")] 31 31 [Content(typeof(OKBProblem), true)] … … 42 42 protected override void OnInitialized(System.EventArgs e) { 43 43 base.OnInitialized(e); 44 OKBClient.Instance.Refreshing += new EventHandler(OKBClient_Refreshing);45 OKBClient.Instance.Refreshed += new EventHandler(OKBClient_Refreshed);44 RunCreationClient.Instance.Refreshing += new EventHandler(RunCreationClient_Refreshing); 45 RunCreationClient.Instance.Refreshed += new EventHandler(RunCreationClient_Refreshed); 46 46 PopulateComboBox(); 47 47 } … … 62 62 viewHost.Content = null; 63 63 } else { 64 problemComboBox.SelectedItem = OKBClient.Instance.Problems.FirstOrDefault(x => x.Id == Content.ProblemId);64 problemComboBox.SelectedItem = RunCreationClient.Instance.Problems.FirstOrDefault(x => x.Id == Content.ProblemId); 65 65 viewHost.Content = Content.Problem; 66 66 } … … 74 74 private void PopulateComboBox() { 75 75 problemComboBox.DataSource = null; 76 Platform platform = OKBClient.Instance.Platforms.FirstOrDefault(x => x.Name == "HeuristicLab 3.3"); 77 if (platform != null) { 78 problemComboBox.DataSource = OKBClient.Instance.Problems.Where(x => x.PlatformId == platform.Id).ToList(); 79 problemComboBox.DisplayMember = "Name"; 80 } 76 problemComboBox.DataSource = RunCreationClient.Instance.Problems.ToList(); 77 problemComboBox.DisplayMember = "Name"; 81 78 } 82 79 83 80 protected override void OnClosed(FormClosedEventArgs e) { 84 OKBClient.Instance.Refreshing -= new EventHandler(OKBClient_Refreshing);85 OKBClient.Instance.Refreshed -= new EventHandler(OKBClient_Refreshed);81 RunCreationClient.Instance.Refreshing -= new EventHandler(RunCreationClient_Refreshing); 82 RunCreationClient.Instance.Refreshed -= new EventHandler(RunCreationClient_Refreshed); 86 83 base.OnClosed(e); 87 84 } 88 85 89 private void OKBClient_Refreshing(object sender, EventArgs e) {86 private void RunCreationClient_Refreshing(object sender, EventArgs e) { 90 87 if (InvokeRequired) { 91 Invoke(new EventHandler( OKBClient_Refreshing), sender, e);88 Invoke(new EventHandler(RunCreationClient_Refreshing), sender, e); 92 89 } else { 93 90 Cursor = Cursors.AppStarting; … … 95 92 } 96 93 } 97 private void OKBClient_Refreshed(object sender, EventArgs e) {94 private void RunCreationClient_Refreshed(object sender, EventArgs e) { 98 95 if (InvokeRequired) { 99 Invoke(new EventHandler( OKBClient_Refreshed), sender, e);96 Invoke(new EventHandler(RunCreationClient_Refreshed), sender, e); 100 97 } else { 101 98 PopulateComboBox(); … … 110 107 Invoke(new EventHandler(Content_ProblemChanged), sender, e); 111 108 else { 112 problemComboBox.SelectedItem = OKBClient.Instance.Problems.FirstOrDefault(x => x.Id == Content.ProblemId);109 problemComboBox.SelectedItem = RunCreationClient.Instance.Problems.FirstOrDefault(x => x.Id == Content.ProblemId); 113 110 viewHost.Content = Content.Problem; 114 111 } … … 118 115 #region Control Events 119 116 private void refreshButton_Click(object sender, System.EventArgs e) { 120 OKBClient.Instance.Refresh();117 RunCreationClient.Instance.Refresh(); 121 118 } 122 119 private void problemComboBox_SelectedValueChanged(object sender, System.EventArgs e) { … … 125 122 Content.Load(problem.Id); 126 123 if (Content.ProblemId != problem.Id) // reset selected item if load was not successful 127 problemComboBox.SelectedItem = OKBClient.Instance.Problems.FirstOrDefault(x => x.Id == Content.ProblemId);124 problemComboBox.SelectedItem = RunCreationClient.Instance.Problems.FirstOrDefault(x => x.Id == Content.ProblemId); 128 125 } 129 126 }
Note: See TracChangeset
for help on using the changeset viewer.