コード例 #1
0
        /// <summary>
        /// Removes one Material with the specified name from the Print parameters.
        /// </summary>
        /// <param name="materialName"></param>
        public bool RemoveMaterial(string materialName)
        {
            if (_materialViewModelList.Count > 1) //The Print Parameters must have at least 1 Material.
            {
                for (int index = 0; index < _materialViewModelList.Count; index++)
                {
                    if (materialName == _materialViewModelList[index].Name &&
                        _printModel.RemoveMaterial(materialName))
                    {
                        _materialViewModelList.RemoveAt(index);
                        OnPropertyChanged("MaterialViewModelList");
                        OnPropertyChanged("MaterialsCreatedCount");
                        OnPropertyChanged("CanRemoveMaterial");
                        return(true);
                    }
                }
            }

            return(false);
        }