コード例 #1
0
        ///Search Combo Box
        private void ComboBoxFields_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            AppointList newFilterList = new AppointList();

            switch (comboBoxFields.SelectedIndex)
            {
            case 0: {
                var customer = from appointment in appointList
                               orderby appointment.CustData.CustType descending
                               select appointment;

                foreach (Appointment appt in customer)
                {
                    newFilterList.Add(appt);
                }
                Grid.ItemsSource = newFilterList;
                break;
            }

            case 1: {
                var Name = from appointment in appointList
                           orderby appointment.CustData.CustName descending
                           select appointment;
                foreach (Appointment appt in Name)
                {
                    newFilterList.Add(appt);
                }
                Grid.ItemsSource = newFilterList;
                break;
            }
            }
        }
コード例 #2
0
        public void Display()
        {
            Grid.DataContext = null;
            if (File.Exists(xmlfile))
            {
                appointList.Clear();

                Grid.Items.Refresh();
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(AppointList));
                StreamReader  streamReader  = new StreamReader(xmlfile);
                appointList = (AppointList)xmlSerializer.Deserialize(streamReader);
                streamReader.Close();

                Collection.Clear();

                foreach (Appointment appointment in appointList)
                {
                    Collection.Add(appointment);
                    AppointBox.Items.Remove(appointment.AppTime);
                }


                Grid.ItemsSource = Collection;
            }
        }
コード例 #3
0
        public MainWindow()
        {
            InitializeComponent();

            Validation.AddErrorHandler(this.AppointBox, TimeValidationError);
            Validation.AddErrorHandler(this.CustomerNameText, NameValidationError);
            Validation.AddErrorHandler(this.CustomerNumberText, NumberValidationError);
            Validation.AddErrorHandler(this.txtAge, AgeValidationError);

            Data        = new Hashtable();
            Data        = AddAppointment();
            DataContext = this;
            appointList = new AppointList();
            Collection  = new ObservableCollection <Appointment>();
            ArrayList arrayList = new ArrayList(Data.Keys);

            for (int i = 0; i < arrayList.Count; i++)
            {
                AppointBox.Items.Add(Data[i]);
            }
            Display();
        }