void newModel()
        {
            var vmXY = new ViewModelXY(1);
            var vmXZ = new ViewModelXY(2);
            var vmYZ = new ViewModelXY(3);

            var vm = new ModelViewModel(vmXY, vmXZ, vmYZ);

            ViewManager.ShowView(typeof(ModelMainMenu), vm);
            ViewManager.ShowView(typeof(ViewXY), vmXY);
            ViewManager.ShowView(typeof(ViewXY), vmXZ);
            ViewManager.ShowView(typeof(ViewXY), vmYZ);
        }
        void newMapElement()
        {
            var vm = new DataInputViewModel();

            vm.Text.Get = "Bitte geben Sie die größe an (1,1)";
            bool b = false;

            while (!b)
            {
                ViewManager.ShowDialogView(typeof(Input), vm);
                if (vm.IsOK)
                {
                    var split = vm.Output.Get.Split(',');
                    if (split.Length == 2)
                    {
                        if (int.TryParse(split[0], out int i1) && int.TryParse(split[1], out int i2))
                        {
                            var vmXY = new ViewModelXY(1);
                            var vmXZ = new ViewModelXY(2);
                            var vmYZ = new ViewModelXY(3);

                            var mVm = new ModelViewModel(vmXY, vmXZ, vmYZ, i1, i2);

                            ViewManager.ShowView(typeof(ModelMainMenu), mVm);
                            ViewManager.ShowView(typeof(ViewXY), vmXY);
                            ViewManager.ShowView(typeof(ViewXY), vmXZ);
                            ViewManager.ShowView(typeof(ViewXY), vmYZ);
                            b = true;
                        }
                        else
                        {
                            MessageBox.Show(ViewManager.RootView, "Die Eingebe konnte nicht zu INT geparst werden!");
                        }
                    }
                    else
                    {
                        MessageBox.Show(ViewManager.RootView, "Die Eingebe war fehlerhaft! Bitte geben Sie zwei Zahlen ein, getrennt mit einem Komma.");
                    }
                }
                else
                {
                    b = true;
                }
            }
        }
Esempio n. 3
0
        public ModelViewModel(ViewModelXY xy, ViewModelXY xz, ViewModelXY yz, int sizeX = 0, int sizeY = 0)
        {
            if (sizeX != 0 && sizeY != 0)
            {
                isMapElement = true;
                mapSizeX     = sizeX;
                mapSizeY     = sizeY;
            }

            Elements.Get = new List <Element>();

            exporter = new WavefrontExporter(Elements.Get);

            this.xy = xy;
            this.xz = xz;
            this.yz = yz;

            InsertCommand.ExecuteFunc       = x => insert();
            SelectCommand.ExecuteFunc       = x => select();
            SelectSingleCommand.ExecuteFunc = x => selectSingle();
            CopyCommand.ExecuteFunc         = x => copy();
            CubeCommand.ExecuteFunc         = x => cube();
            NewModelCommand.ExecuteFunc     = x => newModel();
            ListCommand.ExecuteFunc         = x => list();
            CloseCommand.ExecuteFunc        = x => close();
            SaveCommand.ExecuteFunc         = x => save();
            LoadCommand.ExecuteFunc         = x => load();
            ExportCommand.ExecuteFunc       = x => export();
            MoveCommand.ExecuteFunc         = x => move();
            ResizeCommand.ExecuteFunc       = x => resize();
            BoneCommand.ExecuteFunc         = x => bone();
            TextureCommand.ExecuteFunc      = x => texture();

            Image0.Get  = ImageHelper.ConvertImageToWpfImage(Resources.Resource.einfügen);
            Image1.Get  = ImageHelper.ConvertImageToWpfImage(Resources.Resource.auswahl2);
            Image2.Get  = ImageHelper.ConvertImageToWpfImage(Resources.Resource.auswahl4);
            Image3.Get  = ImageHelper.ConvertImageToWpfImage(Resources.Resource.kopie);
            Image4.Get  = ImageHelper.ConvertImageToWpfImage(Resources.Resource.würfel2);
            Image5.Get  = ImageHelper.ConvertImageToWpfImage(Resources.Resource.würfelplus);
            Image6.Get  = ImageHelper.ConvertImageToWpfImage(Resources.Resource.liste2);
            Image7.Get  = ImageHelper.ConvertImageToWpfImage(Resources.Resource.diskette);
            Image8.Get  = ImageHelper.ConvertImageToWpfImage(Resources.Resource.close);
            Image9.Get  = ImageHelper.ConvertImageToWpfImage(Resources.Resource.export);
            Image10.Get = ImageHelper.ConvertImageToWpfImage(Resources.Resource.schieben);
            Image11.Get = ImageHelper.ConvertImageToWpfImage(Resources.Resource.größe_ändern);
            Image12.Get = ImageHelper.ConvertImageToWpfImage(Resources.Resource.load);
            Image13.Get = ImageHelper.ConvertImageToWpfImage(Resources.Resource.texture);
            Image14.Get = ImageHelper.ConvertImageToWpfImage(Resources.Resource.bone);

            this.xy.DrawCubeAction = drawCube;
            this.xz.DrawCubeAction = drawCube;
            this.yz.DrawCubeAction = drawCube;

            this.xy.NewCubeAction = newCube;
            this.xz.NewCubeAction = newCube;
            this.yz.NewCubeAction = newCube;

            this.xy.MoveAction = move;
            this.xz.MoveAction = move;
            this.yz.MoveAction = move;

            this.xy.ResizeAction = resize;
            this.xz.ResizeAction = resize;
            this.yz.ResizeAction = resize;

            this.xy.AddAction = add;
            this.xz.AddAction = add;
            this.yz.AddAction = add;

            this.xy.SelectAction = select;
            this.xz.SelectAction = select;
            this.yz.SelectAction = select;

            this.xy.LoadedAction = loaded;
            this.xz.LoadedAction = loaded;
            this.yz.LoadedAction = loaded;

            this.xy.BoneAction = bone;
            this.xz.BoneAction = bone;
            this.yz.BoneAction = bone;

            var modelWindowViewModel = new ModelViewWindowViewModel();
            var window = ViewManager.ShowView(typeof(ModelViewWindow), modelWindowViewModel);

            engine = new ModelViewer(ViewManager.GetWindowHandle(window));
            modelWindowViewModel.Engine = engine;

            SetPropertyChangeForAll();
        }