public void OnGUI()
{
using (GUILayoutEx.Horizontal(EditorStyles.toolbar))
{
GUILayout.FlexibleSpace();
this.showPrerelease = GUILayout.Toggle(this.showPrerelease, "Show Prerelease");
this.showAllVersions = GUILayout.Toggle(this.showAllVersions, "Show All Versions");
using (GUILayoutEx.ChangeCheck(Save))
{
this.searchTerms = GUILayoutEx.SearchField(
this.searchTerms,
GUILayout.MinWidth(100),
GUILayout.MaxWidth(250));
}
if (GUILayout.Button("Search", EditorStyles.toolbarButton)
|| KeyEvent.JustReleased(KeyCode.Return))
{
this.listCommand.ShowAllVersions = this.showAllVersions;
this.listCommand.ShowPrerelease = this.showPrerelease;
this.isSearching = true;
this.wasCancelled = false;
this.EnqueueBackgroundAction(() =>
{
this.searchResult = this.listCommand.Execute(this.searchTerms);
this.isSearching = false;
});
}
}
if (this.isSearching)
{
this.wasCancelled = EditorUtility.DisplayCancelableProgressBar(
"Searching", "Searching for '" + searchTerms + "'", .995f);
if (wasCancelled)
{
this.isSearching = false;
EditorUtility.ClearProgressBar();
}
}
else if (!wasCancelled)
{
RenderResultList();
EditorUtility.ClearProgressBar();
}
}