Ejemplo n.º 1
0
        private void DrawEmptyAllocation()
        {
            for (int i = 0; i < this.TotalColumn; i++)    //列
            {
                for (int j = 0; j < this.TotalLayer; j++) //层
                {
                    int column = i + 1;
                    int layer  = (Direction == 0)? (TotalLayer - j) : (j + 1); //方向 0:正向 => 1层在下面;1:反向 => 1层在上面
                    var item   = AllocationItems.FirstOrDefault(c => c.Column == column && c.Layer == layer);
                    if (item == null)
                    {
                        item = new AllocationItem()
                        {
                            Column     = column, Layer = layer,
                            PalletInfo = column + "-" + layer
                        };

                        AllocationItems.Add(item);
                    }

                    item.Width  = ColumnWidth <= 2 ? 1 : ColumnWidth - 2;
                    item.Height = LayerHeight <= 2 ? 1 : LayerHeight - 2;

                    Canvas.SetLeft(item, this.InnerPadding.Left + (i * this.ColumnWidth));
                    Canvas.SetTop(item, this.InnerPadding.Top + (j * this.LayerHeight));
                }
            }
        }
Ejemplo n.º 2
0
        private static void PalletInfoChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AllocationItem allocationItem = d as AllocationItem;
            if (allocationItem == null) return;

            allocationItem.tbPalletInfo.Text = allocationItem.PalletInfo;
        }
Ejemplo n.º 3
0
        private static void IsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AllocationItem allocationItem = d as AllocationItem;
            if (allocationItem == null) return;

            allocationItem.bdMain.BorderThickness = allocationItem.IsSelected ? new Thickness(2) : new Thickness(0);
        }
Ejemplo n.º 4
0
        private static void AlloImageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AllocationItem allocationItem = d as AllocationItem;
            if (allocationItem == null) return;

            allocationItem.imgAllo.Source = allocationItem.AlloImage;
        }
Ejemplo n.º 5
0
        private static void AlloColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AllocationItem allocationItem = d as AllocationItem;
            if (allocationItem == null) return;

            allocationItem.bAllo.Background = allocationItem.AlloColor;
        }
Ejemplo n.º 6
0
        private static void ShowTitleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AllocationItem allocationItem = d as AllocationItem;
            if (allocationItem == null) return;

            allocationItem.rdShowTitle.Height = allocationItem.ShowTitle ? new GridLength(23) : new GridLength(0);
        }
Ejemplo n.º 7
0
        private static void PalletStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AllocationItem allocationItem = d as AllocationItem;
            if (allocationItem == null) return;

            allocationItem.rdPalletHeight.Height = (allocationItem.PalletState >= 0) ? new GridLength(27) : new GridLength(0);

            allocationItem.PalletColor = (allocationItem.PalletState == 1) ? DefPalletColor : EmptyAlloColor;
        }
Ejemplo n.º 8
0
        private static void PalletColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AllocationItem allocationItem = d as AllocationItem;
            if (allocationItem == null) return;

            allocationItem.bPallet.Background = allocationItem.PalletColor;

            if (allocationItem.PalletColor == Brushes.White) //白色
            {
                allocationItem.rdPalletHeight.Height = new GridLength(23);
                allocationItem.bPallet.Visibility = Visibility.Collapsed;
                //allocationItem.bPalletContent.Margin = new Thickness(0);
            }
        }