public WpfLoaderViewModel() { IXamlSnippetProvider snippetsProvider = new SnippetProvider("Xaml\\Wpf"); Snippets = snippetsProvider.Snippets; LoadCommand = new RelayCommand(o => LoadXamlForWpf(), o => Xaml != string.Empty); RuntimeTypeSource = new WpfRuntimeTypeSource(); }
public DummyLoaderViewModel() { IXamlSnippetProvider snippetsProvider = new SnippetProvider("Xaml\\Dummy"); Snippets = snippetsProvider.Snippets; //Xaml = XamlResources.ChildCollection; SetSelectedItemCommand = new RelayCommand(o => SelectedItem = (InstanceNodeViewModel)o, o => o != null); LoadCommand = new RelayCommand(Execute.Safely(o => LoadXaml()), o => Xaml != string.Empty); RuntimeTypeSource = new TestRuntimeTypeSource(); }
public DummyLoaderViewModel() { IXamlSnippetProvider snippetsProvider = new SnippetProvider("Xaml\\Dummy"); Snippets = snippetsProvider.Snippets; //Xaml = XamlResources.ChildCollection; SetSelectedItemCommand = new RelayCommand(o => SelectedItem = (InstanceNodeViewModel)o, o => o != null); LoadCommand = new RelayCommand(Execute.Safely(o => LoadXaml()), o => Xaml != string.Empty); RuntimeTypeSource = new TestRuntimeTypeSource(); }
protected void ParseSources(XPathNavigator configuration, bool isConceptual) { _codeRefEnabled = false; // <codeSnippets> // <codeSnippet source="CodeSnippetFile.xml" format="Sandcastle" /> // </codeSnippets> XPathNavigator codeSnippets = configuration.SelectSingleNode("codeSnippets"); XPathNavigator codeSources = configuration.SelectSingleNode("codeSources"); if (codeSnippets == null && codeSources == null) { return; } Type compType = this.GetType(); MessageWriter msgWriter = this.BuildAssembler.MessageWriter; if (_codeRefStorage == SnippetStorage.Memory) { _codeRefProvider = new SnippetMemoryProvider(compType, msgWriter); } else if (_codeRefStorage == SnippetStorage.Database) { _codeRefProvider = new SnippetDatabaseProvider(compType, msgWriter); } if (_codeRefProvider == null) { _codeRefEnabled = false; return; } // Indicate a start the code snippet registration process _codeRefProvider.StartRegister(true); XPathNodeIterator codeSnippetIterator = (codeSnippets == null) ? null : codeSnippets.Select("codeSnippet"); if (codeSnippetIterator != null && codeSnippetIterator.Count != 0) { SnippetXmlReader snippetReader = new SnippetXmlReader( this.TabSize, compType, msgWriter); foreach (XPathNavigator codeSnippet in codeSnippetIterator) { string snippetSource = Environment.ExpandEnvironmentVariables( codeSnippet.GetAttribute("source", String.Empty)); if (String.IsNullOrEmpty(snippetSource)) { this.WriteMessage(MessageLevel.Error, "The examples element does not contain a source attribute."); } if (File.Exists(snippetSource)) { snippetReader.Read(snippetSource, _codeRefProvider); } } snippetReader.Dispose(); snippetReader = null; } XPathNodeIterator codeSourceIterator = (codeSources == null) ? null : codeSources.Select("codeSource"); if (codeSourceIterator != null && codeSourceIterator.Count != 0) { SnippetTextReader snippetReader = new SnippetTextReader( this.TabSize, compType, msgWriter); snippetReader.Initialize(codeSources); foreach (XPathNavigator codeSource in codeSourceIterator) { string snippetSource = Environment.ExpandEnvironmentVariables( codeSource.GetAttribute("source", String.Empty)); if (String.IsNullOrEmpty(snippetSource)) { this.WriteMessage(MessageLevel.Error, "The examples element does not contain a source attribute."); } if (Directory.Exists(snippetSource)) { snippetReader.Read(snippetSource, _codeRefProvider); } } snippetReader.Uninitialize(); snippetReader.Dispose(); snippetReader = null; } // Indicate a completion of the code snippet registration _codeRefProvider.FinishRegister(); base.WriteMessage(MessageLevel.Info, String.Format( "Loaded {0} code snippets", _codeRefProvider.Count)); // Do we really have snippets? _codeRefEnabled = (_codeRefProvider != null && _codeRefProvider.Count > 0); }