public MainWindow() { instance = this; InitializeComponent(); winMain.Title += " " + VERSION; LoadAll(); //GlobalAddressBook = new AddressBook();//AddressBook.LoadFromSQL(); //GlobalBusinessDaysCalculator = new BusinessDaysCalculator(); cbVehicle.ItemsSource = CurrentOptions.Vehicles; windowOptions = new OptionsWindow(); windowWaypoints = new WaypointsWindow(this); windowBusinessDays = new BusinessDaysWindow(this); windowAbout = new AboutWindow(); if (CurrentOptions.Vehicles.Count > 0) { SyncVehicleFromData(); cbVehicle.SelectedIndex = CurrentOptions.SelectedVehicle; } tripList = new TripListSheet(); tripLists = new List <TripTicket>(); dpReceiptDate.Text = DateTime.Now.ToShortDateString(); dgTripList.ItemsSource = tripList.Waypoints; EXE_DIRECTORY = GetExeDirectory(); }
public static TripListSheet Load(string filename) { TripListSheet loaded = null; if (File.Exists(filename)) { using (FileStream fs = new FileStream(filename, FileMode.Open)) { XmlSerializer xser = new XmlSerializer(typeof(TripListSheet)); loaded = (TripListSheet)xser.Deserialize(fs); fs.Close(); } } else { loaded = new TripListSheet(); } return(loaded); }
private void MnuLoadTripListSheet_Click(object sender, RoutedEventArgs e) { tripList = TripListSheet.Load(EXE_DIRECTORY + "/tripList.xml"); dgTripList.ItemsSource = tripList.Waypoints; }