/// <summary> /// Simulate a value change for the items /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SimulateValues(object sender, ElapsedEventArgs e) { try { if (m_repeatCount > 0 || m_continousSimulation) { // Retreive parent folder AddressSpaceElement parentFolder = GetParent(); // Get children ArrayList simulationItems = parentFolder.GetChildren(); // increment values foreach (DaAddressSpaceElement item in simulationItems) { // filter only the MyDaAddressSpaceElement items MyDaAddressSpaceElement daItem = item as MyDaAddressSpaceElement; if (daItem == null) { continue; } IncrementItemValue(daItem); } if (!m_continousSimulation) { m_repeatCount--; } } else { StopSimulation(); } } catch { // stop simulation m_repeatCount = 0; } }
public EnumResultCode DeleteItems() { try { // Retreive items folder AddressSpaceElement itemsFolder = GetParent(); // Get children ArrayList simulationItems = itemsFolder.GetChildren(); // Search stopSimulation command item foreach (DaAddressSpaceElement item in simulationItems) { // stop simulation if (item is DaStartStopSimulationCommand) { ((DaStartStopSimulationCommand)item).StopSimulation(); break; } } AddressSpaceElement parentFolder = itemsFolder.GetParent(); if (parentFolder.RemoveChild(itemsFolder)) { return(EnumResultCode.S_OK); } else { // Delete error return(EnumResultCode.E_FAIL); } } catch { return(EnumResultCode.E_FAIL); } }