Geen omschrijving

Jgrebnev cf04d878dd Обновить 'readme.md' 6 maanden geleden
.vs 1badaf91c5 3comm 6 maanden geleden
WpfApp1 1badaf91c5 3comm 6 maanden geleden
img 1badaf91c5 3comm 6 maanden geleden
WpfApp1.sln 1badaf91c5 3comm 6 maanden geleden
readme.md cf04d878dd Обновить 'readme.md' 6 maanden geleden

readme.md

Классы

namespace WpfApp2.model
{
    public class Spares
    {
        public string name { get; set; }
        public int price { get; set; }
        public string detail { get; set; }
        public string type { get; set; }
        public List<SparesDetail> SparesDetailList { get; set; }
        public List<SparesPrice> SparesPriceList { get; set; }
        public List<SparesType> SparesTypeList { get; set; }

    }
}
namespace WpfApp2.model
{
    class Globals
    {
        public static IDataProvider dataProvider;
    }
}
namespace WpfApp2.model
{
    public class SparesDetail
    {
        public string title { get; set; }
    }
    public class SparesPrice
    {
        public string title { get; set; }
        public int PriceFrom { get; set; }
        public int PriceTo { get; set; }
    }

    public class SparesType
    {
        public string title { get; set; }
    }
}

Mainwindow.xaml(Изменения с прошлой работы)

</ComboBox>
            <RadioButton
    GroupName="Price"
    Tag="2"
    Content="Дороже"
    Checked="RadioButton_Checked"
    VerticalAlignment="Center" RenderTransformOrigin="0.067,0.44"/>
            <RadioButton
    GroupName="Price"
    Tag="1"
    Content="Дешевле"
    IsChecked="True"
    Checked="RadioButton_Checked"
    VerticalAlignment="Center" Height="15" Width="69"/>
            <Label 
    Content="Искать" 
    VerticalAlignment="Center"/>
            <TextBox
    Width="200"
    VerticalAlignment="Center"
    x:Name="SearchFilterTextBox" 
    KeyUp="SearchFilter_KeyUp"/>

Mainwindow.xaml.cs(Изменения с прошлой работы)

 get
            {

                var res = _SparesList;
                res = res
               
                    .Where(c => (c.detail == selectedDetail || selectedDetail == "Деталь"))
                    .Where(c => (selectedPrice == null || (c.price >= selectedPrice.PriceFrom && c.price < selectedPrice.PriceTo)))
                    .Where(c => (c.type == selectedType || selectedType == "Тип ТС"));
                if (searchFilter != "")
                    res = res.Where(c => c.name.IndexOf(
                        searchFilter,
                        StringComparison.OrdinalIgnoreCase) >= 0);
                if (sortAsc) res = res.OrderBy(c => c.price);
                else res = res.OrderByDescending(c => c.price);

                return res;

            }

            set
            {
                _SparesList = value;
            }
        }

 private bool sortAsc = true;

        private void RadioButton_Checked(object sender, RoutedEventArgs e)
        {
            sortAsc = (sender as RadioButton).Tag.ToString() == "1";
            Invalidate();
        }

 private void SearchFilter_KeyUp(object sender, KeyEventArgs e)
        {
            searchFilter = SearchFilterTextBox.Text;
            Invalidate();
        }

Скрины работы