Beispiel #1
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            ShirtState shirtState = (ShirtState)value;

            if (parameter.ToString().Equals("Collapsed"))
            {
                if (shirtState.Equals(ShirtState.Flagged))
                {
                    return(Visibility.Collapsed);
                }

                return(Visibility.Visible);
            }

            if (parameter.ToString().Equals("Visible"))
            {
                if (shirtState.Equals(ShirtState.Flagged))
                {
                    return(Visibility.Visible);
                }

                return(Visibility.Collapsed);
            }

            return(Binding.DoNothing);
        }
Beispiel #2
0
        private void CreateRandomShirt()
        {
            string shirtType;
            Uri    shirtTypeImage;
            Uri    shirtTypeImageOutline = null;

            switch (_random.Next(6))
            {
            case 0:
                shirtType = "YouthTShirt";
                break;

            case 1:
                shirtType = "LongSleeveShirt";
                break;

            case 2:
                //shirtType = "PremiumTShirt";
                shirtType = "TShirt";
                break;

            case 3:
                shirtType = "YouthTShirt";
                break;

            case 4:
                shirtType = "WomensTShirt";
                break;

            default:
                shirtType = "TShirt";
                break;
            }

            double shirtSize;

            switch (_random.Next(7))
            {
            case 0:
                shirtSize = 0.5;        // S
                break;

            case 1:
                shirtSize = 0.8;        // XXL
                break;

            default:
                shirtSize = 0.6;
                break;
            }

            Color color;

            switch (_random.Next(5))
            {
            case 0:
                color = Color.DimGray;
                break;

            case 1:
                color = Color.DarkOrange;
                break;

            default:
                color = Color.LightGray;
                break;
            }

            ShirtState shirtState;

            switch (_random.Next(5))
            {
            case 0:
                shirtState = ShirtState.Empty;
                break;

            case 1:
                shirtState = ShirtState.Flagged;
                break;

            default:
                shirtState = ShirtState.Loaded;
                break;
            }

            string shirtMaterialType;

            switch (_random.Next(4))
            {
            case 0:
                shirtMaterialType = "premium";
                break;

            default:
                shirtMaterialType = "basic";
                break;
            }

            var directoryInfo = Directory.GetParent(Directory.GetCurrentDirectory()).Parent;

            if (directoryInfo != null)
            {
                string uriStringShirt   = directoryInfo.FullName + "/Resources/shirt_" + shirtType + ".png";
                string uriStringOutline = directoryInfo.FullName + "/Resources/shirt_" + shirtType + "_line.png";
                if (File.Exists(uriStringShirt))
                {
                    shirtTypeImage = new Uri(uriStringShirt);
                }
                else
                {
                    shirtTypeImage =
                        new Uri(
                            "pack://application:,,,/VP.FF.PT.Common.WpfInfrastructure;Component/Styles/Resources/Images/shirt_missing_image.png",
                            UriKind.Absolute);
                }

                if (File.Exists(uriStringOutline))
                {
                    shirtTypeImageOutline = new Uri(uriStringOutline);
                }
            }
            else
            {
                shirtTypeImage =
                    new Uri(
                        "pack://application:,,,/VP.FF.PT.Common.WpfInfrastructure;Component/Styles/Resources/Images/shirt_missing_image.png",
                        UriKind.Absolute);
            }

            _color             = color;
            _shirtState        = shirtState;
            _shirtType         = shirtType;
            _shirtMaterialType = shirtMaterialType;
            _size        = shirtSize;
            _originLabel = new OriginLabel {
                CountryName = "Bangladesh"
            };
            _shirtTypeImage        = shirtTypeImage;
            _shirtTypeImageOutline = shirtTypeImageOutline;
            _barcode = "12345-67039-24789";
            _route   = new ObservableCollection <string>
            {
                "LOA",
                "ICB",
                "ROT",
                "HPM",
                "COM",
                "ICB",
                "LAB",
                "FOL",
                "BAG",
                "MFG",
                "RHB",
                "WDWR",
                "FPS",
                "LOD",
                "THC",
                "OCB",
                "WOW"
            };
            _selectedRouteIndex = 10;
            _lastRfidRead       = new DateTime(2014, 2, 24, 16, 23, 1);
            _rfidReadCounter    = 1337;
            _timeInSystem       = new TimeSpan(1, 2, 34, 17);
            _flaggedComment     =
                "Lorem ipsum dolor sit amet, consete ur sadip scing elitr, sed diam non u my eirmod tempor invidunt ut labore et dolore magna aliquyam erat";
            _isFrontFoilPending = _random.Next(0, 2) == 0;
            _isBackFoilPending  = _random.Next(0, 2) == 0;

            if (_random.Next(0, 3) == 0)
            {
                _frontPrint = LoadImageHelper.LoadImage("dummy");
            }

            if (_random.Next(0, 3) == 0)
            {
                _backPrint = LoadImageHelper.LoadImage("dummy");
            }
            // front/back preview not needed for loading station
        }
 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     this.goToState(ShirtState.ToString());
 }