Exemplo n.º 1
0
        public void RefreshProfile(GenDataBase genDataBase, GenObject genObject)
        {
            var selectedItem = ProfileNavigatorTreeView.SelectedNode;
            var dataProfile  = GenDataEditorViewModel.Data.Profile;

            dataProfile.Fragment = ProfileEditorTreeViewBuilder.GetNodeData(selectedItem);
            var text = dataProfile.GetNodeProfileText();

            // Don't change to prevent unnecessary rendering and side effects
            if (text != ProfileTextBox.Text)
            {
                var start = ProfileTextBox.SelectionStart;
                ProfileTextBox.Clear();
                ProfileTextBox.Text           = text;
                ProfileTextBox.SelectionStart = start;
            }


            text = dataProfile.GetNodeExpansionText(genDataBase, genObject);

            // Don't change to prevent unnecessary rendering and side effects
            if (text != ProfileExpansionTextBox.Text)
            {
                var start = ProfileExpansionTextBox.SelectionStart;
                ProfileExpansionTextBox.Clear();
                ProfileExpansionTextBox.Text           = text;
                ProfileExpansionTextBox.SelectionStart = start;
            }
        }
Exemplo n.º 2
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (IsBuilding)
            {
                return;
            }

            var newFragment = ProfileEditorTreeViewBuilder.GetNodeData(e.Node);

            if (newFragment == GenDataEditorViewModel.Data.Profile.Fragment)
            {
                return;
            }
            RefreshProfile(GenDataEditorViewModel.Data.GenDataBase, GenDataEditorViewModel.Data.GenObject);
        }
Exemplo n.º 3
0
        public void LoadData()
        {
            ProfileNavigatorTreeView.Nodes.Clear();
            ProfileExpansionTextBox.Clear();
            ProfileTextBox.Clear();
            if (GenDataEditorViewModel == null || GenDataEditorViewModel.ProfileIsUndefined())
            {
                return;
            }

            var data = GenDataEditorViewModel.Data;

            data.Profile.Fragment = data.Profile.Profile;
            var builder = new ProfileEditorTreeViewBuilder(data);

            IsBuilding = true;
            builder.CreateBodyChildTrees(ProfileNavigatorTreeView.Nodes, data.Profile.GetBody());
            IsBuilding = false;
            if (ProfileNavigatorTreeView.Nodes.Count > 0)
            {
                ProfileNavigatorTreeView.SelectedNode = ProfileNavigatorTreeView.Nodes[0];
            }
        }