Exemplo n.º 1
0
 public static void Serialize_b(ListOfBrands lb)
 {
     using (FileStream fs = new FileStream(file_brand, FileMode.Create))
     {
         xs_brand.Serialize(fs, lb);
     }
 }
Exemplo n.º 2
0
        public static ListOfBrands Deserialize_b(ListOfBrands lb)
        {
            ListOfBrands data = new ListOfBrands();

            using (FileStream fs = new FileStream(file_brand, FileMode.Open))
            {
                data = (ListOfBrands)xs_brand.Deserialize(fs);
            }
            return(data);
        }
Exemplo n.º 3
0
 public MainWindow()
 {
     InitializeComponent();
     if (File.Exists("../../brand.xml"))
     {
         lb = Serialization.Deserialize_b(lb);
         foreach (var item in lb.Brands)
         {
             listBoxBrand.Items.Add(item.Name.ToString());
         }
     }
 }
Exemplo n.º 4
0
 private void Search_Click(object sender, RoutedEventArgs e)
 {
     ListBoxSearch.Items.Clear();
     lb = Serialization.Deserialize_b(lb);
     if (TextBoxSearch.Text != "")
     {
         foreach (var item in lb.Brands)
         {
             if (item.Name.Contains(TextBoxSearch.Text))
             {
                 ListBoxSearch.Items.Add(item.Name);
             }
         }
     }
     else
     {
         MessageBox.Show("Введите поисковый запрос");
     }
 }