Example #1
0
        /// <summary>
        /// Updates all conference data from the cloud. Sets UpdateManager.IsUpdating
        /// to true while updating. serialized, thread-safe access.
        /// (although, the webclient request is async...)
        /// </summary
        public static void UpdateConference()
        {
            WriteLine("### Updating all data from cloud; _isUpdating = true");

            // make this a critical section to ensure that access is serial
            lock (locker) {
                isUpdating = true;
                UpdateStarted(null, EventArgs.Empty);
                var ea = new UpdateFinishedEventArgs(UpdateType.Conference, false);

                var siteParser = new MWC.SAL.MWCSiteParser();
                siteParser.GetConference(Constants.ConferenceDataUrl,
                                         delegate  {
                    var c = siteParser.ConferenceData;

                    if (c == null)
                    {
                        WriteLine("xxx No conference data downloaded, skipping");
                    }
                    else
                    {
                        if (SaveToDatabase(c))
                        {
                            ea.Success = true;
                        }
                    }
                    UpdateFinished(null, ea);
                    isUpdating = false;
                }
                                         );
            }
        }
Example #2
0
		/// <summary>
		/// Updates all conference data from the cloud. Sets UpdateManager.IsUpdating
		/// to true while updating. serialized, thread-safe access.
		/// (although, the webclient request is async...)
		/// </summary
		public static void UpdateConference()
		{
			WriteLine ("### Updating all data from cloud; _isUpdating = true");
				
			// make this a critical section to ensure that access is serial
			lock (locker) {
				isUpdating = true;
				UpdateStarted (null, EventArgs.Empty);
				var ea = new UpdateFinishedEventArgs (UpdateType.Conference, false);

				var siteParser = new MWC.SAL.MWCSiteParser();
				siteParser.GetConference (Constants.ConferenceDataUrl,  
					delegate  {
						var c = siteParser.ConferenceData;

						if (c == null) {
							WriteLine ("xxx No conference data downloaded, skipping");
						} else {
							if (SaveToDatabase (c)) {
								ea.Success = true;
							}
						}
						UpdateFinished (null, ea);
						isUpdating = false;
					}
				);
			}
		}