コード例 #1
0
ファイル: ModelWindow.cs プロジェクト: icynare/ModelEditor
    public static void TryCreateModel()
    {
        ModelWindow window = (ModelWindow)EditorWindow.GetWindow(typeof(ModelWindow), true, "模型建造选项", true);

        window.Show();
        window.Init();
    }
コード例 #2
0
        protected override ModelWindow CreateChildWindow(object parentViewModel, FrameworkElement contentView)
        {
            var win = new ModelWindow {
                Content = WrapContentView(contentView)
            };

            win.SetResourceReference(ModelWindow.IconProperty, ResourceKeys.DialogIcon);
            return(win);
        }
コード例 #3
0
        private void BtnNew_Click(object sender, RoutedEventArgs e)
        {
            // AddCdWindow addCdWindow = new AddCdWindow();
            // addCdWindow.ShowDialog();

            ModelWindow addCdWindow = new ModelWindow(
                typeof(Cd),
                () => new Cd(),
                (cd) => _cds.Add((Cd)cd)
                );

            addCdWindow.DisplayText = "Add/Create a new CD";
            addCdWindow.ShowDialog();
            LoadCds();
        }
コード例 #4
0
        protected virtual void AddModelWindowToCache(object parentViewModel, ModelWindow window)
        {
            FrameworkElement parentView;

            if (parentViewModel is IShellViewModel)
            {
                parentView = Application.Current.MainWindow;
            }
            else
            {
                parentView = GetLatestOpeningWindow()
                             .FindChild <UserControl>()
                             .FirstOrDefault(c => c.DataContext == parentViewModel);
            }

            if (parentView == null)
            {
                throw new InstanceNotFoundException($"The view of {parentViewModel.GetType().FullName}");
            }

            //Find IAddChild control and add itself in.
            var p = parentView.FindParent <Grid>();

            if (p == null)
            {
                throw new InstanceNotFoundException("IAddChild control");
            }

            Grid.SetRow(window, 0);
            Grid.SetColumn(window, 0);

            if (p.RowDefinitions.Count > 0)
            {
                Grid.SetRowSpan(window, p.RowDefinitions.Count);
            }
            if (p.ColumnDefinitions.Count > 0)
            {
                Grid.SetColumnSpan(window, p.ColumnDefinitions.Count);
            }

            ((IAddChild)p).AddChild(window);

            OpenedChildWindowCache.TryAdd(parentViewModel, window);
        }
コード例 #5
0
        /// <summary>
        /// Executes when capture button was hit.
        /// </summary>
        public void CaptureExecuted()
        {
            DepthImagePixel[] data = KinectService.GetDepthData();
            if (_builder == null)
            {
                _builder = new ModelBuilder(ModelBuilder.GetModelSize(data, 640), CubeDivide, ModelDepth);
            }

            _builder.CheckVerticesInCube((int)CurrentRotation, data, KinectService.Kinect.DepthStream.NominalFocalLengthInPixels);
            CurrentRotation = CurrentRotation + RotationAngle;

            if (CurrentRotation == FullRotationAngle)
            {
                CurrentRotation = 0;
                var modelWindow = new ModelWindow();
                modelWindow.DataContext = new ModelWindowViewModel(_builder.CreateModel());
                modelWindow.Show();
            }
        }
コード例 #6
0
ファイル: ViewModelBase.cs プロジェクト: m-sadegh-sh/Phoenix
 private void Exit()
 {
     ModelWindow.Close();
 }