// handlers for MainMenuDialog public void AddTenant_Handler() { // Add a tenant // Get the name and access code of the tenant to be added string firstName = null; string lastName = null; string accessCode = null; if (!terminalDevice.GetTenantInfo(ref firstName, ref lastName, ref accessCode)) { return; } BarredNumbersList bnl = new BarredNumbersList(); CallData cl = new CallData(); TenantData.AddTenant(new Tenant(firstName, lastName, accessCode, bnl, cl)); }
public void Restore_Handler() { List <SerializableKeyValuePair <string, object> > list = new List <SerializableKeyValuePair <string, object> >(); FileStream f = new FileStream("savefile.svf", FileMode.OpenOrCreate, FileAccess.Read); BinaryFormatter fo = new BinaryFormatter(); list = (List <SerializableKeyValuePair <string, object> >)fo.Deserialize(f); for (int i = 0; i < list.Count; i++) { Tenant toTenant = (Tenant)list[i].Value; Tenant toTenantData = new Tenant(toTenant.firstName, toTenant.lastName, toTenant.accessCode, toTenant.barredList, toTenant.callData); TenantData.AddTenant(toTenantData); } f.Close(); }