コード例 #1
0
 /// <summary>
 /// Autoriza remotamente un dispositivo
 /// </summary>
 /// <param name="deviceToAuth"></param>
 public static IObservable<Device> AuthorizeDevice(Device deviceToAuth)
 {
     return RestEndpointFactory
             .Create<IDevicesEndpoint>(SessionManager.Instance.CurrentLoggedUser)
             .UpdateDevice(deviceToAuth.Imei, PrepareDeviceForAuth(deviceToAuth))
             .ToObservable()
             .SubscribeOn(TaskPoolScheduler.Default)
             .InterpretingErrors();
 }
コード例 #2
0
 public AuthorizeDevice(Device authPendingDevice)
 {
     InitializeComponent();
     _indeterminateLoading = new LoadingControl();
     _errorMessage = new ErrorControl();
     _errorMessage.BtnOk.Click += (s, e) => { Transitioning.Content = null; };
     DataContext = new AuthorizeDevicePresenter(this, authPendingDevice);
     Loaded += (s, e) => { ValidationErrorsAssistant.ClearErrors(AuthPanel); };
 }
コード例 #3
0
 /// <summary>
 /// Verifica que los parámetros de busqueda de un dispositivo coincidan con ese para
 /// que sea agregado o no a un filtro
 /// </summary>
 /// <param name="device"></param>
 /// <param name="searchQuery"></param>
 /// <returns></returns>
 public static bool MatchesSearchQuery(Device device, string searchQuery)
 {
     var resp = device.Name.ToLower().Contains(searchQuery) ||
                device.Imei.ToLower().Contains(searchQuery) ||
                (device.PhoneNumber != null && device.PhoneNumber.ToLower().Contains(searchQuery)) ||
                (device.WifiMacAddress != null && device.WifiMacAddress.ToLower().Contains(searchQuery));
     if (resp || !searchQuery.Contains(' ')) return resp;
     var searchParams = searchQuery.Split(' ');
     return searchParams.Any(searchParam => MatchesSearchQuery(device, searchParam));
 }
コード例 #4
0
 public void ShowDeviceAuthorizedSuccessfuly(Device device)
 {
     Dispatcher.InvokeAsync(() =>
     {
         var mainWindow = MainWindowService.Instance.MainWindow;
         mainWindow.StatusBarDefault();
         mainWindow.DevicesView(true);
         mainWindow.NotifyUser(Properties.Resources.TitleSuccess,
             String.Format(Properties.Resources.MsgDeviceSuccessfullyAuthorized, device.Name));
     });
 }
コード例 #5
0
 /// <summary>
 /// Crea una copia de solo los valores actualizables en la autorización de un dispositivo
 /// </summary>
 /// <param name="deviceToAuth"></param>
 /// <returns></returns>
 private static Device PrepareDeviceForAuth(Device deviceToAuth)
 {
     return new Device()
     {
         Name = deviceToAuth.Name,
         PhoneNumber = deviceToAuth.PhoneNumber,
         IdCiscoAsa = deviceToAuth.IdCiscoAsa,
         ScreenSize = deviceToAuth.ScreenSize,
         ScreenResolution = deviceToAuth.ScreenResolution,
         Camera = deviceToAuth.Camera,
         SdMemoryCard = deviceToAuth.SdMemoryCard,
         GmailAccount = deviceToAuth.GmailAccount,
         Comments = deviceToAuth.Comments,
         Status = DeviceStatus.Authorized
     };
 }
コード例 #6
0
 public DeviceDetails(Device device)
 {
     InitializeComponent();
     DataContext = new DeviceDetailsPresenter(this, device);
 }
コード例 #7
0
 public void ViewDeviceAuthorization(Device device)
 {
     var authDeviceView = new AuthorizeDevice(ObjectCloner.Clone(device));
     MainWindowService.Instance.MainWindow.CurrentView(authDeviceView);
 }
コード例 #8
0
 public void ShowDeviceDetails(Device device)
 {
     var showDeviceDetails = new DeviceDetails(device);
     MainWindowService.Instance.MainWindow.CurrentView(showDeviceDetails);
 }