//Daten in ListView loaded private async Task DatenLoaded() { var loader = new Windows.ApplicationModel.Resources.ResourceLoader(); ObservableCollection <ListBalance> listBalance = new ObservableCollection <ListBalance>(); listBalance = await ListBalance.GetBalanceListeAsync(ListViewDaten, datum.Monat, datum.Year); var listView = new ListView(); if (listBalance.Count == 0) { ListViewItem listItem = GetNotDaten(); listView.IsItemClickEnabled = false; listView.Items.Add(listItem); gridListView.Children.Add(listView); BalanceListView.ItemsSource = listBalance.OrderBy(item => item.Datum.TimeOfDay); } else { //zeigt auf verschiedene Sprachen Cost und Incomen if (ListViewDaten == CategoryCostIncomen.Cost) { TxtCostsIncomen.Text = loader.GetString("TxtCostsHome"); BalanceListView.ItemsSource = listBalance.OrderBy(item => item.Datum.TimeOfDay); } else { TxtCostsIncomen.Text = loader.GetString("TxtIncomesHome"); BalanceListView.ItemsSource = listBalance.OrderBy(item => item.Datum.TimeOfDay); } } }
//Daten in ListView loaded private async Task DatenLoaded() { ObservableCollection <ListBalance> listBalance = new ObservableCollection <ListBalance>(); listBalance = await ListBalance.GetBalanceListeAsync(datePicker.Date.Date); BalanceListView.ItemsSource = listBalance.OrderBy(item => item.Datum.TimeOfDay); }
private async Task GetDatenAsync(string category, Grid gridCategory, ListView listViewCategory) { listBalance = new ObservableCollection <ListBalance>(); var listView = new ListView(); //If zweit Daten asgewahlt if ((bool)index.GetDatumBereich()) { listBalance = await ListBalance.GetBalanceListeAsync(index.GetErsteDatum(), index.GetZweiteDatum(), category); if (listBalance.Count == 0) { ListViewItem listItem = GetNotDaten(); listView.IsItemClickEnabled = false; listView.Items.Add(listItem); gridCategory.Children.Add(listView); listViewCategory.ItemsSource = listBalance.OrderBy(item => item.Datum.TimeOfDay); } else { listViewCategory.ItemsSource = listBalance.OrderBy(item => item.Datum.TimeOfDay); } } //if nur eine Date ausgewahlt else { listBalance = await ListBalance.GetBalanceListeAsync(index.GetErsteDatum(), index.GetZweiteDatum(), category); if (listBalance.Count == 0) { ListViewItem listItem = GetNotDaten(); listView.IsItemClickEnabled = false; listView.Items.Add(listItem); gridCategory.Children.Add(listView); listViewCategory.ItemsSource = listBalance.OrderBy(item => item.Datum.TimeOfDay); } else { listViewCategory.ItemsSource = listBalance.OrderBy(item => item.Datum.TimeOfDay); } } }
//Erforderlich => Aussgaben mit bestimmten Farbe markieren private void BalanceListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { ListBalance list = args.Item as ListBalance; //1 => Red if (list.UnderCategory == FixkostenUnderCategory.Bank.ToString() || list.UnderCategory == LebensmittelUnderCategory.Meat.ToString() || list.UnderCategory == AutoUnderCategory.Fuel.ToString() || list.UnderCategory == UnterhaltungUnderCategory.Cafe.ToString() || list.UnderCategory == VerkehrUnderCategory.Trainticket.ToString() || list.UnderCategory == PersonalUnderCategory.Accessoires.ToString() || list.Category == CategoryNamenCosts.OtherCosts.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 229, 20, 0)); } //2 => Braun else if (list.UnderCategory == FixkostenUnderCategory.Rental.ToString() || list.UnderCategory == LebensmittelUnderCategory.Meer.ToString() || list.UnderCategory == AutoUnderCategory.Repair.ToString() || list.UnderCategory == UnterhaltungUnderCategory.Pizza.ToString() || list.UnderCategory == VerkehrUnderCategory.Singleticket.ToString() || list.UnderCategory == PersonalUnderCategory.Hairdressing.ToString() || list.Category == CategoryNamenCosts.Education.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 160, 80, 0)); } //3 => Green else if (list.UnderCategory == FixkostenUnderCategory.Groundshuld.ToString() || list.UnderCategory == LebensmittelUnderCategory.FruitVegetabele.ToString() || list.UnderCategory == AutoUnderCategory.Wash.ToString() || list.UnderCategory == UnterhaltungUnderCategory.Restaurant.ToString() || list.UnderCategory == VerkehrUnderCategory.Taxi.ToString() || list.UnderCategory == PersonalUnderCategory.Dress.ToString() || list.Category == CategoryNamenIncomen.Salary.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 51, 153, 51)); } //4 => Rosa else if (list.UnderCategory == FixkostenUnderCategory.Extracosts.ToString() || list.UnderCategory == LebensmittelUnderCategory.Bakery.ToString() || list.UnderCategory == AutoUnderCategory.InsuranceAuto.ToString() || list.UnderCategory == UnterhaltungUnderCategory.Kino.ToString() || list.UnderCategory == VerkehrUnderCategory.Flightticket.ToString() || list.UnderCategory == PersonalUnderCategory.Cosmetics.ToString() || list.Category == CategoryNamenCosts.Apps.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 230, 113, 184)); } //5 => HellGreen else if (list.UnderCategory == FixkostenUnderCategory.TV.ToString() || list.UnderCategory == LebensmittelUnderCategory.Milk.ToString() || list.UnderCategory == AutoUnderCategory.Fine.ToString() || list.UnderCategory == UnterhaltungUnderCategory.Theatre.ToString() || list.UnderCategory == VerkehrUnderCategory.Monthlyticket.ToString() || list.UnderCategory == PersonalUnderCategory.Medicine.ToString() || list.Category == CategoryNamenIncomen.OtherIncomes.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 162, 193, 57)); } //6 => DarkRed else if (list.UnderCategory == FixkostenUnderCategory.Internet.ToString() || list.UnderCategory == LebensmittelUnderCategory.Sweetnes.ToString() || list.UnderCategory == AutoUnderCategory.OtherAuto.ToString() || list.UnderCategory == UnterhaltungUnderCategory.OtherEntertainment.ToString() || list.UnderCategory == VerkehrUnderCategory.OtherTransport.ToString() || list.UnderCategory == PersonalUnderCategory.Wellness.ToString() || list.Category == CategoryNamenCosts.OtherCosts.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 216, 0, 115)); } //7 => Orange else if (list.UnderCategory == FixkostenUnderCategory.Telefons.ToString() || list.UnderCategory == LebensmittelUnderCategory.Drinks.ToString() || list.UnderCategory == PersonalUnderCategory.OtherPrivate.ToString() || list.Category == CategoryNamenCosts.Vacation.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 240, 150, 9)); } //8 => Violet else if (list.UnderCategory == FixkostenUnderCategory.InsuranceFix.ToString() || list.UnderCategory == LebensmittelUnderCategory.OtherFoods.ToString() || list.Category == CategoryNamenCosts.House.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 162, 0, 255)); } //9 => Yellow else if (list.UnderCategory == FixkostenUnderCategory.Tax.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 254, 190, 23)); } //10 => Grey else if (list.UnderCategory == FixkostenUnderCategory.OtherFix.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 208, 179, 136)); } }
//Erforderlich => Aussgaben mit bestimmten Farbe markieren private void BalanceListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { ListBalance list = args.Item as ListBalance; //1 => Red if (list.Category == CategoryNamenCosts.Fixed.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 229, 20, 0)); } //2 => Braun else if (list.Category == CategoryNamenCosts.Foods.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 160, 80, 0)); } //3 => Green else if (list.Category == CategoryNamenIncomen.Salary.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 51, 153, 51)); } //4 => DarkKhaki #BDB76B 189, 183, 107 else if (list.Category == CategoryNamenCosts.Auto.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 189, 183, 107)); } //5 => HellGreen else if (list.Category == CategoryNamenIncomen.OtherIncomes.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 162, 193, 57)); } //6 => DarkRed else if (list.Category == CategoryNamenCosts.Education.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 216, 0, 115)); } //7 => Orange else if (list.Category == CategoryNamenCosts.Apps.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 240, 150, 9)); } //8 => Violet else if (list.Category == CategoryNamenCosts.Vacation.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 162, 0, 255)); } //9 => Yellow else if (list.Category == CategoryNamenCosts.Entertainment.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 254, 190, 23)); } //10 => Grey else if (list.Category == CategoryNamenCosts.House.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 208, 179, 136)); } //11 => SandyBrown #F4A460 244, 164, 96 else if (list.Category == CategoryNamenCosts.Transport.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 244, 164, 96)); } //12 => Goldenrod #DAA520 218, 165, 32 else if (list.Category == CategoryNamenCosts.Private.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 218, 165, 32)); } //13 => Tomato #FF6347 255, 99, 71 else if (list.Category == CategoryNamenCosts.OtherCosts.ToString()) { args.ItemContainer.Background = new SolidColorBrush(Color.FromArgb(255, 255, 99, 71)); } }