public static void CarriageReturnFix(ForkTaleNode forkTaleNode) { forkTaleNode.Description = forkTaleNode.Description.Replace("\n", "\r\n"); foreach (var v in forkTaleNode.ChildNodes) { CarriageReturnFix(v); } }
public static ForkTaleNode GetNodeByID(Guid selectedGuid, ForkTaleNode startNode) { if (startNode.ID == selectedGuid) return startNode; return startNode.ChildNodes.Select(node => GetNodeByID(selectedGuid, node)) .FirstOrDefault(guid => guid != null); }
private void AddButton_Click(object sender, EventArgs e) { var ftNode = new ForkTaleNode("New Node", ""); _viewModel.CurrentNode.ChildNodes.Add(ftNode); _currentTreeNode.Nodes.Add(new TreeNode(ftNode.Tag) {Tag = ftNode}); Init(_currentTreeNode, _viewModel); }
public void SetCurrentForkTale(ForkTale forktale) { _currentForkTale = forktale; CurrentNode = forktale.ParentNode; ApplyColorScheme(forktale.Global.ColorScheme); this.Title = forktale.Global.ForkTaleTitle; Maximize(forktale.Global.IsMaximized); }
private static ForkTaleNode GetNodeByGuid(Guid guid, ForkTaleNode startNode) { if (startNode.ID == guid) return startNode; if (startNode.ChildNodes != null && startNode.ChildNodes.Count > 0) { return startNode.ChildNodes.Select(node => GetNodeByGuid(guid, node)) .FirstOrDefault(returnVal => returnVal != null); } return null; }
private static void FillTreeNodes(TreeNode treeNode, ForkTaleNode ftNode) { treeNode.Text = ftNode.Tag; treeNode.Tag = ftNode; foreach (var node in ftNode.ChildNodes) { int ftIndex = ftNode.ChildNodes.IndexOf(node); if(treeNode.Nodes.Count <= ftIndex) treeNode.Nodes.Add(new TreeNode()); FillTreeNodes(treeNode.Nodes[ftIndex], node); } }
public void RemoveChildNode(ForkTaleNode parentNode, ForkTaleNode childNode) { if (parentNode != null && parentNode.ChildNodes != null && parentNode.ChildNodes.Count > 0) parentNode.ChildNodes.Remove(childNode); }
private void UpdateCurrentNode(ForkTaleNode currentNode) { MainTextBox.Text = currentNode.Description; ChoiceListBox.ItemsSource = null; ChoiceListBox.ItemsSource = currentNode.ChildNodes; ChoiceListBox.DisplayMemberPath = "Tag"; ChoiceListBox.SelectedValuePath = "ID"; }
private void Select() { if (ChoiceListBox.SelectedIndex >= 0) CurrentNode = CurrentNode.ChildNodes.Where(x => x.ID == (Guid)ChoiceListBox.SelectedValue).ToList()[0]; }
public ForkTale() { ParentNode = new ForkTaleNode(); OnConstruction(); }
public void AddNewChildToNode(ForkTaleNode node, string tag, string description) { if (node.ChildNodes != null) node.ChildNodes.Add(new ForkTaleNode(tag, description)); }
public void AddChildNode() { SelectedChildNode = _node.AddChild(); OnPropertyChanged("ChildNodes"); }
public NodeEditorViewModel(ForkTaleNode node) { Node = node; }
public static ForkTaleNode GetSelectedNode(ForkTaleNode node) { return node.IsSelected ? node : node.ChildNodes.Select(GetSelectedNode).FirstOrDefault(returnNode => returnNode != null); }
public ForkTale(ForkTaleNode parentNode) { ParentNode = parentNode; OnConstruction(); }
private void OpenFile(string filePath, bool askToSave) { if (filePath==null) return; if (askToSave && !AskToSave()) return; _fileName = filePath; _forkTale = (ForkTale)SaveLoad.SaveLoad.LoadForkTale(filePath); _currentNode = _forkTale.ParentNode; }
public ForkTaleNode AddChild() { var node = new ForkTaleNode(); ChildNodes.Add(node); return node; }
public void AddNewChildToNode(ForkTaleNode node) { if (node.ChildNodes != null) node.ChildNodes.Add(new ForkTaleNode()); }
public void DeleteChildNode(ForkTaleNode selectedChildNode) { if (selectedChildNode != null && ChildNodes.Contains(selectedChildNode)) ChildNodes.Remove(selectedChildNode); }
public void New(bool askToSave = true) { if (askToSave && !AskToSave()) return; _fileName = null; _forkTale = new ForkTale(new ForkTaleNode("New ForkTale", "")); _currentNode = _forkTale.ParentNode; }
private void LoadButton_Click(object sender, RoutedEventArgs e) { var fileName = FileDialog.GetFileNameForOpen("ftsx", "ForkTale Save XML"); if (!File.Exists(fileName)) return; var save = (ForkTaleSave) SaveLoad.SaveLoad.LoadForkTaleSave(fileName); CurrentNode = GetNodeByGuid(save.SavedId, _currentForkTale.ParentNode); }