Added filter for the board image
This commit is contained in:
parent
5d518428e7
commit
2855d2e159
@ -114,6 +114,7 @@ namespace RBG_Server_WPF
|
|||||||
// Load sprites as they arrive
|
// Load sprites as they arrive
|
||||||
if (e.CurrentActivity == CommunicationHandler.ProgressData.Activity.ImageDownloaded)
|
if (e.CurrentActivity == CommunicationHandler.ProgressData.Activity.ImageDownloaded)
|
||||||
{
|
{
|
||||||
|
|
||||||
Dispatcher.Invoke(() => StatusTextBlock.Text = $"Downloaded {e.Progress} of {App.Context.GameCommunicationHandler.ImageList.Count} images.");
|
Dispatcher.Invoke(() => StatusTextBlock.Text = $"Downloaded {e.Progress} of {App.Context.GameCommunicationHandler.ImageList.Count} images.");
|
||||||
App.Context.GameCommunicationHandler.ImageCollection.TryGetValue(e.Message, out CachedByteArray cachedByteArray);
|
App.Context.GameCommunicationHandler.ImageCollection.TryGetValue(e.Message, out CachedByteArray cachedByteArray);
|
||||||
BitmapImage image = new();
|
BitmapImage image = new();
|
||||||
@ -124,19 +125,29 @@ namespace RBG_Server_WPF
|
|||||||
{
|
{
|
||||||
Source = image
|
Source = image
|
||||||
};
|
};
|
||||||
LoadedSpriteGrid loadedSprite = null;
|
if (e.Message == App.Context.GameCommunicationHandler.BoardName)
|
||||||
foreach (LoadedSpriteGrid item in ClientLoadedSprites.Children)
|
|
||||||
{
|
{
|
||||||
if (item.Equals(e.Message))
|
// Image is the board image
|
||||||
{
|
Dispatcher.Invoke(() =>BoardPreviewImage.Source = image);
|
||||||
loadedSprite = item;
|
}
|
||||||
break;
|
else
|
||||||
}
|
{
|
||||||
|
// Image is a sprite, load it
|
||||||
|
LoadedSpriteGrid loadedSprite = null;
|
||||||
|
foreach (LoadedSpriteGrid item in ClientLoadedSprites.Children)
|
||||||
|
{
|
||||||
|
if (item.Equals(e.Message))
|
||||||
|
{
|
||||||
|
loadedSprite = item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (loadedSprite == null) loadedSprite = new LoadedSpriteGrid(spriteImage, e.Message);
|
||||||
|
|
||||||
|
// Add the loaded image into the view
|
||||||
|
Dispatcher.Invoke(() => ClientLoadedSprites.Children.Add(loadedSprite));
|
||||||
}
|
}
|
||||||
if (loadedSprite == null) loadedSprite = new LoadedSpriteGrid(spriteImage, e.Message);
|
|
||||||
|
|
||||||
// Add the loaded image into the view
|
|
||||||
Dispatcher.Invoke(() => ClientLoadedSprites.Children.Add(loadedSprite));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user