Ejemplo n.º 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;
                }
                                         );
            }
        }
Ejemplo n.º 2
0
 private async void OnUpdateFinished(object sender, UpdateFinishedEventArgs e)
 {
     if (e.Success)
     {
         await MainWindow.ShowLoginPageAsync().ConfigureAwait(false);
     }
     else
     {
         await Application.Current.Dispatcher.InvokeAsync(() =>
         {
             CloseButton.IsEnabled = true;
         });
     }
 }
Ejemplo n.º 3
0
		public static void UpdateFromFile(string xmlString)
		{
			WriteLine ("### Updating all data from local file");

			// make this a critical section to ensure that access is serial
			lock (locker) {
				isUpdating = true;
				UpdateStarted (null, EventArgs.Empty);
				var ea = new UpdateFinishedEventArgs (UpdateType.SeedData, false);
				
				var c = MWC.SAL.MWCSiteParser.DeserializeConference (xmlString);
				if (c != null) {
					if (SaveToDatabase (c)) {
						ea.Success = true;
					}
				}
				UpdateFinished (null, ea);
				isUpdating = false;
			}
		}
Ejemplo n.º 4
0
        public static void UpdateFromFile(string xmlString)
        {
            WriteLine("### Updating all data from local file");

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

                var c = MWC.SAL.MWCSiteParser.DeserializeConference(xmlString);
                if (c != null)
                {
                    if (SaveToDatabase(c))
                    {
                        ea.Success = true;
                    }
                }
                UpdateFinished(null, ea);
                isUpdating = false;
            }
        }
Ejemplo n.º 5
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;
					}
				);
			}
		}