Skip to content

Commit 7537bc9

Browse files
committed
Clean up
1 parent c939a63 commit 7537bc9

File tree

2 files changed

+44
-48
lines changed

2 files changed

+44
-48
lines changed

Main.cs

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -48,59 +48,57 @@ public List<Result> Query(Query query)
4848
}
4949
if (string.IsNullOrEmpty(query.Search))
5050
{
51-
var results = new List<Result>();
52-
results.Add(new Result
51+
return new List<Result>()
5352
{
54-
Title = "Search OneNote pages",
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-
Score = 2000,
59-
Action = c =>
53+
new Result
6054
{
61-
context.API.ChangeQuery($"{query.ActionKeyword} {Keywords.NotebookExplorer}");
62-
return false;
55+
Title = "Search OneNote pages",
56+
SubTitle = $"Type \"{Keywords.NotebookExplorer}\" to search by notebook structure or select this option",
57+
AutoCompleteText = $"{query.ActionKeyword} {Keywords.NotebookExplorer}",
58+
IcoPath = Icons.Logo,
59+
Score = 2000,
60+
Action = c =>
61+
{
62+
context.API.ChangeQuery($"{query.ActionKeyword} {Keywords.NotebookExplorer}");
63+
return false;
64+
},
6365
},
64-
});
65-
results.Add(new Result
66-
{
67-
Title = "See recent pages",
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-
Score = -1000,
72-
Action = c =>
66+
new Result
7367
{
74-
context.API.ChangeQuery($"{query.ActionKeyword} {Keywords.RecentPages}");
75-
return false;
68+
Title = "See recent pages",
69+
SubTitle = $"Type \"{Keywords.RecentPages}\" to see last modified pages or select this option",
70+
AutoCompleteText = $"{query.ActionKeyword} {Keywords.RecentPages}",
71+
IcoPath = Icons.Recent,
72+
Score = -1000,
73+
Action = c =>
74+
{
75+
context.API.ChangeQuery($"{query.ActionKeyword} {Keywords.RecentPages}");
76+
return false;
77+
},
7678
},
77-
});
78-
results.Add(new Result
79-
{
80-
Title = "New quick note",
81-
Score = -4000,
82-
IcoPath = Icons.NewPage,
83-
Action = c =>
79+
new Result
8480
{
85-
ScipBeExtensions.CreateAndOpenPage();
86-
return true;
87-
}
88-
});
89-
90-
results.Add(new Result
91-
{
92-
Title = "Open and sync notebooks",
93-
IcoPath = Icons.Sync,
94-
Score = int.MinValue,
95-
Action = c =>
81+
Title = "New quick note",
82+
IcoPath = Icons.NewPage,
83+
Score = -4000,
84+
Action = c =>
85+
{
86+
ScipBeExtensions.CreateAndOpenPage();
87+
return true;
88+
}
89+
},
90+
new Result
9691
{
97-
OneNoteProvider.NotebookItems.OpenAndSync(OneNoteProvider.PageItems.First());
98-
return false;
99-
}
100-
});
101-
102-
103-
return results;
92+
Title = "Open and sync notebooks",
93+
IcoPath = Icons.Sync,
94+
Score = int.MinValue,
95+
Action = c =>
96+
{
97+
OneNoteProvider.NotebookItems.OpenAndSync(OneNoteProvider.PageItems.First());
98+
return false;
99+
}
100+
},
101+
};
104102
}
105103
if (query.FirstSearch.StartsWith(Keywords.RecentPages))
106104
{

NotebookExplorer.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ public NotebookExplorer(PluginInitContext context, OneNotePlugin oneNotePlugin,
2626
public List<Result> Explore(Query query)
2727
{
2828
string[] searchStrings = query.Search.Split('\\', StringSplitOptions.None);
29-
string searchString;
30-
List<int> highlightData = null;
3129
//Could replace switch case with for loop
3230
switch (searchStrings.Length)
3331
{

0 commit comments

Comments
 (0)