@@ -42,7 +42,7 @@ public List<Result> Query(Query query)
42
42
new Result
43
43
{
44
44
Title = "OneNote is not installed." ,
45
- IcoPath = Constants . UnavailableIconPath
45
+ IcoPath = Icons . Unavailable
46
46
}
47
47
} ;
48
48
}
@@ -52,33 +52,33 @@ public List<Result> Query(Query query)
52
52
results . Add ( new Result
53
53
{
54
54
Title = "Search OneNote pages" ,
55
- SubTitle = $ "Type \" { Constants . StructureKeyword } \" to search by notebook structure or select this option",
56
- AutoCompleteText = $ "{ context . CurrentPluginMetadata . ActionKeyword } { Constants . StructureKeyword } ",
57
- IcoPath = Constants . LogoIconPath ,
55
+ SubTitle = $ "Type \" { Keywords . NotebookExplorer } \" to search by notebook structure or select this option",
56
+ AutoCompleteText = $ "{ query . ActionKeyword } { Keywords . NotebookExplorer } ",
57
+ IcoPath = Icons . Logo ,
58
58
Score = 2000 ,
59
59
Action = c =>
60
60
{
61
- context . API . ChangeQuery ( $ "{ context . CurrentPluginMetadata . ActionKeyword } { Constants . StructureKeyword } ") ;
61
+ context . API . ChangeQuery ( $ "{ query . ActionKeyword } { Keywords . NotebookExplorer } ") ;
62
62
return false ;
63
63
} ,
64
64
} ) ;
65
65
results . Add ( new Result
66
66
{
67
67
Title = "See recent pages" ,
68
- SubTitle = $ "Type \" { Constants . RecentKeyword } \" to see last modified pages or select this option",
69
- AutoCompleteText = $ "{ context . CurrentPluginMetadata . ActionKeyword } { Constants . RecentKeyword } ",
70
- IcoPath = Constants . RecentIconPath ,
68
+ SubTitle = $ "Type \" { Keywords . RecentPages } \" to see last modified pages or select this option",
69
+ AutoCompleteText = $ "{ query . ActionKeyword } { Keywords . RecentPages } ",
70
+ IcoPath = Icons . Recent ,
71
71
Score = - 1000 ,
72
72
Action = c =>
73
73
{
74
- context . API . ChangeQuery ( $ "{ context . CurrentPluginMetadata . ActionKeyword } { Constants . RecentKeyword } ") ;
74
+ context . API . ChangeQuery ( $ "{ query . ActionKeyword } { Keywords . RecentPages } ") ;
75
75
return false ;
76
76
} ,
77
77
} ) ;
78
78
results . Add ( new Result
79
79
{
80
80
Title = "Open and sync notebooks" ,
81
- IcoPath = Constants . SyncIconPath ,
81
+ IcoPath = Icons . Sync ,
82
82
Score = int . MinValue ,
83
83
Action = c =>
84
84
{
@@ -88,12 +88,14 @@ public List<Result> Query(Query query)
88
88
return false ;
89
89
}
90
90
} ) ;
91
+
92
+
91
93
return results ;
92
94
}
93
- if ( query . FirstSearch . StartsWith ( Constants . RecentKeyword ) )
95
+ if ( query . FirstSearch . StartsWith ( Keywords . RecentPages ) )
94
96
{
95
97
int count = recentPagesCount ;
96
- if ( query . FirstSearch . Length > Constants . RecentKeyword . Length && int . TryParse ( query . FirstSearch [ Constants . RecentKeyword . Length ..] , out int userChosenCount ) )
98
+ if ( query . FirstSearch . Length > Keywords . RecentPages . Length && int . TryParse ( query . FirstSearch [ Keywords . RecentPages . Length ..] , out int userChosenCount ) )
97
99
count = userChosenCount ;
98
100
99
101
return OneNoteProvider . PageItems . OrderByDescending ( pg => pg . LastModified )
@@ -102,15 +104,15 @@ public List<Result> Query(Query query)
102
104
{
103
105
Result result = rc . CreatePageResult ( pg ) ;
104
106
result . SubTitle = $ "{ GetLastEdited ( DateTime . Now - pg . LastModified ) } \t { result . SubTitle } ";
105
- result . IcoPath = Constants . RecentPageIconPath ;
107
+ result . IcoPath = Icons . RecentPage ;
106
108
return result ;
107
109
} )
108
110
. ToList ( ) ;
109
111
}
110
112
111
113
//Search via notebook structure
112
114
//NOTE: There is no nested sections i.e. there is nothing for the Section Group in the structure
113
- if ( query . FirstSearch . StartsWith ( Constants . StructureKeyword ) )
115
+ if ( query . FirstSearch . StartsWith ( Keywords . NotebookExplorer ) )
114
116
return notebookExplorer . Explore ( query ) ;
115
117
116
118
//Check for invalid start of query i.e. symbols
@@ -121,7 +123,7 @@ public List<Result> Query(Query query)
121
123
{
122
124
Title = "Invalid query" ,
123
125
SubTitle = "The first character of the search must be a letter or a digit" ,
124
- IcoPath = Constants . WarningLogoPath ,
126
+ IcoPath = Icons . Warning ,
125
127
}
126
128
} ;
127
129
//Default search
@@ -137,7 +139,7 @@ public List<Result> Query(Query query)
137
139
{
138
140
Title = "No matches found" ,
139
141
SubTitle = "Try searching something else, or syncing your notebooks." ,
140
- IcoPath = Constants . LogoIconPath ,
142
+ IcoPath = Icons . Logo ,
141
143
}
142
144
} ;
143
145
}
0 commit comments