コード例 #1
0
		public ConferenceDetailViewModel (Conference conference, ISchedulesService schedulesService, ISettingsService settingsService)
		{
			Conference = conference;
			_schedulesService = schedulesService;
			_settingsService = settingsService;

			Name = conference.Name;
			Description = conference.Description;
			StartDate = conference.StartDate.Value;
			EndDate = conference.EndDate;

			this.AddToScheduleCommand = new RelayCommand(async () => await this.AddToSchedule(Priority.UserInitiated), CanAddToSchedule);
            this.RemoveFromScheduleCommand = new RelayCommand(async () => await this.RemoveFromSchedule(Priority.UserInitiated), CanRemoveFromSchedule);
        }
コード例 #2
0
		private async void GetImage(Conference conference)
		{
			if (!string.IsNullOrWhiteSpace (conference.ImageUrl)) {
				try {

					var imageService = ServiceLocator.Current.GetInstance<IImageService>();
					var localPath = await imageService.GetConferenceImagePath(conference);

					//Resizing image is time costing, using async to avoid blocking the UI thread
					UIImage image = null;
					CGSize imageViewSize = conferenceImage.Frame.Size;

					await Task.Run (() => {
						image = UIImage.FromFile (localPath).Scale (imageViewSize);
					});


					conferenceImage.Image = image;

				} catch (Exception e) {
					Insights.Report (e);
				}
			}
		}