Changeset 16141 for branches/2817-BinPackingSpeedup/HeuristicLab.Clients.Hive.Administrator/3.3/Views/SlaveView.cs
- Timestamp:
- 09/14/18 11:47:37 (6 years ago)
- Location:
- branches/2817-BinPackingSpeedup
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2817-BinPackingSpeedup
- Property svn:mergeinfo changed
-
branches/2817-BinPackingSpeedup/HeuristicLab.Clients.Hive.Administrator
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator merged eligible /stable/HeuristicLab.Clients.Hive.Administrator merged eligible /trunk/HeuristicLab.Clients.Hive.Administrator merged eligible /branches/1721-RandomForestPersistence/HeuristicLab.Clients.Hive.Administrator 10321-10322 /branches/Algorithms.GradientDescent/HeuristicLab.Clients.Hive.Administrator 5516-5520 /branches/Async/HeuristicLab.Clients.Hive.Administrator 13329-15286 /branches/Benchmarking/sources/HeuristicLab.Clients.Hive.Administrator 6917-7005 /branches/CloningRefactoring/HeuristicLab.Clients.Hive.Administrator 4656-4721 /branches/CodeEditor/HeuristicLab.Clients.Hive.Administrator 11700-11806 /branches/DataAnalysis Refactoring/HeuristicLab.Clients.Hive.Administrator 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Clients.Hive.Administrator 5815-6180 /branches/DataAnalysis/HeuristicLab.Clients.Hive.Administrator 4458-4459,4462,4464 /branches/DataPreprocessing/HeuristicLab.Clients.Hive.Administrator 10085-11101 /branches/GP.Grammar.Editor/HeuristicLab.Clients.Hive.Administrator 6284-6795 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Clients.Hive.Administrator 5060 /branches/HLScript/HeuristicLab.Clients.Hive.Administrator 10331-10358 /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Clients.Hive.Administrator 11570-12508 /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Clients.Hive.Administrator 6123-9799 /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Clients.Hive.Administrator 11130-12721 /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator 15377-15760 /branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.Administrator 12440-12877 /branches/LogResidualEvaluator/HeuristicLab.Clients.Hive.Administrator 10202-10483 /branches/NET40/sources/HeuristicLab.Clients.Hive.Administrator 5138-5162 /branches/NSGA-II Changes/HeuristicLab.Clients.Hive.Administrator 12033-12122 /branches/ParallelEngine/HeuristicLab.Clients.Hive.Administrator 5175-5192 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Clients.Hive.Administrator 7568-7810 /branches/QAPAlgorithms/HeuristicLab.Clients.Hive.Administrator 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Clients.Hive.Administrator 6828 /branches/RuntimeOptimizer/HeuristicLab.Clients.Hive.Administrator 8943-9078 /branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator 7787-8333 /branches/SlaveShutdown/HeuristicLab.Clients.Hive.Administrator 8944-8956 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Clients.Hive.Administrator 10204-10479 /branches/SuccessProgressAnalysis/HeuristicLab.Clients.Hive.Administrator 5370-5682 /branches/Trunk/HeuristicLab.Clients.Hive.Administrator 6829-6865 /branches/UnloadJobs/HeuristicLab.Clients.Hive.Administrator 9168-9215 /branches/VNS/HeuristicLab.Clients.Hive.Administrator 5594-5752 /branches/crossvalidation-2434/HeuristicLab.Clients.Hive.Administrator 12948-12950 /branches/histogram/HeuristicLab.Clients.Hive.Administrator 5959-6341 /branches/symbreg-factors-2650/HeuristicLab.Clients.Hive.Administrator 14232-14825
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/2817-BinPackingSpeedup/HeuristicLab.Clients.Hive.Administrator/3.3/Views/SlaveView.cs
r16140 r16141 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 8Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.Windows.Forms; 24 using HeuristicLab.Clients.Access;25 using HeuristicLab.Core.Views;26 24 using HeuristicLab.MainForm; 27 25 using HeuristicLab.MainForm.WindowsForms; 28 26 29 27 namespace HeuristicLab.Clients.Hive.Administrator.Views { 30 [View("Slave View")]31 [Content(typeof( Resource), IsDefaultView = true)]32 public partial class SlaveView : ItemView {33 public new Resource Content {34 get { return ( Resource)base.Content; }28 [View("Slave View")] 29 [Content(typeof(Slave), IsDefaultView = true)] 30 public sealed partial class SlaveView : ResourceView { 31 public new Slave Content { 32 get { return (Slave)base.Content; } 35 33 set { base.Content = value; } 36 34 } … … 40 38 } 41 39 42 #region Register Content Events 43 protected override void DeregisterContentEvents() { 44 base.DeregisterContentEvents(); 45 } 46 protected override void RegisterContentEvents() { 47 base.RegisterContentEvents(); 48 } 49 #endregion 50 40 #region Overrides 51 41 protected override void OnContentChanged() { 52 42 base.OnContentChanged(); 53 43 if (Content == null) { 54 ShowSlaveUI(true); 55 txtName.Clear(); 56 txtCPU.Clear(); 57 txtDetailsDescription.Clear(); 58 txtMemory.Clear(); 59 txtOS.Clear(); 60 txtSlaveState.Clear(); 61 txtLastHeartbeat.Clear(); 62 txtFreeMemory.Clear(); 63 txtId.Clear(); 64 txtHbIntervall.Clear(); 65 cbxDisposable.Checked = false; 66 cbxPublic.Checked = false; 44 cpuTextBox.Clear(); 45 memoryTextBox.Clear(); 46 operatingSystemTextBox.Clear(); 47 stateTextBox.Clear(); 48 lastHeartbeatTextBox.Clear(); 49 disposableCheckBox.Checked = false; 67 50 } else { 68 if (Content.GetType() == typeof(Slave)) { 69 ShowSlaveUI(true); 70 Slave ct = (Slave)Content; 71 bool authorized = UserInformation.Instance.UserExists && (ct.OwnerUserId == UserInformation.Instance.User.Id || HiveRoles.CheckAdminUserPermissions()); 72 txtName.Text = ct.Name; 73 txtHbIntervall.Text = ct.HbInterval.ToString(); 74 cbxPublic.Enabled = authorized; 75 cbxPublic.CheckedChanged -= new EventHandler(cbxPublic_CheckedChanged); 76 cbxPublic.Checked = ct.OwnerUserId == null; 77 cbxPublic.CheckedChanged += new EventHandler(cbxPublic_CheckedChanged); 78 txtCPU.Text = string.Format("{0} Cores @ {1} Mhz, Arch.: {2}", ct.Cores.ToString(), ct.CpuSpeed.ToString(), ct.CpuArchitecture.ToString()); 79 txtDetailsDescription.Text = ct.Description; 80 txtMemory.Text = ct.Memory.ToString(); 81 txtOS.Text = ct.OperatingSystem; 82 txtSlaveState.Text = ct.SlaveState.ToString(); 83 txtLastHeartbeat.Text = ct.LastHeartbeat.ToString(); 84 txtFreeMemory.Text = ct.FreeMemory.ToString(); 85 txtId.Text = ct.Id.ToString(); 86 cbxDisposable.Enabled = authorized; 87 cbxDisposable.Checked = ct.IsDisposable.GetValueOrDefault(); 88 } else if (Content.GetType() == typeof(SlaveGroup)) { 89 SlaveGroup ct = (SlaveGroup)Content; 90 txtName.Text = ct.Name; 91 txtHbIntervall.Text = ct.HbInterval.ToString(); 92 cbxPublic.Enabled = ct.Name != "UNGROUPED" && HiveRoles.CheckAdminUserPermissions(); 93 cbxPublic.CheckedChanged -= new EventHandler(cbxPublic_CheckedChanged); 94 cbxPublic.Checked = ct.OwnerUserId == null; 95 cbxPublic.CheckedChanged += new EventHandler(cbxPublic_CheckedChanged); 96 ShowSlaveUI(false); 97 } else { 98 throw new Exception("Unknown Resource in SlaveView"); 99 } 51 cpuTextBox.Text = string.Format("{0} Cores @ {1} MHz, Arch.: {2}", Content.Cores, Content.CpuSpeed, Content.CpuArchitecture); 52 memoryTextBox.Text = string.Format("{0} ({1} Free)", Content.Memory, Content.FreeMemory); 53 operatingSystemTextBox.Text = Content.OperatingSystem; 54 stateTextBox.Text = Content.SlaveState.ToString(); 55 lastHeartbeatTextBox.Text = Content.LastHeartbeat.ToString(); 56 disposableCheckBox.Checked = Content.IsDisposable.GetValueOrDefault(); 100 57 } 101 }102 103 private void ShowSlaveUI(bool show) {104 label1.Visible = show;105 label2.Visible = show;106 label4.Visible = show;107 label10.Visible = show;108 label11.Visible = show;109 label12.Visible = show;110 label13.Visible = show;111 label14.Visible = show;112 label15.Visible = show;113 txtCPU.Visible = show;114 txtDetailsDescription.Visible = show;115 txtMemory.Visible = show;116 txtOS.Visible = show;117 txtSlaveState.Visible = show;118 txtLastHeartbeat.Visible = show;119 txtFreeMemory.Visible = show;120 txtId.Visible = show;121 txtName.Enabled = !show;122 cbxDisposable.Visible = show;123 58 } 124 59 125 60 protected override void SetEnabledStateOfControls() { 126 61 base.SetEnabledStateOfControls(); 62 bool enabled = Content != null && !Locked; 63 disposableCheckBox.Enabled = enabled; 127 64 } 65 #endregion 128 66 129 private void txtName_TextChanged(object sender, EventArgs e) {130 if (Content != null && Content is SlaveGroup) {131 Content.Name = txtName.Text;132 }67 #region Event Handlers 68 private void disposableCheckBox_CheckedChanged(object sender, EventArgs e) { 69 if (Content != null) 70 Content.IsDisposable = disposableCheckBox.Checked; 133 71 } 134 135 private void txtHbIntervall_TextChanged(object sender, EventArgs e) { 136 if (Content != null) { 137 if (txtHbIntervall.Text.Length > 0) { 138 try { 139 int interval = int.Parse(txtHbIntervall.Text); 140 Content.HbInterval = interval; 141 } 142 catch (Exception) { 143 MessageBox.Show("Please enter a numeric value for the Heartbeat Interval.", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error); 144 txtHbIntervall.Text = "10"; 145 } 146 } 147 } 148 } 149 150 private void cbxDisposable_CheckedChanged(object sender, EventArgs e) { 151 if (Content != null) { 152 ((Slave)Content).IsDisposable = cbxDisposable.Checked; 153 } 154 } 155 156 private void cbxPublic_CheckedChanged(object sender, EventArgs e) { 157 if (Content != null) { 158 Content.OwnerUserId = cbxPublic.Checked ? null : new Guid?(UserInformation.Instance.User.Id); 159 } 160 } 72 #endregion 161 73 } 162 74 }
Note: See TracChangeset
for help on using the changeset viewer.