예제 #1
0
        private void GeneratePhoneListExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                List <TelEntry> telList = new List <TelEntry>();

                foreach (var item in this.Data)
                {
                    if (item.Visible)
                    {
                        var telEntry = new TelEntry(item);

                        if (telEntry.Data.Count != 0)
                        {
                            telList.Add(telEntry);
                        }
                    }
                }

                var lGen = new ListGenerator(telList, Groups[lbGroups.SelectedIndex].GroupName, "Telefon", Groups[lbGroups.SelectedIndex].Design);
                lGen.GenerateOutput();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Die Telefonliste konnte nicht erstellt werden."
                                + Environment.NewLine + Environment.NewLine + "Fehler: " + ex.Message,
                                App.PROGRAM_NAME, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #2
0
        private void GenerateAgeListExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            List <AgeEntry> ageList = new List <AgeEntry>();

            foreach (var item in this.Data)
            {
                if (item.Visible)
                {
                    ageList.Add(new AgeEntry(item));
                }
            }

            ageList.Sort((a1, a2) =>
            {
                var result = a1.Age.CompareTo(a2.Age);
                return(result == 0 ? a1.Name.CompareTo(a2.Name) : result);
            });

            var lGen = new ListGenerator(ageList, Groups[lbGroups.SelectedIndex].GroupName, "Alter", Groups[lbGroups.SelectedIndex].Design);

            lGen.GenerateOutput();
        }