Exemple #1
0
        private void RaiseEditShaderGroup()
        {
            if (_selectedShaderGroup != null)
            {
                _selectedShaderGroup.IsOpen = true;
                Workspace.Shaders.FirstOrDefault((s) => s.Path == _selectedShaderGroup.GetProjectPath()).IsOpen = true;

                Workspace.Save();

                _eventAggregator.GetEvent <RefreshExplorer>().Publish(null);
            }
        }
 private void RaiseCloseShaderGroup(ShaderGroup group)
 {
     SetValue(group, false, () =>
     {
         group.Save(Workspace);
         Workspace.Shaders.FirstOrDefault((s) => s.Path == group.GetProjectPath()).IsOpen = group.IsOpen;
         ShaderGroupsView.Refresh();
     }, "IsOpen");
 }
        public static void Save(this ShaderGroup shadergroup, Workspace workspace)
        {
            shadergroup.CreateUniqueName();

            string path = shadergroup.GetProjectPath();

            if (workspace.Shaders.FirstOrDefault((s) => s.Path == path) == null)
            {
                workspace.Shaders.Add(new ShaderPath()
                {
                    Path   = path,
                    IsOpen = true
                });
            }
            path.EnsureFolder();

            XmlSerializer serializer = new XmlSerializer(typeof(ShaderGroup));

            using (Stream stream = File.Create(path))
            {
                serializer.Serialize(stream, shadergroup);
            }
        }