public MainView() { InitializeComponent(); _plugins = Utilities.Helpers.Singleton <Helpers.PlugInServiceLocator> .Instance; _tabs = new Dictionary <Guid, TabItem>(); if (!GalaSoft.MvvmLight.ViewModelBase.IsInDesignModeStatic) { _settings = CommonServiceLocator.ServiceLocator.Current.GetInstance <Utilities.Models.Settings>(); _log = CommonServiceLocator.ServiceLocator.Current.GetInstance <ILogger>(); } var view = CollectionViewSource.GetDefaultView(this.tabControl.Items); view.CollectionChanged += (o, e) => { this.tabControl.Visibility = this.tabControl.HasItems ? Visibility.Visible : Visibility.Hidden; }; this.RegisterMessages(); _dt = new System.Windows.Threading.DispatcherTimer(); _dt.Tick += Dt_Tick; _dt.Interval = Properties.Settings.Default.Timeout; }
public DemoMenuPage() { InitializeComponent(); this.sucursalTextBox.Text = "08"; _loginPage = new Lazy <LoginPage>(); GalaSoft.MvvmLight.Messaging.Messenger.Default.Register <Messages.LoginResponse>(this, lr => { if (lr.Success) { var cajero = lr.Empleado; this.cajeroTextBox.Text = $"{cajero.Nombre} {cajero.ApellidoPaterno} {cajero.ApellidoMaterno}"; this.sucursalTextBox.IsReadOnly = true; Properties.Settings.Default.Sucursal = this.sucursalTextBox.Text; Properties.Settings.Default.Cajero = cajero.Usuario; Properties.Settings.Default.Save(); } }); this.sucursalTextBox.Text = Properties.Settings.Default.Sucursal; if (!GalaSoft.MvvmLight.ViewModelBase.IsInDesignModeStatic) { var ports = SerialPort.GetPortNames(); if (ports?.Any() ?? false) { foreach (var item in ports) { this.comboBox.Items.Add(item); } } _settings = CommonServiceLocator.ServiceLocator.Current.GetInstance <Utilities.Models.Settings>(); var proxy = CommonServiceLocator.ServiceLocator.Current.GetInstance <Common.ServiceContracts.ICommonServiceAsync>(); var cajero = Properties.Settings.Default.Cajero; if (!String.IsNullOrEmpty(cajero)) { try { _settings.Cajero = proxy.FindCajero(cajero); if (_settings.Cajero != null) { _settings.Sucursal = proxy.FindSucursal(this.sucursalTextBox.Text); this.cajeroTextBox.Text = $"{_settings.Cajero.Nombre} {_settings.Cajero.ApellidoPaterno} {_settings.Cajero.ApellidoMaterno}"; this.sucursalTextBox.IsReadOnly = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } this.checkBox.IsChecked = Properties.Settings.Default.MultiCaja; } }
public TabViewModelBase() { if (!this.IsInDesignMode) { _settings = CommonServiceLocator.ServiceLocator.Current.GetInstance <Utilities.Models.Settings>(); } this.PropertyChanged += TabViewModelBase_PropertyChanged; this.CloseCommand = new RelayCommand(() => { Messenger.Default.Send(new Utilities.Messages.CloseTab { GID = this.GID }); }, () => this.IsComplete); }
public ServiceClient() { _settings = CommonServiceLocator.ServiceLocator.Current.GetInstance <Utilities.Models.Settings>(); }