示例#1
0
 public RadarChartOptions(Dictionary <string, object> data, FormWriter writer)
 {
     InitializeComponent();
     Writer = writer;
     Data   = data;
     compareValues.Nodes.AddRange(writer.BuildTree(data.Values.ToArray()));
     aggregateValues.Nodes.AddRange(writer.BuildTree(data.Values.ToArray()));
 }
示例#2
0
        private void Refresh()
        {
            componentSelect.Nodes.Clear();
            Data.Clear();
            Task t;

            radarComparison.Enabled     = false;
            damageOutput.Enabled        = false;
            OverclockedCheckbox.Enabled = false;
            OverpoweredCheckbox.Enabled = false;
            HotCheckbox.Enabled         = false;

            switch (Selected)
            {
            case "Weapons":
                Writer = new WeaponFormWriter(typeof(Weapon));
                t      = Task.Run(() =>
                {
                    MasterData = Weapon.parseAll();
                    //Task.Run(() => { Utility.AssignColors(MasterData.Values.ToList()); });
                    var tree        = Writer.BuildTree(MasterData.Values.ToArray());
                    MethodInvoker d = delegate()
                    {
                        componentSelect.Nodes.AddRange(tree);
                    };
                    componentSelect.BeginInvoke(d);
                });
                Columns   = Writer.Columns;
                Downloads = Writer.GetDownloadInfo();

                t.Wait();

                radarComparison.Enabled     = true;
                damageOutput.Enabled        = true;
                OverclockedCheckbox.Enabled = true;
                OverpoweredCheckbox.Enabled = true;
                HotCheckbox.Enabled         = true;
                break;

            case "Shields":
                Writer = new ShieldFormWriter(typeof(Shield));
                t      = Task.Run(() =>
                {
                    MasterData      = Shield.parseAll();
                    var tree        = Writer.BuildTree(MasterData.Values.ToArray());
                    MethodInvoker d = delegate()
                    {
                        componentSelect.Nodes.AddRange(tree);
                    };
                    componentSelect.BeginInvoke(d);
                });
                Columns   = Writer.Columns;
                Downloads = Writer.GetDownloadInfo();

                t.Wait();

                radarComparison.Enabled = true;
                break;

            case "Power Plants":
                Writer = new PowerPlantWriter(typeof(PowerPlant));
                t      = Task.Run(() =>
                {
                    MasterData      = PowerPlant.parseAll();
                    var tree        = Writer.BuildTree(MasterData.Values.ToArray());
                    MethodInvoker d = delegate()
                    {
                        componentSelect.Nodes.AddRange(tree);
                    };
                    componentSelect.BeginInvoke(d);
                });
                Columns   = Writer.Columns;
                Downloads = Writer.GetDownloadInfo();

                t.Wait();

                radarComparison.Enabled = true;
                break;

            case "Coolers":
                Writer = new CoolerWriter(typeof(Cooler));
                t      = Task.Run(() =>
                {
                    MasterData      = Cooler.parseAll();
                    var tree        = Writer.BuildTree(MasterData.Values.ToArray());
                    MethodInvoker d = delegate()
                    {
                        componentSelect.Nodes.AddRange(tree);
                    };
                    componentSelect.BeginInvoke(d);
                });
                Columns   = Writer.Columns;
                Downloads = Writer.GetDownloadInfo();

                t.Wait();

                radarComparison.Enabled = true;
                break;

            case "Guns":
                Writer = new GunFormWriter(typeof(Gun));
                t      = Task.Run(() =>
                {
                    MasterData = Gun.parseAll();
                    //Task.Run(() => { Utility.AssignColors(MasterData.Values.ToList()); });
                    var tree        = Writer.BuildTree(MasterData.Values.ToArray());
                    MethodInvoker d = delegate()
                    {
                        componentSelect.Nodes.AddRange(tree);
                    };
                    componentSelect.BeginInvoke(d);
                });
                Columns   = Writer.Columns;
                Downloads = Writer.GetDownloadInfo();

                t.Wait();

                radarComparison.Enabled = true;
                damageOutput.Enabled    = true;
                break;

            case "Armor":
                Writer = new ArmorWriter(typeof(Armor));
                t      = Task.Run(() =>
                {
                    MasterData = Armor.parseAll();
                    //Task.Run(() => { Utility.AssignColors(MasterData.Values.ToList()); });
                    var tree        = Writer.BuildTree(MasterData.Values.ToArray());
                    MethodInvoker d = delegate()
                    {
                        componentSelect.Nodes.AddRange(tree);
                    };
                    componentSelect.BeginInvoke(d);
                });
                Columns   = Writer.Columns;
                Downloads = Writer.GetDownloadInfo();

                t.Wait();

                // Nothing to really see yet..
                //radarComparison.Enabled = true;
                break;
            }

            dataGridView1.Columns.Clear();
            for (int i = 0; i < Columns.Length; i++)
            {
                dataGridView1.Columns.Add(Columns[i].Name, Columns[i].Name);
                dataGridView1.Columns[i].ReadOnly = true;
                dataGridView1.Columns[i].DefaultCellStyle.Format = Columns[i].Format;
                dataGridView1.Columns[i].Visible = Columns[i].Visible;
            }
            dataGridView1.Columns[dataGridView1.Columns.IndexOf("Name")].Frozen = true;
        }