Beispiel #1
0
        private void listButtons_DoubleClick(object sender, EventArgs e)
        {
            if (listButtons.SelectedIndex == -1)           //should never happen
            {
                return;
            }
            //Save any changes to the cache because the item order could have changed.
            if (SigButDefs.UpdateButtonIndexIfChanged(_arraySigButDefs))
            {
                DataValid.SetInvalid(InvalidType.SigMessages);
            }
            int       selected  = listButtons.SelectedIndex;
            SigButDef sigButDef = SigButDefs.GetByIndex(selected, _arraySigButDefs);
            //Keep track of the currently selected computer name so we know what computer buttons to refresh after making changes.
            string computerNameSelected = (listComputers.SelectedIndex > 0) ? _listComputers[listComputers.SelectedIndex - 1].CompName : "";
            //Now create a new computer name variable that will represent the computer name for the SigButDef.
            string computerNameSigButDef = "";

            if (sigButDef == null)           //Add
            {
                sigButDef             = new SigButDef();
                sigButDef.ButtonIndex = selected;
                if (listComputers.SelectedIndex != 0)
                {
                    computerNameSigButDef = _listComputers[listComputers.SelectedIndex - 1].CompName;
                }
                sigButDef.ComputerName = computerNameSigButDef;
                FormSigButDefEdit FormS = new FormSigButDefEdit(sigButDef.Copy());
                FormS.IsNew = true;
                FormS.ShowDialog();
            }
            else if (sigButDef.ComputerName == "" && listComputers.SelectedIndex != 0)
            {
                //create a copy of the default, and treat it as a new
                sigButDef.ComputerName = _listComputers[listComputers.SelectedIndex - 1].CompName;
                FormSigButDefEdit FormS = new FormSigButDefEdit(sigButDef.Copy());
                FormS.IsNew = true;
                FormS.ShowDialog();
            }
            else                                     //edit
            {
                if (listComputers.SelectedIndex > 0) //If "All" is selected, the computerName will already be blank, so it only needs reset if it isn't "All".
                {
                    computerNameSigButDef = _listComputers[listComputers.SelectedIndex - 1].CompName;
                }
                FormSigButDefEdit FormS = new FormSigButDefEdit(sigButDef.Copy());
                FormS.ShowDialog();
            }
            //Refresh our local list to match the cache in case the user edited or added a new button item.
            _arraySigButDefs = SigButDefs.GetByComputer(computerNameSelected);
            FillList();
        }
Beispiel #2
0
        private void listButtons_DoubleClick(object sender, EventArgs e)
        {
            if (listButtons.SelectedIndex == -1)          //should never happen
            {
                return;
            }
            int       selected = listButtons.SelectedIndex;
            SigButDef button   = SigButDefs.GetByIndex(selected, SubList);

            if (button == null)          //Add
            {
                FormSigButDefEdit FormS = new FormSigButDefEdit();
                FormS.IsNew        = true;
                button             = new SigButDef();
                button.ElementList = new SigButDefElement[0];
                button.ButtonIndex = selected;
                if (listComputers.SelectedIndex == 0)
                {
                    button.ComputerName = "";
                }
                else
                {
                    button.ComputerName = Computers.List[listComputers.SelectedIndex - 1].CompName;
                }
                FormS.ButtonCur = button.Copy();
                FormS.ShowDialog();
            }
            else if (button.ComputerName == "" && listComputers.SelectedIndex != 0)
            {
                //create a copy of the default, and treat it as a new
                FormSigButDefEdit FormS = new FormSigButDefEdit();
                FormS.IsNew         = true;
                button.ComputerName = Computers.List[listComputers.SelectedIndex - 1].CompName;
                FormS.ButtonCur     = button.Copy();
                FormS.ShowDialog();
            }
            else             //edit
            {
                FormSigButDefEdit FormS = new FormSigButDefEdit();
                FormS.ButtonCur = button.Copy();
                FormS.ShowDialog();
            }
            FillList();
        }
Beispiel #3
0
		private void listButtons_DoubleClick(object sender,EventArgs e) {
			if(listButtons.SelectedIndex==-1){//should never happen
				return;
			}
			//Save any changes to the cache because the item order could have changed.
			if(SigButDefs.UpdateButtonIndexIfChanged(SubList)) {
				DataValid.SetInvalid(InvalidType.Signals);
			}
			int selected=listButtons.SelectedIndex;
			SigButDef button=SigButDefs.GetByIndex(selected,SubList);
			string computerName="";
			if(button==null){//Add
				FormSigButDefEdit FormS=new FormSigButDefEdit();
				FormS.IsNew=true;
				button=new SigButDef();
				button.ElementList=new SigButDefElement[0];
				button.ButtonIndex=selected;
				if(listComputers.SelectedIndex!=0) {
					computerName=Computers.List[listComputers.SelectedIndex-1].CompName;
				}
				button.ComputerName=computerName;
				FormS.ButtonCur=button.Copy();
				FormS.ShowDialog();
			}
			else if(button.ComputerName=="" && listComputers.SelectedIndex!=0){
				//create a copy of the default, and treat it as a new
				FormSigButDefEdit FormS=new FormSigButDefEdit();
				FormS.IsNew=true;
				button.ComputerName=Computers.List[listComputers.SelectedIndex-1].CompName;
				FormS.ButtonCur=button.Copy();
				FormS.ShowDialog();
			}
			else{//edit
				if(listComputers.SelectedIndex>0) {//If "All" is selected, the computerName will already be blank, so it only needs reset if it isn't "All".
					computerName=Computers.List[listComputers.SelectedIndex].CompName;
				}
				FormSigButDefEdit FormS=new FormSigButDefEdit();
				FormS.ButtonCur=button.Copy();
				FormS.ShowDialog();
			}
			SubList=SigButDefs.GetByComputer(computerName);//Refresh our local list to match the cache in case the user edited or added a new button item.
			FillList();
		}
Beispiel #4
0
 private void listButtons_DoubleClick(object sender,EventArgs e)
 {
     if(listButtons.SelectedIndex==-1){//should never happen
         return;
     }
     int selected=listButtons.SelectedIndex;
     SigButDef button=SigButDefs.GetByIndex(selected,SubList);
     if(button==null){//Add
         FormSigButDefEdit FormS=new FormSigButDefEdit();
         FormS.IsNew=true;
         button=new SigButDef();
         button.ElementList=new SigButDefElement[0];
         button.ButtonIndex=selected;
         if(listComputers.SelectedIndex==0){
             button.ComputerName="";
         }
         else{
             button.ComputerName=Computers.List[listComputers.SelectedIndex-1].CompName;
         }
         FormS.ButtonCur=button.Copy();
         FormS.ShowDialog();
     }
     else if(button.ComputerName=="" && listComputers.SelectedIndex!=0){
         //create a copy of the default, and treat it as a new
         FormSigButDefEdit FormS=new FormSigButDefEdit();
         FormS.IsNew=true;
         button.ComputerName=Computers.List[listComputers.SelectedIndex-1].CompName;
         FormS.ButtonCur=button.Copy();
         FormS.ShowDialog();
     }
     else{//edit
         FormSigButDefEdit FormS=new FormSigButDefEdit();
         FormS.ButtonCur=button.Copy();
         FormS.ShowDialog();
     }
     FillList();
 }