Skip to content

Commit

Permalink
- fixed error message popup at startup
Browse files Browse the repository at this point in the history
- fixed keeping rows at position when only updating single rows
  • Loading branch information
PredatH0r committed Jan 12, 2016
1 parent 83bf91c commit 17cb6d5
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 17 deletions.
8 changes: 5 additions & 3 deletions ServerBrowser/Games/QuakeLive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,16 @@ private void LoadQlstatsPersonalRating()
{
var rating = ratings[i];
if (rating == null) continue;
text += $"\n{gametypes[i].ToUpper()}: {rating.r}­ ± {rating.rd} ({rating.games} games)";
text += $"\n{gametypes[i].ToUpper()}: {rating.r} ± {rating.rd} ({rating.games} games)";
}
if (gametypes.Length == 0)
text = "";
}

this.colSkill.ToolTip = SkillTooltip + text;
this.colSkill.View.GridControl.BeginInvoke((Action) (() =>
{
this.colSkill.ToolTip = SkillTooltip + text;
}));
}
}
catch
Expand Down Expand Up @@ -260,7 +263,6 @@ private void LoadQlstatsServerRatings()
if (info != null)
row.PlayerCount.Update();
}
view.RefreshData();
}));
}
}
Expand Down
2 changes: 1 addition & 1 deletion ServerBrowser/GeoIpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void ProcessLoop()
object o;
Action<GeoInfo> callbacks;
lock (cache)
callbacks = cache.TryGetValue(ipInt, out o) ? (Action<GeoInfo>)o : null;
callbacks = cache.TryGetValue(ipInt, out o) ? o as Action<GeoInfo> : null;
var geoInfo = this.HandleResult(ipInt, result);
if (callbacks != null)
ThreadPool.QueueUserWorkItem(ctx => callbacks(geoInfo));
Expand Down
1 change: 1 addition & 0 deletions ServerBrowser/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
Expand Down
42 changes: 30 additions & 12 deletions ServerBrowser/ServerBrowserForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace ServerBrowser
{
public partial class ServerBrowserForm : XtraForm
{
private const string Version = "2.25";
private const string Version = "2.25.1";
private const string DevExpressVersion = "v15.1";
private const string CustomDetailColumnPrefix = "ServerInfo.";
private const string CustomRuleColumnPrefix = "custRule.";
Expand All @@ -55,6 +55,7 @@ public partial class ServerBrowserForm : XtraForm
private readonly string iniPath;
private readonly IniFile iniFile;
private XtraTabPage dragPage;
private bool isSingleRowUpdate = true;
private const int PredefinedTabCount = 2;

#region ctor()
Expand Down Expand Up @@ -784,6 +785,7 @@ protected void ReloadServerList()
if (this.viewModel.InitialGameID == 0) // this would result in a truncated list of all games
return;

this.isSingleRowUpdate = false;
this.SetStatusMessage("Requesting server list from master server...");
this.miStopUpdate.Enabled = true;
this.timerReloadServers.Stop();
Expand All @@ -810,6 +812,7 @@ private void RefreshServerInfo()
{
if (this.queryLogic.IsUpdating)
return;
this.isSingleRowUpdate = false;
this.miStopUpdate.Enabled = true;
this.timerReloadServers.Stop();
this.SetStatusMessage("Updating status of " + this.viewModel.servers.Count + " servers...");
Expand Down Expand Up @@ -929,6 +932,14 @@ protected void UpdateViews(bool forceUpdateDetails = false)

++ignoreUiEvents;

// special logic for single-row updates to prevent reordering of rows
if (this.isSingleRowUpdate)
{
this.RefreshDataInSelectedRows();
--ignoreUiEvents;
return;
}

var topRow = this.gvServers.TopRowIndex;
this.gvServers.BeginDataUpdate();

Expand Down Expand Up @@ -971,6 +982,15 @@ protected void UpdateViews(bool forceUpdateDetails = false)
}
#endregion

#region RefreshDataInSelectedRows()
private void RefreshDataInSelectedRows()
{
var sel = this.gvServers.GetSelectedRows();
foreach (var handle in sel)
this.gvServers.RefreshRow(handle);
}
#endregion

#region UpdateCachedServerNames()
private void UpdateCachedServerNames()
{
Expand Down Expand Up @@ -1339,6 +1359,7 @@ protected virtual void queryLogic_ReloadServerListComplete(List<ServerRow> rows)
this.CheckAlertCondition();
if (this.spinRefreshInterval.Value > 0)
this.timerReloadServers.Start();
this.isSingleRowUpdate = true;
}

#endregion
Expand All @@ -1347,15 +1368,10 @@ protected virtual void queryLogic_ReloadServerListComplete(List<ServerRow> rows)
protected virtual void queryLogic_RefreshSingleServerComplete(ServerEventArgs e)
{
this.UpdateBuddyCount(e.Server);

if (this.gvServers.GetFocusedRow() == e.Server)
{
if (this.gvServers.SelectedRowsCount <= 1)
this.gvServers.RefreshRow(this.gvServers.FocusedRowHandle);
else
this.gvServers.RefreshData();
this.UpdateGridDataSources();
}
var idx = this.viewModel?.servers?.IndexOf(e.Server) ?? -1;
if (idx >= 0)
this.gvServers.RefreshRow(this.gvServers.GetRowHandle(idx));
this.UpdateGridDataSources();
}
#endregion

Expand Down Expand Up @@ -1990,14 +2006,16 @@ private void miUpdateServerInfo_ItemClick(object sender, ItemClickEventArgs e)
{
this.RefreshGameExtensions();
if (this.gvServers.SelectedRowsCount == 1)
{
this.queryLogic.RefreshSingleServer((ServerRow) this.gvServers.GetFocusedRow());
}
else
{
var list = new List<ServerRow>();
foreach (var handle in this.gvServers.GetSelectedRows())
list.Add((ServerRow)this.gvServers.GetRow(handle));
list.Add((ServerRow) this.gvServers.GetRow(handle));
this.queryLogic.RefreshAllServers(list);
}
}
}
#endregion

Expand Down
2 changes: 1 addition & 1 deletion ServerBrowser/ServerQueryLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void Cancel()
this.currentRequest.IsCancelled = true;
}
#endregion

// reload server list

#region ReloadServerList()
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2.25.1
---
- fixed error message popup at startup
- fixed keeping rows at position when only updating single rows

2.25
---
- added control to turn ghost player filter on/off
Expand Down

0 comments on commit 17cb6d5

Please sign in to comment.