private static void HandleVMPropertyChanged(BindableObject bindable, object oldValue, object newValue) { MediaImageFull mifModel = (bindable as MediaImageFull); HLinkHomeImageModel argHLinkMediaModel = newValue as HLinkHomeImageModel; if (argHLinkMediaModel == mifModel.HLinkMediaModel) { return; } mifModel.HLinkMediaModel = argHLinkMediaModel; if (!(argHLinkMediaModel is null) && (argHLinkMediaModel.Valid)) { MediaModel t = argHLinkMediaModel.DeRef; if ((t.IsMediaStorageFileValid) && (t.IsMediaFile)) { try { mifModel.daImage.Source = t.MediaStorageFilePath; var tt = mifModel.daImage.Source; mifModel.IsVisible = true; // TODO cleanup code so does nto use bindignContext if possible mifModel.BindingContext = argHLinkMediaModel; return; } catch (Exception ex) { DataStore.CN.NotifyException("Exception in MediaImageFull control", ex); throw; } } } // Nothing to display so hide mifModel.IsVisible = false; }
private void MediaImageFull_BindingContextChanged(object sender, EventArgs e) { Contract.Assert(sender != null); MediaImageFull mifModel = (sender as MediaImageFull); // Hide if not valid if ((!(mifModel.BindingContext is HLinkMediaModel argHLinkMediaModel)) || (!argHLinkMediaModel.Valid)) { mifModel.IsVisible = false; return; } if (argHLinkMediaModel == mifModel.CurrentHLinkMediaModel) { return; } IMediaModel t = argHLinkMediaModel.DeRef; if ((t.IsMediaStorageFileValid) && (t.IsImage)) { try { mifModel.daImage.Source = t.MediaStorageFilePath; mifModel.IsVisible = true; CurrentHLinkMediaModel = argHLinkMediaModel; return; } catch (Exception ex) { App.Current.Services.GetService <IErrorNotifications>().NotifyException("Exception in MediaImageFull control", ex); throw; } } // Nothing to display so hide mifModel.IsVisible = false; }