fix formatting

This commit is contained in:
Jeremy Wu 2021-01-17 19:05:28 +11:00
parent d741a98112
commit 969265c24f
5 changed files with 19 additions and 10 deletions

View file

@ -202,12 +202,14 @@ namespace Flow.Launcher.Plugin.Program
return;
if (_uwps.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
_uwps.Where(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier).FirstOrDefault().Enabled =
false;
_uwps.Where(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier)
.FirstOrDefault()
.Enabled = false;
if (_win32s.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
_win32s.Where(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier).FirstOrDefault().Enabled =
false;
_win32s.Where(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier)
.FirstOrDefault()
.Enabled = false;
_settings.DisabledProgramSources
.Add(
@ -241,4 +243,4 @@ namespace Flow.Launcher.Plugin.Program
await IndexPrograms();
}
}
}
}

View file

@ -170,8 +170,7 @@ namespace Flow.Launcher.Plugin.Sys
// http://www.pinvoke.net/default.aspx/shell32/SHEmptyRecycleBin.html
// FYI, couldn't find documentation for this but if the recycle bin is already empty, it will return -2147418113 (0x8000FFFF (E_UNEXPECTED))
// 0 for nothing
var result = SHEmptyRecycleBin(new WindowInteropHelper(Application.Current.MainWindow).Handle,
0);
var result = SHEmptyRecycleBin(new WindowInteropHelper(Application.Current.MainWindow).Handle, 0);
if (result != (uint) HRESULT.S_OK && result != (uint) 0x8000FFFF)
{
MessageBox.Show($"Error emptying recycle bin, error code: {result}\n" +

View file

@ -22,8 +22,12 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
try
{
const string api = "https://api.bing.com/qsonhs.aspx?q=";
using var resultStream = await Http.GetStreamAsync(api + Uri.EscapeUriString(query), token).ConfigureAwait(false);
if (resultStream.Length == 0) return new List<string>(); // this handles the cancellation
if (resultStream.Length == 0)
return new List<string>(); // this handles the cancellation
json = (await JsonDocument.ParseAsync(resultStream, cancellationToken: token)).RootElement.GetProperty("AS");
}

View file

@ -21,8 +21,12 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
try
{
const string api = "https://www.google.com/complete/search?output=chrome&q=";
using var resultStream = await Http.GetStreamAsync(api + Uri.EscapeUriString(query)).ConfigureAwait(false);
if (resultStream.Length == 0) return new List<string>();
if (resultStream.Length == 0)
return new List<string>();
json = await JsonDocument.ParseAsync(resultStream);
}

View file

@ -8,4 +8,4 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
{
public abstract Task<List<string>> Suggestions(string query, CancellationToken token);
}
}
}