private void OpenFile(object sender, RoutedEventArgs e) { if (currScene.modified) { MessageBoxResult ifSave = System.Windows.MessageBox.Show("Czy chesz zapisać bieżącą scenę ?", "", MessageBoxButton.YesNo, MessageBoxImage.Question); if (ifSave == MessageBoxResult.Yes) { SaveFileAs(sender, e); } } Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.Filter = "Pliki sceny |*.scn|Wszystkie pliki |*.*"; //dlg.InitialDirectory = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName); Nullable<bool> result = dlg.ShowDialog(); if (result == true) { undo = null; undo = new UndoStack(); Scene fileScene = Scene.ReadSceneFromFile(dlg.FileName); if (fileScene != null) { currScene = fileScene; Renderer.RecalculateData(currScene); cameraPan.newSceneLoaded(); cameraPan.comboBox1.SelectedIndex = currScene.activeCamera; RenderViews(); } else { System.Windows.MessageBox.Show("Wybrany plik ma niepoprawny format.", "Błąd", MessageBoxButton.OK, MessageBoxImage.Warning); } trNumTBG1.Text = currScene.triangles.Count().ToString(); trNumTBG2.Text = currScene.triangles.Count().ToString(); trNumTBG3.Text = currScene.triangles.Count().ToString(); trNumTBG4.Text = currScene.triangles.Count().ToString(); } currScene.selectedHierObj = null; }
private void NowyB_Click(object sender, RoutedEventArgs e) { if(currScene.modified == true) { MessageBoxResult ifSave = System.Windows.MessageBox.Show("Czy chesz zapisać bieżącą scenę ?", "", MessageBoxButton.YesNo, MessageBoxImage.Question); if(ifSave == MessageBoxResult.Yes) { SaveFileAs(sender, e); } } //SurfaceRenderer.Render(new Material_("mat1", 0.6f, 0.95f, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 100, 1, 1, 1)); currScene = null; undo = null; undo = new UndoStack(); currScene = new Scene(); trNumTBG1.Text = currScene.triangles.Count().ToString(); trNumTBG2.Text = currScene.triangles.Count().ToString(); trNumTBG3.Text = currScene.triangles.Count().ToString(); trNumTBG4.Text = currScene.triangles.Count().ToString(); Renderer.RecalculateData(currScene); cameraPan.newSceneLoaded(); cameraPan.comboBox1.SelectedIndex = currScene.activeCamera; currScene.selectedHierObj = null; //sceneChange = false; RenderViews(); }