void DeleteTriggerLogic(TriggerLogic item) { var trigger = Mission.FindLogicOwner(item); trigger.Logic.Remove(item); Mission.RaisePropertyChanged(String.Empty); }
public Trigger FindLogicOwner(TriggerLogic l) { return(triggers.Single(t => t.Logic.Contains(l))); }
void RenameLogicItem(TriggerLogic item) { if (item == null) return; var dialog = new StringRequest { Title = "Rename Item", TextBox = { Text = item.Name }, Owner =this }; if (dialog.ShowDialog() == true) item.Name = dialog.TextBox.Text; }
bool MoveItem(MoveDirection direction, TriggerLogic item, bool toEnd) { if (item == null) return false; var trigger = Mission.FindLogicOwner(item); var index = trigger.Logic.IndexOf(item); if (direction == MoveDirection.Up) { if (index == 0) return false; if (toEnd) trigger.Logic.Move(index, 0); else trigger.Logic.Move(index, index - 1); } else if (direction == MoveDirection.Down) { if (index + 2 > trigger.Logic.Count) return false; if (toEnd) trigger.Logic.Move(index, trigger.Logic.Count - 1); else trigger.Logic.Move(index, index + 1); } var displacedType = trigger.Logic[index]; if ((displacedType is Action && item is Condition) || (displacedType is Condition && item is Action)) MoveItem(direction, item); Mission.RaisePropertyChanged("AllLogic"); return true; }
bool MoveItem(MoveDirection direction, TriggerLogic item, int count) { bool cont = true; for (int i = 0; i < count; i++) { cont = MoveItem(direction, item); if (cont == false) return false; } return true; }
bool MoveItem(MoveDirection direction, TriggerLogic item) { return MoveItem(direction, item, false); }
public Trigger FindLogicOwner(TriggerLogic l) { return triggers.Single(t => t.Logic.Contains(l)); }