Fixed UI and modify status not updating for some operations

This commit is contained in:
Justin Aquadro 2012-09-02 00:43:54 -04:00
parent 4c88319aae
commit 933785f19f
4 changed files with 12 additions and 11 deletions

View file

@ -128,6 +128,8 @@ namespace NBTExplorer
if (ofd.ShowDialog() == DialogResult.OK) { if (ofd.ShowDialog() == DialogResult.OK) {
OpenPaths(ofd.FileNames); OpenPaths(ofd.FileNames);
} }
UpdateUI();
} }
private void OpenFolder () private void OpenFolder ()
@ -140,6 +142,8 @@ namespace NBTExplorer
_openFolderPath = ofd.SelectedPath; _openFolderPath = ofd.SelectedPath;
OpenPaths(new string[] { ofd.SelectedPath }); OpenPaths(new string[] { ofd.SelectedPath });
} }
UpdateUI();
} }
public void OpenPaths (string[] paths) public void OpenPaths (string[] paths)
@ -160,6 +164,8 @@ namespace NBTExplorer
if (_nodeTree.Nodes.Count > 0) { if (_nodeTree.Nodes.Count > 0) {
_nodeTree.Nodes[0].Expand(); _nodeTree.Nodes[0].Expand();
} }
UpdateUI();
} }
private void OpenMinecraftDirectory () private void OpenMinecraftDirectory ()
@ -185,6 +191,8 @@ namespace NBTExplorer
Application.Exit(); Application.Exit();
} }
} }
UpdateUI();
} }
private TreeNode CreateUnexpandedNode (DataNode node) private TreeNode CreateUnexpandedNode (DataNode node)
@ -310,17 +318,6 @@ namespace NBTExplorer
foreach (TreeNode child in node.Nodes) foreach (TreeNode child in node.Nodes)
child.ContextMenuStrip = BuildNodeContextMenu(child.Tag as DataNode); child.ContextMenuStrip = BuildNodeContextMenu(child.Tag as DataNode);
/*foreach (DataNode child in dataNode.Nodes) {
if (!currentNodes.ContainsKey(child))
node.Nodes.Add(CreateUnexpandedNode(child));
else
currentNodes.Remove(child);
}
foreach (TreeNode child in currentNodes.Values) {
node.Nodes.Remove(child);
}*/
if (node.Nodes.Count == 0 && dataNode.HasUnexpandedChildren) { if (node.Nodes.Count == 0 && dataNode.HasUnexpandedChildren) {
ExpandNode(node); ExpandNode(node);
node.Expand(); node.Expand();
@ -353,6 +350,7 @@ namespace NBTExplorer
if (dataNode.RenameNode()) { if (dataNode.RenameNode()) {
node.Text = dataNode.NodeDisplay; node.Text = dataNode.NodeDisplay;
UpdateUI(dataNode);
} }
} }

View file

@ -100,6 +100,7 @@ namespace NBTExplorer.Model
private void AddTag (TagNode tag, string name) private void AddTag (TagNode tag, string name)
{ {
_container.AddTag(tag, name); _container.AddTag(tag, name);
IsModified = true;
if (IsExpanded) { if (IsExpanded) {
TagDataNode node = TagDataNode.CreateFromTag(tag); TagDataNode node = TagDataNode.CreateFromTag(tag);

View file

@ -275,6 +275,7 @@ namespace NBTExplorer.Model
DataNode parent = Parent; DataNode parent = Parent;
parent.Nodes.Remove(this); parent.Nodes.Remove(this);
parent.Nodes.Insert(newIndex, this); parent.Nodes.Insert(newIndex, this);
parent.IsModified = true;
return true; return true;
} }

View file

@ -100,6 +100,7 @@ namespace NBTExplorer.Model
private void AppendTag (TagNode tag) private void AppendTag (TagNode tag)
{ {
_container.InsertTag(tag, _container.TagCount); _container.InsertTag(tag, _container.TagCount);
IsModified = true;
if (IsExpanded) { if (IsExpanded) {
TagDataNode node = TagDataNode.CreateFromTag(tag); TagDataNode node = TagDataNode.CreateFromTag(tag);