Ejemplo n.º 1
0
        private void ShaderList_Drop(object sender, DragEventArgs e)
        {
            var item = ItemsControl.ContainerFromElement(ShaderList, e.OriginalSource as DependencyObject) as ListBoxItem;

            if (item != null && e.Data.GetDataPresent(typeof(TechniqueMappingViewModel)))
            {
                TechniqueMappingViewModel  tMapping = (TechniqueMappingViewModel)e.Data.GetData(typeof(TechniqueMappingViewModel));
                ShaderDescriptionViewModel sVM      = ((ShaderDescriptionViewModel)item.Content);

                var vmLocator = ((ViewModelLocator)System.Windows.Application.Current.FindResource("Locator"));
                foreach (var shader in vmLocator.Compilation.Shaders.OfType <ShaderDescriptionViewModel>())
                {
                    if (shader.Name != sVM.Name && shader.Type == sVM.Type && shader.Techniques.Contains(tMapping))
                    {
                        shader.RemoveTechnique(tMapping);
                    }
                }
                sVM.AssignTechnique(tMapping);
            }
        }
Ejemplo n.º 2
0
 public TechniqueMessage(TechniqueAction action, TechniqueMappingViewModel vmTechnique)
 {
     Action    = action;
     Technique = vmTechnique;
 }