Ejemplo n.º 1
0
        private void DataBinding(List <VarorModel> list)
        {
            shoppingListListBoxBinding.DataSource = list;
            shoppingListListBox.DataSource        = shoppingListListBoxBinding;

            shoppingListListBox.ValueMember   = "Display";
            shoppingListListBox.DisplayMember = "Display";

            dyrasteBinding.DataSource = VarorProcessor.MostExpensive(list);
            dyrasteListBox.DataSource = dyrasteBinding;

            billigasteBinding.DataSource = VarorProcessor.Cheapest(list);
            billigasteListBox.DataSource = billigasteBinding;

            dyrasteListBox.ValueMember   = "Display";
            dyrasteListBox.DisplayMember = "Display";

            billigasteListBox.ValueMember   = "Display";
            billigasteListBox.DisplayMember = "Display";

            summaBinding.DataSource = VarorProcessor.Sum(list);
            summaListBox.DataSource = summaBinding;

            shoppingListListBoxBinding.ResetBindings(false);
            dyrasteBinding.ResetBindings(false);
            billigasteBinding.ResetBindings(false);
        }
Ejemplo n.º 2
0
        public static void OutputSumCheapestExpensive()
        {
            Console.WriteLine($"\nSumma i korgen: {VarorProcessor.Sum(VarorModel.listOfVaror)} kr");

            Console.WriteLine($"\nBilligaste vara/varor:");
            foreach (var item in VarorProcessor.Cheapest(VarorModel.listOfVaror))
            {
                Console.WriteLine($"{item.Name} - Pris: {item.Price}");
            }

            Console.WriteLine($"\nDyraste vara/varor:");
            foreach (var item in VarorProcessor.MostExpensive(VarorModel.listOfVaror))
            {
                Console.WriteLine($"{item.Name} - Pris: {item.Price}");
            }
        }