Example #1
0
        public OutputView(List <Package> _Packages, DeviceSelector _screen, MainWindow parent)
        {
            Packages.AddRange(_Packages);
            ContainerObject = LoadedContainer.GetModel(Rand);
            InitializeComponent();

            this.parent    = parent;
            previousscreen = _screen;

            Packages = Packages.OrderByDescending(b => b.Volume()).ToList();

            foreach (Package box in Packages.ToArray())
            {
                if (!LoadedContainer.AddBox(box))
                {
                    StepListBox.Items.Add("This Container could not be loaded with these packages.");
                    return;
                }
            }
            foreach (Package box in Packages.ToArray())
            {
                StepListBox.Items.Add(string.Concat("Load ", box.Name, " at the shown location"));
                AllPackageVisuals.Add(box.GetModel(Rand));
            }
            ModelGroup.Children.Add(AllPackageVisuals[0]);
            ModelGroup.Children.Add(ContainerObject);
            ShownStepModel.Content         = ModelGroup;
            StepSlider.Maximum             = Packages.Count();
            StepSlider.Minimum             = 1;
            StepSlider.IsSnapToTickEnabled = true;
            StepSlider.TickFrequency       = 1;


            HorizontalAngleSlider.Value = HorizontalAngle;
            VerticalAngleSlider.Value   = VerticalAngle;
            DistanceSlider.Value        = CameraDistance;

            myPerspectiveCamera.FieldOfView = 60;

            ViewArea.Camera = myPerspectiveCamera;

            SetCameraLocation();
        }
        public ItemEntry(DeviceSelector container, int _number)
        {
            number     = _number;
            _Container = container;

            Client = _Container.parent.Client;
            MySqlConnection conn           = _Container.parent.Connection;
            MySqlCommand    selDistinctCmd = new MySqlCommand("SELECT DISTINCT category FROM devices ", conn);
            MySqlDataReader rdr            = selDistinctCmd.ExecuteReader();


            InitializeComponent();
            if (rdr != null)
            {
                while (rdr.Read())
                {
                    TypeComboBox.Items.Add(rdr.GetString(0));
                }
                rdr.Close();
            }
        }