Ejemplo n.º 1
0
 private void SourceValueChanged(object sender, MemberNodeChangeEventArgs e)
 {
     UpdateSourceFileWatcher();
     TextureRegion.RefreshImageSize();
     if (string.IsNullOrEmpty(e.OldValue?.ToString()) && e.NewValue != null && !ServiceProvider.Get <IUndoRedoService>().UndoRedoInProgress)
     {
         // If the source path was null or empty before, we set the texture to the whole image by default
         TextureRegion.UseWholeImage();
     }
 }
Ejemplo n.º 2
0
        private async void SourceFileChanged(object sender, FileSystemEventArgs e)
        {
            // Loading sometimes fail if we try too soon.
            // TODO: this could be avoided if the cache was managed view-model side. Then we could try immediately to load, but add a retry count.
            await Task.Delay(100);

            Dispatcher.InvokeAsync(() =>
            {
                OnPropertyChanging(nameof(Source));
                OnPropertyChanged(nameof(Source));

                TextureRegion.RefreshImageSize();
            }).Forget();
        }