상속: Queue.UI.WinForms.DependencyForm
예제 #1
0
        private void editLifeSituationMenuItem_Click(object sender, EventArgs e)
        {
            var selectedNode = treeView.SelectedNode;
            if (selectedNode != null)
            {
                var lifeSituation = selectedNode.Tag as LifeSituation;
                using (var f = new EditLifeSituationForm(null, lifeSituation.Id))
                {
                    f.Saved += (s, eventArgs) =>
                    {
                        selectedNode.Text = f.LifeSituation.ToString();
                        f.Close();
                    };

                    f.ShowDialog();
                }
            }
        }
예제 #2
0
        private void addLifeSituationMenuItem_Click(object sender, EventArgs e)
        {
            Guid? groupId = null;

            var selectedNode = treeView.SelectedNode;
            if (selectedNode != null)
            {
                groupId = (selectedNode.Tag as LifeSituationGroup).Id;
            }

            using (var f = new EditLifeSituationForm(groupId))
            {
                TreeNode treeNode = null;

                f.Saved += (s, eventArgs) =>
                {
                    if (treeNode == null)
                    {
                        treeNode = new TreeNode();
                        treeNode.Tag = f.LifeSituation;
                        treeNode.Checked = f.LifeSituation.IsActive;

                        if (selectedNode != null)
                        {
                            selectedNode.Nodes.Add(treeNode);
                            selectedNode.Expand();
                        }
                        else
                        {
                            treeView.Nodes.Add(treeNode);
                        }

                        treeView.SelectedNode = treeNode;
                    }

                    treeNode.Text = f.LifeSituation.ToString();
                    f.Close();
                };

                f.ShowDialog();
            }
        }