private void Formulario_Loaded(object sender, RoutedEventArgs e) { viewmodel = DataContext as FormularioViewModel; viewmodel.PropertyChanged += Viewmodel_PropertyChanged; viewmodel.Cargar(); if (viewmodel.Campos.Count() == 0) { Ruleta ruleta = new Ruleta(); (Application.Current.MainWindow as MainWindow).Ventana.NavigationService.Navigate(ruleta); } }
private void Viewmodel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) { case "Vacio": if (viewmodel.Vacio) { MessageBox.Show("Debes llenar todos los campos para participar!"); } return; case "Guardado": Ruleta ruleta = new Ruleta(); (Application.Current.MainWindow as MainWindow).Ventana.NavigationService.Navigate(ruleta); return; } }