/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuStationAdd_Click(object sender, EventArgs e) { frmStationType f = new frmStationType(); DialogResult dr = f.ShowDialog(); if (dr == DialogResult.OK) { StationType stationType = f.SelectedStationType; ISPU spu = Soft.SPUs[stationType]; IStationUI stationUI = spu.StationUI; StationCollection stations = this.Soft.Hardware.Stations; IStation newStation; DialogResult dr2 = stationUI.Add(stationType, stations, out newStation); if (dr2 == DialogResult.OK) { Debug.Assert(newStation.StationType != null); Debug.Assert(newStation.Spu != null); Debug.Assert(newStation.Guid != null); stations.Add(newStation); spu.StationPersister.Add(newStation); StationTreeNode stationNode = new StationTreeNode(newStation); this.HardwareTreeView.Nodes.Add(stationNode); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuStationEdit_Click(object sender, EventArgs e) { IStation station = GetSelectedStation(true); if (station != null) { IStationUI stationUI = station.Spu.StationUI; DialogResult dr = stationUI.Edit(station); if (dr == DialogResult.OK) { station.Spu.StationPersister.Update(station); StationTreeNode stationNode = (StationTreeNode)station.Tag; stationNode.RefreshStationTreeNode(); } } }