private void FormNewTruckAnalysis_Load(object sender, EventArgs e)
        {
            try
            {
                // fill boxes combo
                foreach (TruckProperties truck in _truckProperties)
                {
                    cbTruck.Items.Add(new TruckItem(truck));
                }

                if (null == _truckAnalysis)
                {
                    if (cbTruck.Items.Count > 0)
                    {
                        cbTruck.SelectedIndex = 0;
                    }

                    // allow several pallet layers
                    AllowSeveralPalletLayers = Settings.Default.AllowSeveralPalletLayers;
                    // allowed pallet orientations
                    AllowPalletOrientationX = Settings.Default.AllowPalletOrientationX;
                    AllowPalletOrientationY = Settings.Default.AllowPalletOrientationY;
                    // min distances
                    MinDistancePalletTruckWall = Settings.Default.MinDistancePalletTruckWall;
                    MinDistancePalletTruckRoof = Settings.Default.MinDistancePalletTruckRoof;
                }
                else
                {
                    for (int i = 0; i < cbTruck.Items.Count; ++i)
                    {
                        // selected index
                        TruckItem truckItem = cbTruck.Items[i] as TruckItem;
                        if (truckItem.Item == _truckAnalysis.TruckProperties)
                        {
                            cbTruck.SelectedIndex = i;
                            break;
                        }
                        // allow several pallet layers
                        AllowSeveralPalletLayers = _truckAnalysis.ConstraintSet.MultilayerAllowed;
                        // allowed pallet orientations
                        AllowPalletOrientationX = _truckAnalysis.ConstraintSet.AllowPalletOrientationX;
                        AllowPalletOrientationY = _truckAnalysis.ConstraintSet.AllowPalletOrientationY;
                        // min distance
                        MinDistancePalletTruckRoof = _truckAnalysis.ConstraintSet.MinDistancePalletTruckRoof;
                        MinDistancePalletTruckWall = _truckAnalysis.ConstraintSet.MinDistancePalletTruckWall;
                    }
                }
                // windows settings
                if (null != Settings.Default.FormNewTruckAnalysisPosition)
                {
                    Settings.Default.FormNewTruckAnalysisPosition.Restore(this);
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }
Example #2
0
    void activeItem(TruckItem item)
    {
        GameObject container = Instantiate(itemContainer);

        container.transform.position = transform.position - new Vector3(0, item.obj.GetComponent <BoxCollider2D>().size.y / 2);
        container.transform.position = new Vector3(container.transform.position.x, container.transform.position.y, -1);
        GameObject spawnedObject = Instantiate(item.obj, container.transform);

        item.activable = spawnedObject.GetComponent <Activable>();
        if (item.activable != null)
        {
            item.activable.onDelete.AddListener(() =>
            {
                item.activable = null;
            });
        }
        if (item.animationOnTruck != null)
        {
            item.animationOnTruck.SetTrigger("open");
        }
        item.currentCooldown = item.cooldown;
    }
Example #3
0
 //Deletes the item from the database
 public async void DeleteItem(TruckItem truckItem)
 {
     await _connection.DeleteAsync(truckItem);
 }
Example #4
0
 //updates the database
 public async void UpdateItem(TruckItem truckItem)
 {
     await _connection.UpdateAsync(truckItem);
 }
Example #5
0
 //Inserts into the database
 public async void InsertItem(TruckItem truckItem)
 {
     await _connection.InsertAsync(truckItem);
 }