public StarSystem(StarSystem copy)
        {
            stations = new List<Station>();

            name = copy.Name;

            foreach (Station station in copy.Stations)
                stations.Add(new Station(station));
        }
 public Trade(Trade copy)
 {
     commodity = new Commodity(copy.Commodity);
     startSystem = new StarSystem(copy.StartSystem);
     endSystem = new StarSystem(copy.EndSystem);
     startStation = new Station(copy.StartStation);
     endStation = new Station(copy.EndStation);
     unitsBought = copy.UnitsBought;
     score = copy.Score;
 }
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(SystemTextBox.Text))
            {
                MessageBox.Show("Please provide a name for the system.", "Error: System name needed", MessageBoxButtons.OK);
                return;
            }

            result = new StarSystem();
            result.Name = SystemTextBox.Text;
            this.Close();
        }
Ejemplo n.º 4
0
        private void BindCommodities()
        {
            bindingTable = new DataTable();

            bindingTable.Columns.Add("Index");
            bindingTable.Columns.Add("Commodity");
            bindingTable.Columns.Add("SellPrice");
            bindingTable.Columns.Add("BuyPrice");
            bindingTable.Columns.Add("Supply");
            bindingTable.Columns.Add("LastUpdated");

            bindingTable.Columns["Index"].DataType       = System.Type.GetType("System.Decimal");
            bindingTable.Columns["SellPrice"].DataType   = System.Type.GetType("System.Decimal");
            bindingTable.Columns["BuyPrice"].DataType    = System.Type.GetType("System.Decimal");
            bindingTable.Columns["Supply"].DataType      = System.Type.GetType("System.Decimal");
            bindingTable.Columns["Supply"].DataType      = System.Type.GetType("System.Decimal");
            bindingTable.Columns["LastUpdated"].DataType = System.Type.GetType("System.DateTime");

            CommoditiesGrid.Columns.Clear();

            if (SystemComboBox.SelectedIndex < 0 || gameData.StarSystems.Count == 0)
            {
                return;
            }

            StarSystem selectedSystem = gameData.StarSystems[SystemComboBox.SelectedIndex];

            if (StationComboBox.SelectedIndex < 0 || selectedSystem.Stations.Count == 0)
            {
                return;
            }

            Station selectedStation = selectedSystem.Stations[StationComboBox.SelectedIndex];

            int index = 0;

            foreach (Commodity commodity in selectedStation.Commodities)
            {
                DataRow newRow = bindingTable.NewRow();

                newRow["Index"]       = index;
                newRow["Commodity"]   = commodity.Name;
                newRow["BuyPrice"]    = commodity.BuyPrice;
                newRow["SellPrice"]   = commodity.SellPrice;
                newRow["Supply"]      = commodity.Supply;
                newRow["LastUpdated"] = commodity.LastUpdated;

                bindingTable.Rows.Add(newRow);
                index++;
            }

            CommoditiesGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            CommoditiesGrid.DataSource          = bindingTable;

            CommoditiesGrid.Columns["Index"].Visible = false;

            DataGridViewButtonColumn deleteColumn = new DataGridViewButtonColumn();

            deleteColumn.Name       = "Delete";
            deleteColumn.HeaderText = "Delete";
            deleteColumn.Text       = "Delete";
            deleteColumn.UseColumnTextForButtonValue = true;
            CommoditiesGrid.Columns.Insert(0, deleteColumn);

            DataGridViewButtonColumn upColumn = new DataGridViewButtonColumn();

            upColumn.Name       = "Up";
            upColumn.HeaderText = "Up";
            upColumn.Text       = "▲";
            upColumn.UseColumnTextForButtonValue = true;
            CommoditiesGrid.Columns.Insert(7, upColumn);

            DataGridViewButtonColumn downColumn = new DataGridViewButtonColumn();

            downColumn.Name       = "Down";
            downColumn.HeaderText = "Down";
            downColumn.Text       = "▼";
            downColumn.UseColumnTextForButtonValue = true;
            CommoditiesGrid.Columns.Insert(8, downColumn);
        }
        private static Manifest FindManifest(GameData gameData, StarSystem startSystem, Station startStation, StarSystem endSystem, Station endStation)
        {
            List<Manifest> allManifests = gameData.OptimalManifests.Concat(gameData.UserManifests).ToList();

            foreach (Manifest manifest in allManifests)
            {
                if (manifest.StartSystemName == startSystem.Name && manifest.StartStationName == startStation.Name &&
                    manifest.EndSystemName == endSystem.Name && manifest.EndStationName == endStation.Name)
                    return manifest;
            }

            return null;
        }
 public AddSystemDialog()
 {
     InitializeComponent();
     this.Icon = new Icon("Graphics\\EliteDangerousIcon.ico");
     result    = null;
 }
 public AddSystemDialog()
 {
     InitializeComponent();
     this.Icon = new Icon("Graphics\\EliteDangerousIcon.ico");
     result = null;
 }
        private static Manifest FindManifest(GameData gameData, StarSystem startSystem, Station startStation, StarSystem endSystem, Station endStation)
        {
            List <Manifest> allManifests = gameData.OptimalManifests.Concat(gameData.UserManifests).ToList();

            foreach (Manifest manifest in allManifests)
            {
                if (manifest.StartSystemName == startSystem.Name && manifest.StartStationName == startStation.Name &&
                    manifest.EndSystemName == endSystem.Name && manifest.EndStationName == endStation.Name)
                {
                    return(manifest);
                }
            }

            return(null);
        }