public Commessa() { //registro il view model e lo inserisco nel binding context dell'activity view InitializeComponent(); vm = (CommessaViewModel)(ServiceLocator.Current.GetInstance(typeof(CommessaViewModel))); vm.Navigation = this.Navigation; vm.filterCommesse = "Tutti"; BindingContext = vm; ((CommessaViewModel)BindingContext).Initialize(this); try { MessagingCenter.Subscribe <string, string>(MessagingCenterEvents.Subscriber, MessagingCenterEvents.AlertError, async(sender, msg) => { if (!string.IsNullOrEmpty(msg)) { await DisplayAlert("Informazione", msg, "OK"); } }); } catch (TargetInvocationException ecx) { Log.Error("AppOfficina", ecx.StackTrace); } catch (Exception ecc) { Log.Error("AppOfficina", ecc.Message); } }
public override void Init() { try { ViewModel = new CommessaViewModel(); } catch (Exception ex) { UtilityError.Write(ex); } }