Пример #1
0
        ///
        /// <summary>
        /// Adds a new target to the project
        /// </summary>
        public void addTarget()
        {
            if (_strTabIndex != "") //Check if there is a project open
            {
                try
                {
                    List <TargetSettings> targetList      = _proInter.getTargets(_strTabIndex); //List of targets in the current project, passed to addTargetDialog to prevent duplicate targets
                    frmAddTarget          addTargetDialog = new frmAddTarget(targetList);       //Opens as new addTargetDialog

                    if (addTargetDialog.ShowDialog() == DialogResult.OK)
                    {
                        TargetSettings ts = addTargetDialog.getTargetSettings(); //Fetches target settings from addTargetDialog
                        _proInter.addTarget(_strTabIndex, ts);                   //Adds target to project
                    }
                    enableTargetButtons();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("There has been an error: \n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #2
0
        ///
        /// <summary>
        /// Adds a new target to the project
        /// </summary>
        public void addTarget()
        {
            if(_strTabIndex != "")     //Check if there is a project open
              {
            try
            {
              List<TargetSettings> targetList = _proInter.getTargets(_strTabIndex);       //List of targets in the current project, passed to addTargetDialog to prevent duplicate targets
              frmAddTarget addTargetDialog = new frmAddTarget(targetList);                //Opens as new addTargetDialog

              if(addTargetDialog.ShowDialog() == DialogResult.OK)
              {
            TargetSettings ts = addTargetDialog.getTargetSettings();  //Fetches target settings from addTargetDialog
            _proInter.addTarget(_strTabIndex, ts);                    //Adds target to project
              }
              enableTargetButtons();
            }
            catch(Exception ex)
            {
              MessageBox.Show("There has been an error: \n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
              }
        }
Пример #3
0
        ///
        /// <summary>
        /// Edit's selected target's settings.
        /// </summary>
        public void editTarget()
        {
            if (_strTabIndex == "")
            {
                return;
            }

            string strTarget = _tabInter.getSelectedIP(_strTabIndex);

            if ((strTarget == "") || (_proInter.checkActiveSingle(_strTabIndex, strTarget) == true))
            {
                return;
            }
            else
            {
                List <TargetSettings> lstTSettings = _proInter.getTargets(_strTabIndex);
                TargetSettings        oldTs        = null;

                foreach (TargetSettings ts in lstTSettings)
                {
                    if (ts.TargetServer == strTarget)
                    {
                        oldTs = ts;
                        break;
                    }
                }
                frmAddTarget targetDialog = new frmAddTarget(lstTSettings, oldTs);

                if (targetDialog.ShowDialog() == DialogResult.OK)
                {
                    _proInter.removeTarget(_strTabIndex);
                    TargetSettings ts = targetDialog.getTargetSettings(); //Fetches target settings from addTargetDialog
                    _proInter.addTarget(_strTabIndex, ts);                //Adds target to project
                }
            }
        }
Пример #4
0
        ///
        /// <summary>
        /// Edit's selected target's settings.
        /// </summary>
        public void editTarget()
        {
            if(_strTabIndex == "")
              {
            return;
              }

              string strTarget = _tabInter.getSelectedIP(_strTabIndex);

              if((strTarget == "") || (_proInter.checkActiveSingle(_strTabIndex, strTarget) == true))
              {
            return;
              }
              else
              {
            List<TargetSettings> lstTSettings = _proInter.getTargets(_strTabIndex);
            TargetSettings oldTs = null;

            foreach(TargetSettings ts in lstTSettings)
            {
              if(ts.TargetServer == strTarget)
              {
            oldTs = ts;
            break;
              }
            }
            frmAddTarget targetDialog = new frmAddTarget(lstTSettings, oldTs);

            if(targetDialog.ShowDialog() == DialogResult.OK)
            {
              _proInter.removeTarget(_strTabIndex);
              TargetSettings ts = targetDialog.getTargetSettings();     //Fetches target settings from addTargetDialog
              _proInter.addTarget(_strTabIndex, ts);                    //Adds target to project
            }
              }
        }