Added flag not to avoid parallel update of server status
This commit is contained in:
parent
1da414a782
commit
59e51cd586
@ -27,6 +27,7 @@ namespace ENI2.Controls
|
||||
private readonly static ILog _log = LogManager.GetLogger("ServerStatus");
|
||||
private ProgressBar _updateProgressBar;
|
||||
private TextBlock _updateTextBlock;
|
||||
private bool _isUpdating = false;
|
||||
|
||||
public ServerStatusControl()
|
||||
{
|
||||
@ -37,12 +38,14 @@ namespace ENI2.Controls
|
||||
}
|
||||
|
||||
private void ServerStatusControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
{
|
||||
this.refreshButton_Click(null, null);
|
||||
}
|
||||
|
||||
internal void Update(LockingServiceReference.ServerStatus serverStatus)
|
||||
{
|
||||
if (this._isUpdating) return;
|
||||
_isUpdating = true;
|
||||
int totalNum = serverStatus.IMPFiles.Length + serverStatus.READYFiles.Length + serverStatus.CORRUPTFiles.Length;
|
||||
entries.Clear();
|
||||
BackgroundWorker bgWorker = new BackgroundWorker();
|
||||
@ -93,10 +96,10 @@ namespace ENI2.Controls
|
||||
|
||||
tmpList.Sort();
|
||||
|
||||
System.Windows.Application.Current.Dispatcher.Invoke(delegate {
|
||||
//System.Windows.Application.Current.Dispatcher.Invoke(delegate {
|
||||
foreach (StatusEntry se in tmpList)
|
||||
entries.Add(se);
|
||||
});
|
||||
entries.Add(se);
|
||||
//});
|
||||
};
|
||||
|
||||
bgWorker.RunWorkerCompleted += (o, e) =>
|
||||
@ -113,6 +116,8 @@ namespace ENI2.Controls
|
||||
this.labelStatusTransmitter.Content = transmitter.ToString();
|
||||
|
||||
this.busyIndicator.IsBusy = false;
|
||||
|
||||
_isUpdating = false;
|
||||
};
|
||||
|
||||
this.busyIndicator.IsBusy = true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user