コード例 #1
0
ファイル: Program.cs プロジェクト: votinginfoproject/mongoose
        public static void Main(String[] args)
        {
            DateTime oScriptStart = DateTime.UtcNow;
            NameValueCollection oVipSettings = new NameValueCollection();
            NameValueCollection oXmlSettings = ConfigurationManager.GetSection("xmlWriterSettings") as NameValueCollection;
            //NameValueCollection oElectionAdminSettings = ConfigurationManager.GetSection("electionOfficial") as NameValueCollection;

            oVipSettings.Add("ScriptStart", oScriptStart.ToString("yyyy-MM-ddTHH:mm:ss"));
            oVipSettings.Add(ConfigurationManager.GetSection("vipSettings") as NameValueCollection);

            FeedWriter oFeedWriter = new FeedWriter(
                oVipSettings.Get("FilePath"),
                oVipSettings.Get("StateFIPS"),
                oXmlSettings
            );

            oFeedWriter.WriteStartElement("vip_object");

            oFeedWriter.WriteHeader(oVipSettings);

            // this may not be necessary if the election_officials are stored in the db
            //oFeedWriter.WriteElementFromConfig("election_official", oElectionAdminSettings);

            try {

                    oFeedWriter.WritePollingPlaces();
                    oFeedWriter.WriteStreetSegments();
                    oFeedWriter.WritePrecincts();
                    oFeedWriter.WritePrecinctSplits();
                    oFeedWriter.WriteLocalities();

            } catch (Exception ex) {
                // TODO: Write success or failure to a text file
                Console.WriteLine(ex.Message.ToString());
            }

            oFeedWriter.WriteEndElement();
        }
コード例 #2
0
        protected virtual async Task ReadFeedDataAsync()
        {
            try
            {
                if (_apiClient == null)
                {
                    return;
                }

                var newFeedData = await _apiClient.GetLiveFeedAsync(EventSettings);

                if (_feedData != null && _feedData.elapsed_time == newFeedData.elapsed_time)
                {
                    return;
                }

                _feedData     = newFeedData;
                _liveFlagData = await _apiClient.GetLiveFlagDataAsync();

                _pointsFeedData = await _apiClient.GetLivePointsAsync(EventSettings);

#if DEBUG
                FeedWriter.LogFeedData(EventSettings, _feedData.lap_number, _feedData.ToString());
#endif

                ReadLapTimes(_feedData);

                DisplayFeedData(_feedData, _liveFlagData, _pointsFeedData);
            }
            catch (Exception ex)
            {
                ExceptionHandler("Error reading feed", ex);
            }
            finally
            {
                this.ResumeLayout(true);
            }
        }
コード例 #3
0
 public FeedController(IHostingEnvironment env)
 {
     _helper = new PackageHelper(env.WebRootPath);
     _feed   = new FeedWriter();
 }