コード例 #1
0
        private void App_Startup(object sender, StartupEventArgs e)
        {
            // FOR Collection of Bicycles from Storage
            _bicycles = MY_Storage.ReadXml <ObservableCollection <Bicycle> >("bicycles.xml");
            //_bicycles = _bicycles.OrderBy(b => b.brandName);


            if (_bicycles == null)
            {
                _bicycles = new ObservableCollection <Bicycle>();
            }


            // FOR Collection of Customers from Storage
            _customers = MY_Storage.ReadXml <ObservableCollection <Customer> >("customers.xml");

            if (_customers == null)
            {
                _customers = new ObservableCollection <Customer>();
            }

            // FOR Collection of Bookings from Storage
            _bookings = MY_Storage.ReadXml <ObservableCollection <Booking> >("bookings.xml");

            if (_bookings == null)
            {
                _bookings = new ObservableCollection <Booking>();
            }
        }
コード例 #2
0
        private void App_Exit(object sender, ExitEventArgs e)
        {
            MY_Storage.WriteXml <ObservableCollection <Bicycle> >(_bicycles, "bicycles.xml");

            MY_Storage.WriteXml <ObservableCollection <Customer> >(_customers, "customers.xml");

            MY_Storage.WriteXml <ObservableCollection <Booking> >(_bookings, "bookings.xml");
        }