Exemple #1
0
        public void CreateTechnique()
        {
            CreateTechniqueView view = new CreateTechniqueView();

            view.ShowDialog();
            if (!view.DialogResult.HasValue || !view.DialogResult.Value)
            {
                return;
            }

            var    vmCT          = (CreateTechniqueViewModel)view.DataContext;
            string techniqueName = string.IsNullOrEmpty(vmCT.Name)
                ? string.Format("{0}{1}", NewTechnique, techniques.Count(t => t.Name.StartsWith(NewTechnique)) + 1)
                : vmCT.Name;
            TechniqueMappingViewModel vmTM = new TechniqueMappingViewModel
            {
                TechniqueMapping = new TechniqueMapping(techniqueName)
                {
                    Key = vmCT.Key
                },
                Name  = techniqueName,
                Index = techniques.Count + 1,
            };

            RegisterTechnique(vmTM);
        }
 public void RemoveTechnique(TechniqueMappingViewModel tMapping)
 {
     Contract.Requires <ArgumentException>(IsAssignedTo(tMapping));
     techniques.Remove(tMapping);
     if (techniques.Count == 0)
     {
         AddUnassignedTechnique();
     }
 }
        public void AssignTechnique(TechniqueMappingViewModel tMapping)
        {
            if (IsEmpty)
            {
                techniques.Clear();
            }
            techniques.Add(tMapping);
            var          vmLocator = ((ViewModelLocator)System.Windows.Application.Current.FindResource("Locator"));
            RelayCommand cmd       = (RelayCommand)vmLocator.Main.CompileShaderGraphCommand;

            cmd.RaiseCanExecuteChanged();
        }
 public bool IsAssignedTo(TechniqueMappingViewModel tMapping)
 {
     return(techniques.Contains(tMapping));
 }
Exemple #5
0
 private void RegisterTechnique(TechniqueMappingViewModel techniqueVM)
 {
     techniques.Add(techniqueVM);
     shaderCollection.Add(techniqueVM.TechniqueMapping);
 }