Пример #1
0
        private void OpenProject(object sender, RoutedEventArgs e)
        {
            // Create OpenFileDialog
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            // Set filter for file extension and default file extension
            dlg.DefaultExt = ".gproj";
            dlg.Filter     = "GE Project Files (*.gproj)|*.gproj";

            // Display OpenFileDialog by calling ShowDialog method
            Nullable <bool> result = dlg.ShowDialog();

            // Get the selected file name and display in a TextBox
            if (result == true)
            {
                // Open document
                string filename = dlg.FileName;

                mProjectName = System.IO.Path.GetFileNameWithoutExtension(filename);

                fileBrowser.SetWorkDirectory(System.IO.Path.GetDirectoryName(filename) + @"\");
                fileBrowser.LoadBrowser();

                IGCore.SetWorkDirectory(System.IO.Path.GetDirectoryName(filename) + @"\");
                IGCore.SetProjectName(System.IO.Path.GetFileNameWithoutExtension(filename));
                IntPtr hwnd = viewport.Handle;
                double h    = viewport.Height;
                double w    = viewport.Width;
                IGCore.InitD3D(hwnd, w, h);

                IGCore.SetSelectSceneObjectCallback(SelectSceneObject);
                IGCore.SetRefreshSceneObjectTransformCallback(RefreshTransform);
                outliner.GetSceneObjects();

                IGCore.Run();
            }
        }