//implementation of the singleton pattern public static DBclass GetInstance() { if (instance == null) { instance = new DBclass(); } return(instance); }
public MainPage() { InitializeComponent(); this.clients = new List <Client>(); //instance of the DBhandler using singleton pattern dbHandler = DBclass.GetInstance(); //loading DB LoadDB(); //the index is initialized with the number of the clients in the list after the DB loading this.index = clients.Count; //when the application ends a method is called for saving the data in the DB Application.ApplicationExit += new EventHandler(FinalSaveData); }