public bool EditDialog(MainWindow p, Bicycle bFromList)
        {
            bicycle = new DependencyBicycleValidation(bFromList);
            CustomBicycleAddDialog s = new CustomBicycleAddDialog(bicycle);

            s.Owner = p;
            p.GridBackground.Opacity = 1;
            Panel.SetZIndex(p.GridBackground, 1);
            if (s.ShowDialog() == true)
            {
                p.GridBackground.Opacity = 0;
                Panel.SetZIndex(p.GridBackground, 0);
                return(true);
            }
            p.GridBackground.Opacity = 0;
            Panel.SetZIndex(p.GridBackground, 0);
            return(false);
        }
예제 #2
0
        private void AddBicycle()
        {
            Random       myRandom        = new Random((Int32)DateTime.Now.Ticks);
            string       myModel         = myModels[GetRandomNumber()];
            string       myManufacture   = myManufactures[GetRandomNumber()];
            int          myYear          = myYears[GetRandomNumber()];
            int          myNumberOfSpeed = myNumberOfSpeeds[GetRandomNumber()];
            string       myType          = myTypes[GetRandomNumber()];
            BicycleFrame Frame           = new BicycleFrame(myMaterials[GetRandomNumber()], mySizes[GetRandomNumber()]);
            Bicycle      s = new Bicycle(myModel, myManufacture, myYear, myNumberOfSpeed, myType, Frame);

            Bicycles.Add(s);

            int GetRandomNumber()
            {
                return(myRandom.Next(0, 6));
            }
        }