public ShaderEditorPageViewModel(ShaderStorageLinker shaderStorage, Workspace workspace, EventAggregator eventAggregator)
        {
            int index = workspace.SelectedIndex;

            _shaderStorage = shaderStorage;
            Workspace      = workspace;

            ShadersFlattened.AddRange(_shaderStorage.ShaderGroups.SelectMany((s) => s.Shaders));
            ShaderGroupsView        = CollectionViewSource.GetDefaultView(ShadersFlattened);
            ShaderGroupsView.Filter = (s) => ((Shader)s).Group.IsOpen;
            ShaderGroupsView.GroupDescriptions.Add(new PropertyGroupDescription("Group"));
            RaiseLoadedCommand = new DelegateCommand(RaiseLoaded);

            SelectErrorCommand         = new DelegateCommand <SelectionChangedEventArgs>(SelectError);
            RaiseCompileShaderCommand  = new DelegateCommand(RaiseCompileShader, CanExecuteCompileShader);
            RaiseNewShaderGroupCommand = new DelegateCommand(RaiseNewShaderGroup);

            RaiseShaderNameChangedCommand = new DelegateCommand <ShaderNameChangedEventArgs>(RaiseShaderNameChanged);

            InitializeExplorerButtons();
            InitializeSaveButtonCommands();

            RaiseBuildShaderGroupCommand = new DelegateCommand(RaiseBuildShaderGroup, CanExecuteCompileShader);

            _includeHeaderCallback = new CallbackDelegate(SaveIncludeHeaderCallback);

            Workspace.SelectedIndex = index;

            eventAggregator.GetEvent <RefreshExplorer>().Subscribe(RefreshExplorerEvent);
        }
        private void RaiseNewShaderGroup()
        {
            ShaderGroupNotification notification = new ShaderGroupNotification();

            notification.Title   = "New Shader";
            notification.Content = null;
            ShaderGroupRequest.Raise(notification, (returned) =>
            {
                if (returned.Confirmed)
                {
                    notification.ShaderGroup.IsOpen = true;
                    _shaderStorage.ShaderGroups.Add(notification.ShaderGroup);
                    ShadersFlattened.AddRange(notification.ShaderGroup.Shaders);

                    notification.ShaderGroup.Save(Workspace);
                    Workspace.Save();
                }
            });
        }