示例#1
0
        //Options
        private void Options_AddMaterials_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Material material = Material.NewMaterial();
                material.Str_00 = EmmFile.GetUnusedName(material.Str_00);

                EmmFile.Materials.Add(material);
                RefreshMaterialCount();
                dataGrid.SelectedItem = material;
                dataGrid.ScrollIntoView(material);
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("An error occured while adding the material.\n\nDetails: {0}", ex.Message), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
示例#2
0
        //Options
        private void Options_AddMaterials_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Material material = Material.NewMaterial();
                material.Str_00 = EmmFile.GetUnusedName(material.Str_00);

                EmmFile.Materials.Add(material);
                RefreshMaterialCount();
                dataGrid.SelectedItem = material;
                dataGrid.ScrollIntoView(material);

                List <IUndoRedo> undos = new List <IUndoRedo>();
                undos.Add(new UndoableListAdd <Material>(EmmFile.Materials, material));
                undos.Add(new UndoActionDelegate(this, nameof(RefreshMaterialCount), true));
                UndoManager.Instance.AddUndo(new CompositeUndo(undos, "New Material"));
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("An error occured while adding the material.\n\nDetails: {0}", ex.Message), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }