Exemplo n.º 1
0
        private void campaignTree_MouseDown(object sender, MouseEventArgs e)
        {
            campaignTree.SelectedNode = campaignTree.GetNodeAt(e.X, e.Y);
            if (e.Button == MouseButtons.Right)
            {
                DetermineTreeContextMenu(campaignTree.SelectedNode);
            }

            if (measuring)
            {
                switch (campaignTree.SelectedNode.Level)
                {
                case 0:     // Take the name of the selected node (which is the campaign name), find the current date of that campaign
                    timeDiffTool.GiveDate(currentCalendar.CampaignList.Find(x => x.Name.Equals(parseCampaignName(campaignTree.SelectedNode.Text))).CurrentDate);
                    break;

                case 1:     //
                    timeDiffTool.GiveDate(CalendarType.ReturnGivenDateFromName(campaignTree.SelectedNode.Text));
                    break;

                case 2:
                    timeDiffTool.GiveDate(
                        currentCalendar.CampaignList.Find(
                            x => x.Name.Equals(
                                parseCampaignName(     // take the node's parent's parent, which is the campaign name. Find the note in that campaign, give date to timedifftool
                                    campaignTree.SelectedNode.Parent.Parent.Text))).findNote(campaignTree.SelectedNode.Text).Date);
                    break;
                }
            }
        }