public override bool Equals(object obj) { bool result = false; if (obj != null && obj is DesktopFilter) { DesktopFilter two = obj as DesktopFilter; if (this.DeviceName == two.DeviceName && this.Primary == two.Primary && this.DeviceIndex == two.DeviceIndex && this.Bounds == two.Bounds) { result = true; } } return(result); }
public void GetDesktopFilters(EventHandler<AsyncWorkerCallbackEventArgs<IList<DesktopFilter>>> callback) { try { AsyncWorkerHandle<IList<DesktopFilter>> handle = AsyncWorkerHelper.DoWork<IList<DesktopFilter>>( delegate(object sender, DoWorkEventArgs e) { List<DesktopFilter> filters = new List<DesktopFilter>(); GetDesktopFiltersRequest request = new GetDesktopFiltersRequest(); GetDesktopFiltersResponse response = ServiceProvider.GetService<IDeviceConnectorService, IDeviceConnectorCallbackService>( ViewModelLocator.ServiceClient, ViewModelLocator.SelectedService.HostName, ViewModelLocator.SelectedService.Uri.ToString() ).GetDesktopFilters(request); if (response.Filters != null) { foreach (var item in response.Filters) { DesktopFilter filter = new DesktopFilter(item.Name, item.Index) { Primary = item.IsPrimary, Bounds = item.Bounds }; filters.Add(filter); } } e.Result = filters; }, null, callback); } catch (Exception ex) { ExceptionHandler.Handle(ex); } }