private void listMessages_DoubleClick(object sender, EventArgs e) { if (listMessages.SelectedIndex == -1) { return; } FormSigElementDefEdit FormS = new FormSigElementDefEdit(); FormS.ElementCur = ListMessages[listMessages.SelectedIndex]; FormS.ShowDialog(); if (FormS.DialogResult != DialogResult.OK) { return; } FillLists(); }
private void listToFrom_DoubleClick(object sender, EventArgs e) { if (listToFrom.SelectedIndex == -1) { return; } FormSigElementDefEdit FormS = new FormSigElementDefEdit(); FormS.ElementCur = ListUser[listToFrom.SelectedIndex]; FormS.ShowDialog(); if (FormS.DialogResult != DialogResult.OK) { return; } FillLists(); //not possible to change ItemOrder here. }
private void butAdd_Click(object sender, EventArgs e) { FormSigElementDefEdit FormS = new FormSigElementDefEdit(); FormS.ElementCur = new SigElementDef(); FormS.ElementCur.LightColor = Color.White; //default is user if (listExtras.SelectedIndex != -1) { FormS.ElementCur.SigElementType = SignalElementType.Extra; } if (listMessages.SelectedIndex != -1) { FormS.ElementCur.SigElementType = SignalElementType.Message; } FormS.IsNew = true; FormS.ShowDialog(); if (FormS.DialogResult != DialogResult.OK) { return; } //set the order SigElementDef element = FormS.ElementCur.Copy(); if (element.SigElementType == SignalElementType.User) { element.ItemOrder = ListUser.Length; SigElementDefs.Update(element); } else if (element.SigElementType == SignalElementType.Extra) { element.ItemOrder = ListExtras.Length; SigElementDefs.Update(element); } else if (element.SigElementType == SignalElementType.Message) { element.ItemOrder = ListMessages.Length; SigElementDefs.Update(element); } FillLists(); //Select the item for (int i = 0; i < ListUser.Length; i++) { if (ListUser[i].SigElementDefNum == element.SigElementDefNum) { listToFrom.SelectedIndex = i; } } for (int i = 0; i < ListExtras.Length; i++) { if (ListExtras[i].SigElementDefNum == element.SigElementDefNum) { listExtras.SelectedIndex = i; } } for (int i = 0; i < ListMessages.Length; i++) { if (ListMessages[i].SigElementDefNum == element.SigElementDefNum) { listMessages.SelectedIndex = i; } } }
private void listMessages_DoubleClick(object sender,EventArgs e) { if(listMessages.SelectedIndex==-1) { return; } FormSigElementDefEdit FormS=new FormSigElementDefEdit(); FormS.ElementCur=ListMessages[listMessages.SelectedIndex]; FormS.ShowDialog(); if(FormS.DialogResult!=DialogResult.OK) { return; } FillLists(); }
private void listToFrom_DoubleClick(object sender,EventArgs e) { if(listToFrom.SelectedIndex==-1){ return; } FormSigElementDefEdit FormS=new FormSigElementDefEdit(); FormS.ElementCur=ListUser[listToFrom.SelectedIndex]; FormS.ShowDialog(); if(FormS.DialogResult!=DialogResult.OK) { return; } FillLists(); //not possible to change ItemOrder here. }
private void butAdd_Click(object sender,EventArgs e) { FormSigElementDefEdit FormS=new FormSigElementDefEdit(); FormS.ElementCur=new SigElementDef(); FormS.ElementCur.LightColor=Color.White; //default is user if(listExtras.SelectedIndex!=-1){ FormS.ElementCur.SigElementType=SignalElementType.Extra; } if(listMessages.SelectedIndex!=-1) { FormS.ElementCur.SigElementType=SignalElementType.Message; } FormS.IsNew=true; FormS.ShowDialog(); if(FormS.DialogResult!=DialogResult.OK){ return; } //set the order SigElementDef element=FormS.ElementCur.Copy(); if(element.SigElementType==SignalElementType.User){ element.ItemOrder=ListUser.Length; SigElementDefs.Update(element); } else if(element.SigElementType==SignalElementType.Extra) { element.ItemOrder=ListExtras.Length; SigElementDefs.Update(element); } else if(element.SigElementType==SignalElementType.Message) { element.ItemOrder=ListMessages.Length; SigElementDefs.Update(element); } FillLists(); //Select the item for(int i=0;i<ListUser.Length;i++){ if(ListUser[i].SigElementDefNum==element.SigElementDefNum){ listToFrom.SelectedIndex=i; } } for(int i=0;i<ListExtras.Length;i++) { if(ListExtras[i].SigElementDefNum==element.SigElementDefNum) { listExtras.SelectedIndex=i; } } for(int i=0;i<ListMessages.Length;i++) { if(ListMessages[i].SigElementDefNum==element.SigElementDefNum) { listMessages.SelectedIndex=i; } } }