Пример #1
0
        private async void TreeView_Enter(object sender, EventArgs e)
        {
            HideAll();
            DashboardPanel_TreeView.Nodes.Clear();
            var username           = Properties.Settings.Default["Username"].ToString();
            var getCampaignsResult = await client.GetCampaigns(username);

            foreach (var campaign in getCampaignsResult.Campaigns)
            {
                TreeNode nodeLevel1 = DashboardPanel_TreeView.Nodes.Add(campaign.Name + " (" + campaign.Status + ")");
                nodeLevel1.Tag = campaign;

                var getProcessesResult = await client.GetProcesses(campaign.Id);

                foreach (var process in getProcessesResult.Processes)
                {
                    TreeNode nodeLevel2 = nodeLevel1.Nodes.Add("Process (" + process.Status + ")");
                    nodeLevel2.Tag = process;
                    if (process.Status == "Pending")
                    {
                        Color color = Color.FromArgb(0, 240, 240);
                        nodeLevel2.BackColor = color;
                    }
                    var getDeliveryDemandsResult = await client.GetDeliveryDemands(process.Id);

                    if (getDeliveryDemandsResult.DeliveryDemands.Count != 0)
                    {
                        var      deliveryDemand = getDeliveryDemandsResult.DeliveryDemands[0];
                        TreeNode node           = nodeLevel2.Nodes.Add("Delivery Demand (" + deliveryDemand.Status + ")");
                        node.Tag = deliveryDemand;
                    }
                    var getContributionsResult = await client.GetContributions(processId : process.Id);

                    foreach (var contribution in getContributionsResult.Contributions)
                    {
                        if (contribution.Type != "Delivery")
                        {
                            TreeNode node = nodeLevel2.Nodes.Add("Contribution (" + contribution.Status + ")");
                            node.Tag = contribution;
                        }
                        else
                        {
                            TreeNode node = nodeLevel2.Nodes[0].Nodes.Add("Contribution (" + contribution.Status + ")");
                            node.Tag = contribution;
                        }
                    }
                }
            }
            for (var i = 0; i < DashboardPanel_TreeView.Nodes.Count; i++)
            {
                DashboardPanel_TreeView.Nodes[i].Expand();
            }
        }
Пример #2
0
        private async void MyContributionsPanel_Enter(object sender, EventArgs e)
        {
            MyContributionsPanel_ListView.Columns[0].Width = 140;
            MyContributionsPanel_ListView.Columns[1].Width = 140;
            MyContributionsPanel_ListView.Items.Clear();
            MyContributionsPanel.Refresh();
            var getContributionsResult = await client.GetContributions(Properties.Settings.Default["Username"].ToString());

            foreach (var contribution in getContributionsResult.Contributions)
            {
                var item = new ListViewItem(new[] { contribution.Type, contribution.Status })
                {
                    Tag = contribution.Id
                };
                MyContributionsPanel_ListView.Items.Add(item);
            }
            MyContributionsPanel.Refresh();
        }