/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuDeviceAdd_Click(object sender, EventArgs e) { IStation selectedStation = null; selectedStation = this.GetSelectedStation(true); if (selectedStation != null) { frmDeviceType f = new frmDeviceType(); if (f.ShowDialog() == DialogResult.OK) { DeviceType deviceType = f.SelectedDeviceType; IDPU dpu = Soft.DPUs[deviceType]; IDeviceUI deviceUI = GetDeviceUI(deviceType); IDevice newDevice; DialogResult dr = deviceUI.Add(deviceType, selectedStation, out newDevice); if (dr == DialogResult.OK) { selectedStation.Devices.Add(newDevice); newDevice.Station = selectedStation; // // newDevice.Dpu = Soft.DPUs[deviceType]; // persister device // dpu.DevicePersister.Add(newDevice); // task device // dpu.TaskFactory.Create(newDevice); // add device tree node // DeviceTreeNode deviceTreeNode = new DeviceTreeNode(newDevice); this.GetSelectedStationTreeNode().Nodes.Add(deviceTreeNode); } } } }