//#pragma warning restore 0649 internal DlgLineEntity(Dlg.DlgLine DlgLine) { InitializeComponent(); interaction = new Dlg.Interaction(); this.interaction.dlgLine = DlgLine; this.textBlockId.Text = DlgLine.id; this.textBlockValue.Text = DlgLine.text; connectArray[0] = NorthConnect; connectArray[1] = WestConnect; connectArray[2] = EastConnect; connectArray[3] = SouthConnect; connectArray[4] = NortEastConnect; connectArray[5] = NorthWestConnect; connectArray[6] = SouthWestConnect; connectArray[7] = SouthEastConnect; dropArray[0] = NorthDrop; dropArray[1] = WestDrop; dropArray[2] = EastDrop; dropArray[3] = SouthDrop; dropArray[4] = NorthWestDrop; dropArray[5] = NorthEastDrop; dropArray[6] = SouthWestDrop; dropArray[7] = SouthEastDrop; for (int i = 0; i < 8; i++) { connectArray[i].Tag = this; dropArray[i].Tag = this; } }
private void createDlgLineEntity(Dlg.DlgLine dlgLine, Point p) { //Create DlgLineEntity DlgLineEntity newDlgLineEntity = new DlgLineEntity(dlgLine); newDlgLineEntity.PreviewMouseDown += DlgLineEntity_PreviewMouseDown; newDlgLineEntity.MouseEnter += DlgLineEntity_MouseEnter; newDlgLineEntity.MouseLeave += DlgLineEntity_MouseLeave; //Create interaction Dlg.Interaction newInteraction = newDlgLineEntity.interaction; newInteraction.dlgLine = dlgLine; newInteraction.dlgLineEntity = newDlgLineEntity; newInteraction.dialogue = Dlg.Dialogue.Selected; Dlg.Dialogue.Selected.InteractionList.Add(newInteraction); mapCanvas.Children.Add(newDlgLineEntity); //newDlgLineEntity.Margin = new Thickness(p.X, p.Y, 0, 0); moveDlgLineEntity(newDlgLineEntity, p); #region drops and connects for (int i = 0; i < 8; i++) { newDlgLineEntity.dropArray[i].DragEnter += DlgLineEntityDrops_DragEnter; newDlgLineEntity.dropArray[i].DragLeave += DlgLineEntityDrops_DragLeave; newDlgLineEntity.dropArray[i].Drop += DlgLineEntityDrops_Drop; newDlgLineEntity.connectArray[i].PreviewMouseDown += DlgLineEntityConnect_PreviewMouseDown; } #endregion }
private void DlgLineTreeViewItem_MouseDown(object sender, MouseEventArgs e) { Dlg.DlgLine selectedLine = ((TreeViewItem)sender).Tag as Dlg.DlgLine; if (DH.mouseMode == DialogueHandler.MouseMode.None) { DH.mouseStartPosition = Mouse.GetPosition(null); DH.mouseMode = DialogueHandler.MouseMode.Drag; tbMouseMode.Text = "DragObject"; } }
private void buttonNew_Click(object sender, RoutedEventArgs e) { if (cbCharacter.SelectedIndex != -1) { newLine = new Dlg.DlgLine(); newLine.character = mw.characterDictionary[(string)cbCharacter.SelectedItem]; newLine.text = textBoxLine.Text; newLine.id = newLine.character.name + "_" + newLine.character.lineIndex.ToString(); newLine.character.lineIndex++; newLine.character.dlgLines.Add(newLine.id, newLine); this.DialogResult = true; } else { MessageBox.Show("Please select a character before creating a new Line"); } }
//Creates a dlgVisualObject private void mainCanvas_Drop(object sender, DragEventArgs e) { //Sender is mainCanvas //if (e.Data.GetData(typeof(Dlg.Line)) != null) if (mouseMode == MouseMode.Drag) { Dlg.DlgLine droppedLine = e.Data.GetData(typeof(Dlg.DlgLine)) as Dlg.DlgLine; createDlgLineEntity(droppedLine, e.GetPosition(mapCanvas)); } else if (mouseMode == MouseMode.Connect) { mapCanvas.Children.Remove(Dlg.InteractionConnection.Selected.arrow.arrowPoly); Dlg.InteractionConnection.Selected.arrow = null; mouseMode = MouseMode.None; mw.tbMouseMode.Text = "None"; } }
//###################### CONTROLS ###################### private void menuNewLine_Click(object sender, RoutedEventArgs e) { Dlg.DlgLine newLine = createNewLine(); }