/// <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(); }
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); }; }
/// <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)); }
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)); }); }
/// <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 }; }
public DeviceDetails(Device device) { InitializeComponent(); DataContext = new DeviceDetailsPresenter(this, device); }
public void ViewDeviceAuthorization(Device device) { var authDeviceView = new AuthorizeDevice(ObjectCloner.Clone(device)); MainWindowService.Instance.MainWindow.CurrentView(authDeviceView); }
public void ShowDeviceDetails(Device device) { var showDeviceDetails = new DeviceDetails(device); MainWindowService.Instance.MainWindow.CurrentView(showDeviceDetails); }