private static void OnAutoWireViewModelChanged(BindableObject bindable, object oldValue, object newValue) { if (!(bindable is Element view)) { return; } Type viewType = view.GetType(); string viewName = viewType.FullName.Replace(".Views.", ".ViewModels."); string viewAssemblyName = viewType.GetTypeInfo().Assembly.FullName; string viewModelName = string.Format(CultureInfo.InvariantCulture, "{0}Model, {1}", viewName, viewAssemblyName); Type viewModelType = Type.GetType(viewModelName); if (viewModelType == null) { return; } object viewModel = AppServiceLocator.Resolve(viewModelType); view.BindingContext = viewModel; }
public BaseUpdateScreen(IScreenGame game, TViewModel viewModel) : base(game, viewModel) { _threadService = AppServiceLocator.Resolve <IThreadService>(); }