11using System ;
22using System . Collections . Generic ;
33using System . Collections . ObjectModel ;
4- using System . Globalization ;
5- using System . IO ;
64using System . Linq ;
7- using System . Windows ;
85using System . Windows . Input ;
96using Microsoft . Vbe . Interop ;
10- using Rubberduck . Common ;
117using Rubberduck . Navigation . Folders ;
128using Rubberduck . Parsing . Annotations ;
139using Rubberduck . Parsing . Symbols ;
@@ -26,17 +22,13 @@ public sealed class CodeExplorerViewModel : ViewModelBase, IDisposable
2622 {
2723 private readonly FolderHelper _folderHelper ;
2824 private readonly RubberduckParserState _state ;
29- private readonly IClipboardWriter _clipboard ;
3025
3126 public CodeExplorerViewModel ( FolderHelper folderHelper , RubberduckParserState state , List < ICommand > commands )
3227 {
3328 _folderHelper = folderHelper ;
3429 _state = state ;
3530 _state . StateChanged += ParserState_StateChanged ;
36- _state . ModuleStateChanged += ParserState_ModuleStateChanged ;
37-
38- _clipboard = new ClipboardWriter ( ) ;
39-
31+
4032 _refreshCommand = new DelegateCommand ( param => _state . OnParseRequested ( this ) ,
4133 param => ! IsBusy && _state . IsDirty ( ) ) ;
4234
@@ -68,37 +60,7 @@ public CodeExplorerViewModel(FolderHelper folderHelper, RubberduckParserState st
6860 _commitCommand = commands . OfType < CodeExplorer_CommitCommand > ( ) . FirstOrDefault ( ) ;
6961 _undoCommand = commands . OfType < CodeExplorer_UndoCommand > ( ) . FirstOrDefault ( ) ;
7062
71- //_copyResultsCommand = commands.OfType<CodeExplorer_CopyResultsCommand>().FirstOrDefault();
72-
73- _copyResultsCommand = new DelegateCommand ( param =>
74- {
75- const string XML_SPREADSHEET_DATA_FORMAT = "XML Spreadsheet" ;
76-
77- ColumnInfo [ ] ColumnInfos = { new ColumnInfo ( "Project" ) , new ColumnInfo ( "Folder" ) , new ColumnInfo ( "Component" ) , new ColumnInfo ( "Declaration Type" ) , new ColumnInfo ( "Scope" ) ,
78- new ColumnInfo ( "Name" ) , new ColumnInfo ( "Return Type" ) } ;
79-
80- // this.ProjectName, this.CustomFolder, this.ComponentName, this.DeclarationType.ToString(), this.Scope
81- var aDeclarations = _state . AllUserDeclarations . Select ( declaration => declaration . ToArray ( ) ) . ToArray ( ) ;
82-
83- var resource = "Rubberduck User Declarations - {0}" ;
84- var title = string . Format ( resource , DateTime . Now . ToString ( CultureInfo . InvariantCulture ) ) ;
85-
86- //var textResults = title + Environment.NewLine + string.Join("", _results.Select(result => result.ToString() + Environment.NewLine).ToArray());
87- var csvResults = ExportFormatter . Csv ( aDeclarations , title , ColumnInfos ) ;
88- var htmlResults = ExportFormatter . HtmlClipboardFragment ( aDeclarations , title , ColumnInfos ) ;
89- var rtfResults = ExportFormatter . RTF ( aDeclarations , title ) ;
90-
91- MemoryStream strm1 = ExportFormatter . XmlSpreadsheetNew ( aDeclarations , title , ColumnInfos ) ;
92- //Add the formats from richest formatting to least formatting
93- _clipboard . AppendStream ( DataFormats . GetDataFormat ( XML_SPREADSHEET_DATA_FORMAT ) . Name , strm1 ) ;
94- _clipboard . AppendString ( DataFormats . Rtf , rtfResults ) ;
95- _clipboard . AppendString ( DataFormats . Html , htmlResults ) ;
96- _clipboard . AppendString ( DataFormats . CommaSeparatedValue , csvResults ) ;
97- //_clipboard.AppendString(DataFormats.UnicodeText, textResults);
98-
99- _clipboard . Flush ( ) ;
100-
101- } ) ;
63+ _copyResultsCommand = commands . OfType < CodeExplorer_CopyResultsCommand > ( ) . FirstOrDefault ( ) ;
10264
10365 _setNameSortCommand = new DelegateCommand ( param =>
10466 {
0 commit comments