Ejemplo n.º 1
0
Archivo: frmMain.cs Proyecto: wpmyj/c3
        /// <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);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        private void Bind()
        {
            List <IStation> stationsList = Sort(Hardware.Stations);

            foreach (IStation station in stationsList)
            {
                TreeNode stationNode = new StationTreeNode(station);
                this.Nodes.Add(stationNode);
            }
        }
Ejemplo n.º 3
0
Archivo: frmMain.cs Proyecto: wpmyj/c3
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private StationTreeNode GetSelectedStationTreeNode()
        {
            StationTreeNode stationTreeNode = null;
            TreeNode        node            = this._hardwareTreeView.SelectedNode;

            if (node is StationTreeNode)
            {
                stationTreeNode = (StationTreeNode)node;
            }
            return(stationTreeNode);
        }
Ejemplo n.º 4
0
Archivo: frmMain.cs Proyecto: wpmyj/c3
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mnuStationDelete_Click(object sender, EventArgs e)
        {
            IStation station = GetSelectedStation(true);

            if (station != null)
            {
                DialogResult dr = NUnit.UiKit.UserMessage.Ask(Strings.SureToDelete);
                if (dr == DialogResult.Yes)
                {
                    station.Spu.StationPersister.Delete(station);
                    StationTreeNode stationNode = station.Tag as StationTreeNode;
                    stationNode.Remove();
                }
            }
        }
Ejemplo n.º 5
0
Archivo: frmMain.cs Proyecto: wpmyj/c3
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private IStation GetSelectedStation(bool showNotSelectedMsg)
        {
            IStation r    = null;
            TreeNode node = this._hardwareTreeView.SelectedNode;

            if (node is StationTreeNode)
            {
                StationTreeNode stationNode = (StationTreeNode)node;
                r = stationNode.Station;
            }
            if (r == null && showNotSelectedMsg)
            {
                NUnit.UiKit.UserMessage.DisplayFailure(Strings.SelectStationFirst);
            }
            return(r);
        }
Ejemplo n.º 6
0
Archivo: frmMain.cs Proyecto: wpmyj/c3
        /// <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();
                }
            }
        }
Ejemplo n.º 7
0
Archivo: frmMain.cs Proyecto: wpmyj/c3
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void t_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode node  = e.Node;
            Model    model = null;

            if (node is DeviceTreeNode)
            {
                DeviceTreeNode deviceNode = node as DeviceTreeNode;
                IDevice        device     = deviceNode.Device;
                //this.UCTaskViewer.Device = deviceNode.Device;
                //this.ViewerWrapper.View(device);
                model = new DeviceMode(device);
            }
            else if (node is StationTreeNode)
            {
                StationTreeNode stationNode = node as StationTreeNode;
                IStation        station     = stationNode.Station;
                //this.ViewerWrapper.View(station);
                model = new StationModel(station);
            }

            this.ControllerManager.Act(model);
        }
Ejemplo n.º 8
0
        /// <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);
                }
            }
        }