private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (!this.loaded) { if (!DesignerProperties.GetIsInDesignMode(this)) { UserLoginViewModel ulvm = new UserLoginViewModel(); if (ulvm.UserSet()) { this.DataContext = ulvm; this.LoginSuccess(); } ulvm.PropertyChanged += delegate(object s, PropertyChangedEventArgs args) { if (args.PropertyName == "User") { if (ulvm.User != null && ulvm.User.IsActive) { if ((s as UserLoginViewModel).UserSet()) this.LoginSuccess(); } } }; this.DataContext = ulvm; } } this.loaded = true; }
public MainNotifViewModel(UserLoginViewModel userLogin, Dispatcher dispatcher) { this.Usuario = userLogin.User; //this.ConexionServer = new ConexionServerViewModel(); this.SyncViewModel = new SyncViewModel(); //indica cuando arrancla la aplicacion por primera vez =0 this.LoadInfo(0); }
public MainNotif(UserLoginViewModel userLogin) { InitializeComponent(); ConfigurationManager.AppSettings["Assembly"] = int.Parse((Assembly.GetExecutingAssembly().GetName().Version.ToString()).Replace(".", "")).ToString(); System.Windows.Threading.Dispatcher dispatcher = Application.Current.Dispatcher; this.DataContext = new MainNotifViewModel(userLogin,dispatcher); this.Height = System.Windows.SystemParameters.PrimaryScreenHeight; this.Top = 0; this.Left = System.Windows.SystemParameters.PrimaryScreenWidth - 5; this.GetScreenActive(); }