Example #1
0
 private void Precinct_Hold(object sender, System.Windows.Input.GestureEventArgs e)
 {
     if (sender is Pushpin)
     {
         Pushpin pinHeld = sender as Pushpin;
         if (pinHeld.DataContext is PrecinctPinModel)
         {
             PrecinctPinModel pinModel = pinHeld.DataContext as PrecinctPinModel;
             _PrecinctFilter = pinModel.PrecinctEntry.Name;
             Zoom            = 16.0; // Force zoom to be just outside of the "showPrecincts" range
             Map.ZoomLevel   = Zoom;
             Center          = pinModel.Center;
             ShowPushpins    = false;
             ShowStreets     = true;
             ShowPrecincts   = false;
             App.Log(string.Format("{0} precinct selected", _PrecinctFilter));
             wait.Set();
         }
     }
 }
Example #2
0
        private void LoadPrecincts()
        {
            VoterFileDataContext _voterDB = new mapapp.data.VoterFileDataContext(string.Format(mapapp.data.VoterFileDataContext.DBConnectionString, App.thisApp._settings.DbFileName));

            System.Diagnostics.Debug.Assert(_voterDB.DatabaseExists());

            if (!(App.thisApp._settings.DbStatus == DbState.Loaded))
            {
                App.Log("Database not ready to load precincts yet.");
                return;
            }
            IEnumerable <PrecinctTableEntry> precincts = (from precinct in _voterDB.Precincts select precinct);

            foreach (PrecinctTableEntry precinct in precincts)
            {
                App.Log(" Adding precinct: " + precinct.Name);
                PrecinctPinModel pPin = new PrecinctPinModel(precinct);
                Precincts.Add(pPin);
            }
            _voterDB.Dispose();
        }