private void btnReset_Click(object sender, EventArgs e) { using var Trace = new Trace(); //This c# 8.0 using feature will auto dispose when the function is done. this.ObjectManager = new ClsRelevantObjectManager(AppSettings.Settings.ObjectPriority, this.ObjectManager.TypeName, this.ObjectManager.Camera); this.ObjectList = this.ObjectManager.ToList(); Global_GUI.UpdateFOLV(FOLV_RelevantObjects, this.ObjectList, UseSelected: true, SelectObject: this.ro, FullRefresh: true, ForcedSelection: true); }
public ClsRelevantObjectManager(ClsRelevantObjectManager manager) { this.TypeName = manager.TypeName; this.Camera = manager.Camera; this.Init(manager.cam); this.ObjectList = this.FromList(manager.ObjectList, true, ExactMatchOnly: true); this.Update(); }
private void FillCombo() { try { toolStripComboBoxCameras.Items.Clear(); int idx = 0; int fnd = -1; foreach (Camera cam in AppSettings.Settings.CameraList) { foreach (PropertyInfo prop in cam.GetType().GetProperties()) { if (prop.PropertyType == typeof(ClsRelevantObjectManager)) { ClsRelevantObjectManager rom = (ClsRelevantObjectManager)prop.GetValue(cam); string item = $"{cam.Name}\\{rom.TypeName}"; toolStripComboBoxCameras.Items.Add(item); if (item.EqualsIgnoreCase(this.ROMName)) { fnd = idx; } idx++; } } string item2 = $"{cam.Name}\\{cam.maskManager.MaskTriggeringObjects.TypeName}"; toolStripComboBoxCameras.Items.Add(item2); if (item2.EqualsIgnoreCase(this.ROMName)) { fnd = idx; } idx++; } if (fnd != -1) { toolStripComboBoxCameras.SelectedIndex = fnd; } else if (idx > 0) { toolStripComboBoxCameras.SelectedIndex = 0; } this.Text = $"Relevant Objects - {this.ROMName}"; } catch (Exception ex) { AITOOL.Log($"Error: {ex.Message}"); } }
private void SetROM() { try { if (this.ROMName.IsEmpty()) { return; } this.TempObjectManager = null; foreach (Camera cam in AppSettings.Settings.CameraList) { foreach (PropertyInfo prop in cam.GetType().GetProperties()) { if (prop.PropertyType == typeof(ClsRelevantObjectManager)) { ClsRelevantObjectManager rom = (ClsRelevantObjectManager)prop.GetValue(cam); if ($"{cam.Name}\\{rom.TypeName}".EqualsIgnoreCase(this.ROMName)) { this.TempObjectManager = rom; break; } } } string item = $"{cam.Name}\\{cam.maskManager.MaskTriggeringObjects.TypeName}"; if (item.EqualsIgnoreCase(this.ROMName)) { this.TempObjectManager = cam.maskManager.MaskTriggeringObjects; break; } } if (this.TempObjectManager.IsNull()) { MessageBox.Show($"Error: Could not match '{this.ROMName}' to existing RelevantObjectManager?"); } else { this.TempObjectManager.Update(); } } catch (Exception ex) { AITOOL.Log($"Error: {ex.Message}"); } }
private void SaveROM() { try { if (this.ROMName.IsEmpty()) { return; } foreach (Camera cam in AppSettings.Settings.CameraList) { foreach (PropertyInfo prop in cam.GetType().GetProperties()) { if (prop.PropertyType == typeof(ClsRelevantObjectManager)) { ClsRelevantObjectManager rom = (ClsRelevantObjectManager)prop.GetValue(cam); if ($"{cam.Name}\\{rom.TypeName}".EqualsIgnoreCase(this.ROMName)) { rom.ObjectList = this.TempObjectManager.ObjectList; //rom = this.TempObjectManager; break; } } } string item = $"{cam.Name}\\{cam.maskManager.MaskTriggeringObjects.TypeName}"; if (item.EqualsIgnoreCase(this.ROMName)) { cam.maskManager.MaskTriggeringObjects.ObjectList = this.TempObjectManager.ObjectList; break; } } } catch (Exception ex) { AITOOL.Log($"Error: {ex.Message}"); } }