private void MainForm_Load(object sender, EventArgs e) { try { var props = Properties.Settings.Default; _connector = new ExchangeConnector.ExchangeConnector(props.email); string currentSite = props.currentSite; _locations = new LocationResolver(); _locations.Load("locationMap.csv"); _connector.LocationFilter = _locations.OfSite(currentSite).ToArray(); // filter locations by site _connector.Connect(); _myLocation = new Location { Site = props.currentSite, Building = props.currentBuilding, Floor = props.currentFloor }; } catch (Exception ex) { MessageBox.Show(ex.Message); Application.Exit(); } }
static Service() { try { LocationResolver.Load("locationMap.csv"); } catch (Exception ex) { Debug.WriteLine(ex.Message); ServiceHost.StatusMonitor?.SetError($"Unable to load location map: {ex.Message}"); ServiceHost.Log?.AddMessage($"Unable to load location map: {ex.Message}"); } }