Esempio n. 1
0
File: frmMain.cs Progetto: 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);
                }
            }
        }
Esempio 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);
            }
        }
Esempio n. 3
0
File: frmMain.cs Progetto: 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);
        }
Esempio n. 4
0
File: frmMain.cs Progetto: 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();
                }
            }
        }
Esempio n. 5
0
File: frmMain.cs Progetto: 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);
        }
Esempio n. 6
0
File: frmMain.cs Progetto: 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();
                }
            }
        }
Esempio n. 7
0
File: frmMain.cs Progetto: 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);
        }
Esempio 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);
                }
            }
        }