Skip to content

Commit

Permalink
Fix: Search issue after doubleclicking the search textbox
Browse files Browse the repository at this point in the history
  • Loading branch information
rzander committed Aug 21, 2019
1 parent 01300e5 commit e08e872
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion RuckZuck_Tool/InstallSwPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</Grid.RowDefinitions>
<DockPanel Grid.Row="0" Margin="5,0,0,0">
<StackPanel Orientation="Horizontal" >
<TextBox x:Name="tbSearch" DockPanel.Dock="Right" Height="24" Width="150" Text="Search..." Foreground="#FFAEACAC" Tag="Search" GotFocus="tbSearch_GotFocus" LostFocus="tbSearch_LostFocus" KeyDown="tbSearch_KeyDown" MouseDoubleClick="tbSearch_MouseDoubleClick"/>
<TextBox x:Name="tbSearch" DockPanel.Dock="Right" Height="24" Width="150" Text="Search..." Foreground="#FFAEACAC" Tag="Search" GotFocus="tbSearch_GotFocus" LostFocus="tbSearch_LostFocus" KeyDown="tbSearch_KeyDown"/>
<Image Width="24" Height="24" Source="Images/Search_24.png" Margin="1,0,0,0" />
</StackPanel>
<StackPanel x:Name="spSupport" Orientation="Horizontal" HorizontalAlignment="Right" Background="{x:Null}">
Expand Down
10 changes: 2 additions & 8 deletions RuckZuck_Tool/InstallSwPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public InstallSwPanel()

private void TSearch_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{

AnonymousDelegate update = delegate ()
{
if (tbSearch.IsFocused)
Expand Down Expand Up @@ -113,6 +114,7 @@ private void tbSearch_LostFocus(object sender, RoutedEventArgs e)

private void tbSearch_Search(object sender, RoutedEventArgs e)
{

Mouse.OverrideCursor = Cursors.Wait;
if (string.IsNullOrEmpty(tbSearch.Text))
{
Expand Down Expand Up @@ -494,14 +496,6 @@ private void miOpenFolders_Click(object sender, RoutedEventArgs e)
}
}

private void tbSearch_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
tSearch.Stop();
lAllSoftware = RZRestAPIv2.GetCatalog().Distinct().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName).Select(x => new GetSoftware() { isInstalled = false }).ToList();
//Mark all installed...
lAllSoftware.ToList().ForEach(x => { if (lSoftware.FirstOrDefault(t => (t.ProductName == x.ProductName && t.ProductVersion == x.ProductVersion)) != null) { x.isInstalled = true; } });
}

private void miInstall_Click(object sender, RoutedEventArgs e)
{
tSearch.Stop();
Expand Down
2 changes: 1 addition & 1 deletion RuckZuck_Tool/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.0.*")]
[assembly: AssemblyFileVersion("1.7.0.4")]
[assembly: AssemblyFileVersion("1.7.0.5")]
30 changes: 15 additions & 15 deletions RuckZuck_Tool/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("2193048a-dcd5-433e-a2c0-28384b9ebad2")]
[assembly: AssemblyVersion("1.7.0.0")]
[assembly: AssemblyFileVersion("1.7.0.0")]</value>
[assembly: AssemblyVersion("1.7.0.5")]
[assembly: AssemblyFileVersion("1.7.0.5")]</value>
</data>
<data name="RZRestApi" xml:space="preserve">
<value>using Microsoft.Win32;
Expand Down Expand Up @@ -245,24 +245,24 @@ namespace RuckZuck.Base
{
Task&lt;string&gt; tReq;

if (string.IsNullOrEmpty(CustomerID))
{
using (HttpClient qClient = new HttpClient())
{
CustomerID = hClient.GetStringAsync("https://ruckzuck.tools/rest/v2/getip").Result;
customerid = CustomerID.ToString();
}
}


if (string.IsNullOrEmpty(customerid))
{
tReq = hClient.GetStringAsync("https://ruckzuck.tools/rest/v2/geturl");
}
else
tReq = hClient.GetStringAsync("https://ruckzuck.tools/rest/v2/geturl?customerid=" + customerid);

if(string.IsNullOrEmpty(CustomerID))
{
Task.Run(() =&gt;
{
using (HttpClient qClient = new HttpClient())
{
CustomerID = hClient.GetStringAsync("https://ruckzuck.tools/rest/v2/getip").Result;
CustomerID.ToString();
}
}).ConfigureAwait(false);
}


tReq.Wait(5000); //wait max 5s

Expand Down Expand Up @@ -350,7 +350,7 @@ namespace RuckZuck.Base
{
Task&lt;string&gt; response;

if (string.IsNullOrEmpty(customerid))
if (string.IsNullOrEmpty(customerid) || customerid.Contains('.'))
response = oClient.GetStringAsync(sURL + "/rest/v2/GetSoftwares?name=" + WebUtility.UrlEncode(productName) + "&amp;ver=" + WebUtility.UrlEncode(productVersion) + "&amp;man=" + WebUtility.UrlEncode(manufacturer));
else
response = oClient.GetStringAsync(sURL + "/rest/v2/GetSoftwares?name=" + WebUtility.UrlEncode(productName) + "&amp;ver=" + WebUtility.UrlEncode(productVersion) + "&amp;man=" + WebUtility.UrlEncode(manufacturer) + "&amp;customerid=" + WebUtility.UrlEncode(customerid));
Expand Down Expand Up @@ -2201,7 +2201,7 @@ namespace RZUpdate
PowerShellInstance.Streams.Error.DataAdding += ConsoleError;

IAsyncResult async = PowerShellInstance.BeginInvoke&lt;PSObject, PSObject&gt;(null, outputCollection);
while (async.IsCompleted == false || dDuration &gt; timeout)
while (async.IsCompleted == false &amp;&amp; dDuration &lt;= timeout)
{
Thread.Sleep(200);
dDuration = DateTime.Now - dStart;
Expand Down

0 comments on commit e08e872

Please sign in to comment.