void FilterList_FilterSelected(object sender, EventArgs e) { if (!Connected) { return; } if (USBRX != null) { CurrentFilter = (FilterInformation)sender; if (sender is AD6636FilterFile) { radioAgcSlow.Enabled = false; radioAgcMedium.Enabled = false; radioAgcFast.Enabled = false; if (radioAgcSlow.Checked || radioAgcMedium.Checked || radioAgcFast.Checked) { radioAgcOff.Checked = true; } USBRX.SetFilter((AD6636FilterFile)sender); SharedMemNative.shmemchain_set_rate(ShmemNode, ((AD6636FilterFile)sender).Rate * 2); } else if (sender is AtmelFilter) { radioAgcSlow.Enabled = true; radioAgcMedium.Enabled = true; radioAgcFast.Enabled = true; USBRX.SetFilter((AtmelFilter)sender); SharedMemNative.shmemchain_set_rate(ShmemNode, ((AtmelFilter)sender).Rate * 2); } } TransferMode = TransferMode; }
private FilterInformation UpdateFilterInformation() { FilterInformation filterInfo = new FilterInformation(); filterInfo.PageNumber = 1; foreach (string formFieldName in HttpContext.Request.Form.AllKeys) { if (!formFieldName.StartsWith("FILTER_")) { continue; } object propertyInstanceReference = null; PropertyInfo property = GetTargetProperty(ref filterInfo, formFieldName, out propertyInstanceReference); object boxedValue = GetObjectValue(property, HttpContext.Request.Form[formFieldName]); if (propertyInstanceReference == null || property == null || boxedValue == null) { continue; } property.SetValue(propertyInstanceReference, boxedValue, null); } return(filterInfo); }
public void ShouldBuildUrlForLanguageAlreadyInLanguageFilter() { var filterInformation = new FilterInformation(new List <string> { "Zulu", "Xhosa" }, new List <string>(), new List <string>(), new List <BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/Filter?languages=Xhosa", filterInformation.LanguageFilterUrl("Zulu")); }
private List <Product> ApplyFilter(List <Product> products, FilterInformation filter) { int? minYear = filter.minYear; int? maxYear = filter.maxYear; float? minDiameter = filter.minDiameter; float? maxDiameter = filter.maxDiameter; float? minWeight = filter.minWeight; float? maxWeight = filter.maxWeight; string country = filter.country; string category = filter.category; string material = filter.material; if (minYear == null) { minYear = 0; } if (maxYear == null) { maxYear = 10000; } products = products.Where(x => x.Year <= maxYear && x.Year >= minYear).ToList(); if (minWeight == null) { minWeight = 0; } if (maxWeight == null) { maxWeight = 10000; } products = products.Where(x => x.Weight <= maxWeight && x.Weight >= minWeight).ToList(); if (minDiameter == null) { minDiameter = 0; } if (maxDiameter == null) { maxDiameter = 10000; } products = products.Where(x => x.Diameter >= minDiameter && x.Year <= maxDiameter).ToList(); if (country != null) { products = products.Where(x => x.Country == country).ToList(); } if (category != null) { products = products.Where(x => x.Category == category).ToList(); } if (material != null) { products = products.Where(x => x.Material == material).ToList(); } return(products); }
private PropertyInfo GetTargetProperty(ref FilterInformation filterInfo, string formFieldName, out object propertyInstanceReference) { string[] formFieldNameElements = formFieldName.Split(new char[] { '_' }); propertyInstanceReference = filterInfo; PropertyInfo propertyInfo = GetTargetProperty(formFieldNameElements, ref propertyInstanceReference); return(propertyInfo); }
public void ShouldBuildUrlForAgeRangeAlreadyInAgeRangeFilter() { var filterInformation = new FilterInformation(new List <string> { "Zulu", "Xhosa" }, new List <string> { "0-2", "3-6" }, new List <string>(), new List <BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/Filter?ageRanges=0-2&languages=Zulu&languages=Xhosa", filterInformation.AgeRangeFilterUrl("3-6")); }
public void AddFilter(FilterInformation filter) { Button btn = new Button(); btn.Text = FrequencyFormatter.FreqToString(filter.Width).Replace("Hz", ""); btn.Margin = new Padding(1, 1, 0, 0); btn.Size = new Size(50, 20); btn.FlatStyle = FlatStyle.Popup; btn.Tag = filter; btn.Click += new EventHandler(ButtonPressed); btn.MouseUp += new MouseEventHandler(delegate(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { FilterDetailDialog dlg = new FilterDetailDialog(filter); dlg.Show(); /* * string msg = ""; * * msg += " Filter details:" + Environment.NewLine; * msg += "-------------------------------------" + Environment.NewLine; * //msg += " Version: " + filter.ProgramVersion + Environment.NewLine; * //msg += " Device : " + filter.DeviceName + Environment.NewLine; * msg += " Rate : " + FrequencyFormatter.FreqToStringAccurate(filter.Rate) + Environment.NewLine; * msg += " Width : " + FrequencyFormatter.FreqToStringAccurate(filter.Width) + Environment.NewLine; * string[] nameParts = filter.Location.Split('\\'); * if (nameParts.Length > 0) * { * msg += " Location: \\" + nameParts[nameParts.Length - 1] + Environment.NewLine; * } * else * { * msg += " Location: " + filter.Location + Environment.NewLine; * } * MessageBox.Show(msg); * */ } }); if (FirstFilter == null) { FirstFilter = btn; } if (filter is AD6636FilterFile) { ctrFilterFileButtons.Controls.Add(btn); } else { ctrAtmelFilterButtons.Controls.Add(btn); } }
/// <summary> /// </summary> /// <param name="selectedFilter"></param> /// <returns></returns> public async Task <IEnumerable <IssueCard> > GetIssuesFromFilterAsync(FilterInformation selectedFilter) { if (selectedFilter != null) { var jira = GetJiraClient(); var issues = await jira.Filters.GetIssuesFromFavoriteAsync(selectedFilter.Name).ConfigureAwait(true); return(await TransformResultAsync(jira, issues).ConfigureAwait(true)); } return(null); }
protected void UpdateFilterInformation(int?pageNumber) { FilterInfo.PageNumber = pageNumber ?? 1; if (HttpContext == null || HttpContext.Request == null || HttpContext.Request.Form == null || HttpContext.Request.Form.Count < 1) { return; } FilterInfo = UpdateFilterInformation(); }
public void ShouldBuildUrlForGenreAlreadyInGenreFilter() { var filterInformation = new FilterInformation(new List <string> { "Zulu", "Xhosa" }, new List <string> { "0-2", "3-6" }, new List <string> { "Fiction", "Poetry" }, new List <BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/Filter?genres=Fiction&languages=Zulu&languages=Xhosa&ageRanges=0-2&ageRanges=3-6", filterInformation.GenreFilterUrl("Poetry")); }
public void ShouldBuildUrlForPaginationWithFilters() { var filterInformation = new FilterInformation(new List <string> { "Zulu", "Xhosa" }, new List <string> { "0-2", "3-6" }, new List <string> { "Fiction", "Poetry" }, new List <BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/Filter?page=2&genres=Fiction&genres=Poetry&languages=Zulu&languages=Xhosa&ageRanges=0-2&ageRanges=3-6", filterInformation.PaginationUrl("Filter", 2)); }
public ViewResult UserCatalog(int page = 1, string name = null, string category = null, string country = null, int?minYear = null, int?maxYear = null, string material = null, float?minWeight = null, float?maxWeight = null, float?minDiameter = null, float?maxDiameter = null, string byName = null, string byYear = null, string byCountry = null, string byCategory = null, string byMaterial = null, string byWeight = null, string byDiameter = null, string byDateTime = null) { ViewBag.UserAuth = User.Identity.IsAuthenticated; ViewBag.UserName = User.Identity.Name; Array.Sort(RusCountries); ViewBag.Countries = RusCountries; ViewBag.Materials = RusMaterials; ViewBag.Categories = RusCategories; List <Product> allProducts = db.Products.Include(c => c.UserAdder).Where(x => x.isMainCatalog == false).OrderByDescending(x => x.DateTime).ToList(); ViewBag.CatalogCount = allProducts.Count; filterInformation = new FilterInformation { name = name, country = country, category = category, minYear = minYear, maxYear = maxYear, material = material, minWeight = minWeight, maxWeight = maxWeight, minDiameter = minDiameter, maxDiameter = maxDiameter }; sortingInformation = new SortingInformation { byName = byName, byCountry = byCountry, byCategory = byCategory, byYear = byYear, byMaterial = byMaterial, byWeight = byWeight, byDiameter = byDiameter, byDateTime = byDateTime }; allProducts = ApplyFilter(allProducts, filterInformation); allProducts = ApplySorting(allProducts, sortingInformation); if (filterInformation.name != null) { allProducts = SearchByName(allProducts, filterInformation.name); } int pageSize = 50; var count = allProducts.Count(); ViewBag.SearchCount = count; var items = allProducts.Skip((page - 1) * pageSize).Take(pageSize).ToList(); PageViewModel pageViewModel = new PageViewModel(count, page, pageSize); CatalogViewModel viewModel = new CatalogViewModel { PageViewModel = pageViewModel, Products = items, FilterInformation = filterInformation, SortingInformation = sortingInformation }; return(View("UserCatalog", viewModel)); }
public void ButtonPressed(object sender, EventArgs e) { Button btn = (Button)sender; FilterInformation filter = (FilterInformation)btn.Tag; if (LastButton != null) { LastButton.ForeColor = LastButtonColor; } LastButton = btn; LastButtonColor = LastButton.ForeColor; LastButton.ForeColor = Color.Red; if (FilterSelected != null) { FilterSelected(filter, null); } }
void FilterList_FilterSelected(object sender, EventArgs e) { if (USBRX != null) { FilterInformation CurrentFilter = (FilterInformation)sender; if (sender is AD6636FilterFile) { USBRX.SetFilter((AD6636FilterFile)sender); SharedMemNative.shmemchain_set_rate(USBRX.ShmemNode, ((AD6636FilterFile)sender).Rate * 2); } else if (sender is AtmelFilter) { USBRX.SetFilter((AtmelFilter)sender); SharedMemNative.shmemchain_set_rate(USBRX.ShmemNode, ((AtmelFilter)sender).Rate * 2); } USBRX.CurrentMode = LibRXFFT.Libraries.eTransferMode.Stream; } }
public FilterDetailDialog(FilterInformation filter) { if (filter.SourceDevice is Atmel) { Atmel = (Atmel)filter.SourceDevice; } FilterInfo = filter; InitializeComponent(); txtFilterRate.Text = FrequencyFormatter.FreqToStringAccurate(filter.Rate); txtFilterWidth.Text = FrequencyFormatter.FreqToStringAccurate(filter.Width); txtFilterLocation.Text = filter.Location; txtFilterOffset.ValueChanged += new EventHandler(txtFilterOffset_ValueChanged); txtFilterGain.ValueChanged += new EventHandler(txtFilterGain_ValueChanged); ReadFilterDetails(); }
/* used if atmel uploads filter */ public bool SetFilter(AtmelFilter filter) { bool success = true; CurrentFilter = filter; FilterRate = filter.Rate; _FilterWidth = filter.Width; /* inform listeners */ if (SamplingRateChanged != null) { SamplingRateChanged(this, null); } if (FilterWidthChanged != null) { FilterWidthChanged(this, null); } return(success); }
/// <summary> /// Erzeugt einen neuen Filter. /// </summary> /// <param name="name">Der Name des Filters.</param> /// <param name="info">Die Informationen zum Filter.</param> /// <returns>Die COM Schnittstelle des neuen Filters.</returns> private TypedComIdentity <IBaseFilter> AddFilter(string name, FilterInformation info) { // Create it var filter = info.CreateFilter(); try { // Register AddFilter(name, filter); // Report return(filter); } catch { // Cleanup filter.Dispose(); // Forward throw; } }
private void InitializeFilterInformation() { FilterInfo = new FilterInformation(); }
public void ShouldBuildUrlForPaginationWhenFiltersAreEmpty() { var filterInformation = new FilterInformation(new List<BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/List?page=2", filterInformation.PaginationUrl("List", 2)); }
public void ShouldBuildUrlForEmptyFilter() { var filterInformation = new FilterInformation(new List <BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/Filter?languages=Zulu", filterInformation.LanguageFilterUrl("Zulu")); }
public ViewResult AboutUser(int userId, int page = 1, string name = null, string category = null, string country = null, int?minYear = null, int?maxYear = null, string material = null, float?minWeight = null, float?maxWeight = null, float?minDiameter = null, float?maxDiameter = null, string byName = null, string byYear = null, string byCountry = null, string byCategory = null, string byMaterial = null, string byWeight = null, string byDiameter = null, string byDateTime = null) { ViewBag.UserAuth = User.Identity.IsAuthenticated; ViewBag.UserName = User.Identity.Name; Array.Sort(RusCountries); ViewBag.Countries = RusCountries; ViewBag.Materials = RusMaterials; ViewBag.Categories = RusCategories; User userAbout = db.Users.Include(c => c.UserProducts).ThenInclude(cs => cs.Product).FirstOrDefault(x => x.UserId == userId); User user = db.Users.FirstOrDefault(x => x.Email == User.Identity.Name); if (user == null) { ViewBag.UserRole = ""; } else { ViewBag.UserRole = user.Role; } List <Product> allProducts = userAbout.UserProducts.Select(sc => sc.Product).OrderByDescending(x => x.DateTime).ToList(); ViewBag.CatalogCount = allProducts.Count; filterInformation = new FilterInformation { name = name, country = country, category = category, minYear = minYear, maxYear = maxYear, material = material, minWeight = minWeight, maxWeight = maxWeight, minDiameter = minDiameter, maxDiameter = maxDiameter }; sortingInformation = new SortingInformation { byName = byName, byCountry = byCountry, byCategory = byCategory, byYear = byYear, byMaterial = byMaterial, byWeight = byWeight, byDiameter = byDiameter, byDateTime = byDateTime }; allProducts = ApplyFilter(allProducts, filterInformation); allProducts = ApplySorting(allProducts, sortingInformation); if (filterInformation.name != null) { allProducts = SearchByName(allProducts, filterInformation.name); } int pageSize = 50; var count = allProducts.Count(); ViewBag.SearchCount = count; var items = allProducts.Skip((page - 1) * pageSize).Take(pageSize).ToList(); PageViewModel pageViewModel = new PageViewModel(count, page, pageSize); CatalogViewModel viewModel = new CatalogViewModel { PageViewModel = pageViewModel, Products = items, FilterInformation = filterInformation, SortingInformation = sortingInformation, User = userAbout }; return(View("AboutUser", viewModel)); }
public void ShouldBuildUrlForPaginationWhenFiltersAreEmpty() { var filterInformation = new FilterInformation(new List <BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/List?page=2", filterInformation.PaginationUrl("List", 2)); }
public void ShouldBuildUrlForPaginationWithSearchQuery() { var filterInformation = new FilterInformation(new List <BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/List?page=2&searchQuery=Jane Eye", filterInformation.PaginationUrl("List", 2, "Jane Eye")); }
public void ShouldBuildUrlForPaginationWithSearchQuery() { var filterInformation = new FilterInformation(new List<BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/List?page=2&searchQuery=Jane Eye", filterInformation.PaginationUrl("List", 2, "Jane Eye")); }
public void ShouldBuildUrlForPaginationWithFilters() { var filterInformation = new FilterInformation(new List<string> { "Zulu", "Xhosa" }, new List<string> { "0-2", "3-6" }, new List<string> { "Fiction", "Poetry" }, new List<BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/Filter?page=2&genres=Fiction&genres=Poetry&languages=Zulu&languages=Xhosa&ageRanges=0-2&ageRanges=3-6", filterInformation.PaginationUrl("Filter", 2)); }
/// <summary> /// Erzeugt einen neuen Filter. /// </summary> /// <param name="name">Der Name des Filters.</param> /// <param name="info">Die Informationen zum Filter.</param> /// <returns>Die COM Schnittstelle des neuen Filters.</returns> private TypedComIdentity<IBaseFilter> AddFilter( string name, FilterInformation info ) { // Create it var filter = info.CreateFilter(); try { // Register AddFilter( name, filter ); // Report return filter; } catch { // Cleanup filter.Dispose(); // Forward throw; } }
public void ShouldBuildUrlForLanguageNotAlreadyInLanguageFilter() { var filterInformation = new FilterInformation(new List<string> { "Xhosa" }, new List<string>(), new List<string>(), new List<BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/Filter?languages=Zulu&languages=Xhosa", filterInformation.LanguageFilterUrl("Zulu")); }
public void ShouldBuildUrlForGenreNotAlreadyInGenreFilter() { var filterInformation = new FilterInformation(new List<string> { "Zulu", "Xhosa" }, new List<string> { "0-2", "3-6" }, new List<string> { "Fiction" }, new List<BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/Filter?genres=Poetry&genres=Fiction&languages=Zulu&languages=Xhosa&ageRanges=0-2&ageRanges=3-6", filterInformation.GenreFilterUrl("Poetry")); }
/// <summary> /// Meldet alle Filter einer bestimmten Art. /// </summary> /// <param name="ofType">Optional die gewünschte Art.</param> /// <returns>Die Liste der gewünschten Filter.</returns> public IEnumerable<FilterInformation> GetFilters( FilterInformation.FilterType? ofType ) { // Just process return m_Filters.Where( f => !ofType.HasValue || (f.Type == ofType.Value) ); }
public void ShouldBuildUrlForAgeRangeNotAlreadyInAgeRangeFilter() { var filterInformation = new FilterInformation(new List<string> { "Zulu", "Xhosa" }, new List<string> { "0-2" }, new List<string>(), new List<BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/Filter?ageRanges=3-6&ageRanges=0-2&languages=Zulu&languages=Xhosa", filterInformation.AgeRangeFilterUrl("3-6")); }
public bool SetFilter(int channel, AD6636FilterFile filter) { bool success = true; CurrentFilter = filter; FilterRate = filter.Rate; _FilterWidth = filter.Width; lock (this) { /* set the MRCF channel to modify */ success &= this.Device.AD6636WriteReg(AD6636_REG_IOAC, AD6636_REG_IOAC_L, (1 << channel)); /* set the source FIR to read from */ success &= this.Device.AD6636WriteReg(AD6636_REG_MRCFC, AD6636_REG_MRCFC_L, (channel << 10)); success &= this.Device.AD6636WriteReg(104, 2, 0); success &= this.Device.AD6636WriteReg(108, 2, 5); success &= this.Device.AD6636WriteReg(110, 2, 5); success &= this.Device.AD6636WriteReg(116, 2, 0); int filterFlags = 0; if (filter.HB2) { filterFlags |= 0x01; } if (filter.FIR2) { filterFlags |= 0x02; } if (filter.HB1) { filterFlags |= 0x04; } if (filter.FIR1) { filterFlags |= 0x08; } success &= this.Device.AD6636WriteReg(120, 1, filterFlags); success &= this.Device.AD6636WriteReg(121, 1, filter.CIC5Scale); success &= this.Device.AD6636WriteReg(122, 1, filter.CIC5Decimation - 1); if (filter.CIC5) { success &= this.Device.AD6636WriteReg(123, 1, 0); } else { success &= this.Device.AD6636WriteReg(123, 1, 1); } success &= this.Device.AD6636WriteReg(136, 1, filter.DRCFNTaps - 1); success &= this.Device.AD6636WriteReg(137, 1, (long)(64 - filter.DRCFNTaps / 2)); success &= this.Device.AD6636WriteReg(138, 2, 0x700 | ((filter.DRCFDecimation - 1) << 4)); success &= this.Device.AD6636WriteReg(148, 1, filter.CRCFNTaps - 1); success &= this.Device.AD6636WriteReg(149, 1, (long)(64 - filter.CRCFNTaps / 2)); success &= this.Device.AD6636WriteReg(150, 2, 0x700 | ((filter.CRCFDecimation - 1) << 4)); success &= this.Device.AD6636WriteReg(184, 2, 0); int DRCFEntries = (int)((filter.DRCFNTaps + 1) / 2); success &= this.Device.AD6636WriteReg(140, 1, 0); success &= this.Device.AD6636WriteReg(141, 1, DRCFEntries - 1); for (int pos = 0; pos < DRCFEntries; pos++) { success &= this.Device.AD6636WriteReg(144, 2, filter.DRCFTaps[DRCFEntries - 1 + pos]); } int CRCFEntries = (int)((filter.CRCFNTaps + 1) / 2); success &= this.Device.AD6636WriteReg(152, 1, 0); success &= this.Device.AD6636WriteReg(153, 1, CRCFEntries - 1); for (int pos = 0; pos < CRCFEntries; pos++) { success &= this.Device.AD6636WriteReg(156, 3, filter.CRCFTaps[CRCFEntries - 1 + pos]); } success &= this.Device.AD6636WriteReg(184, 2, 0); if (FilterRate > NCOFreq / 4) { success &= SetDivisor(1); } else if (FilterRate > NCOFreq / 8) { success &= SetDivisor(2); } else if (FilterRate > NCOFreq / 16) { success &= SetDivisor(4); } else { success &= SetDivisor(8); } success &= SelectChannel(channel); success &= SoftSync(); /* inform listeners */ if (SamplingRateChanged != null) { SamplingRateChanged(this, null); } if (FilterWidthChanged != null) { FilterWidthChanged(this, null); } } return(success); }
public void ShouldBuildUrlForEmptyFilter() { var filterInformation = new FilterInformation(new List<BookInformation>().ToPagedList(1, 9)); Assert.AreEqual("/Books/Filter?languages=Zulu", filterInformation.LanguageFilterUrl("Zulu")); }