public static Notification GetNotification(Context context, MedicationDosage medication, DateTime occurrenceDate, Intent notificationIntent) { var builder = new NotificationCompat.Builder(context); builder.SetContentTitle(medication.Name); builder.SetTicker($"[PILLER] {medication.Name}"); builder.SetSmallIcon(Resource.Drawable.pill64x64); builder.SetSound(RingtoneManager.GetDefaultUri(RingtoneType.Alarm)); builder.SetPriority((int)NotificationPriority.High); builder.SetVisibility((int)NotificationVisibility.Public); // visible on locked screen RemoteViews contentView = new RemoteViews(context.PackageName, Resource.Layout.customNotification); contentView.SetTextViewText(Resource.Id.titleTextView, medication.Name); contentView.SetTextViewText(Resource.Id.descTextView, medication.Dosage + " - " + FormatOccurrence(occurrenceDate)); if (medication?.ThumbnailName == null) { contentView.SetImageViewBitmap(Resource.Id.imageView, BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.pill64x64)); } else { ImageLoaderService imageLoader = Mvx.Resolve <ImageLoaderService>(); byte[] array = imageLoader.LoadImage(medication.ThumbnailName); contentView.SetImageViewBitmap(Resource.Id.imageView, BitmapFactory.DecodeByteArray(array, 0, array.Length)); } RemoteViews contentBigView = new RemoteViews(context.PackageName, Resource.Layout.customBigNotification); contentBigView.SetTextViewText(Resource.Id.titleTextView, medication.Name); contentBigView.SetTextViewText(Resource.Id.descTextView, medication.Dosage + " - " + FormatOccurrence(occurrenceDate)); PendingIntent intent = PendingIntent.GetActivity(context, 0, notificationIntent, 0); contentBigView.SetOnClickPendingIntent(Resource.Id.okButton, intent); intent = PendingIntent.GetActivity(context, 0, notificationIntent, 0); contentBigView.SetOnClickPendingIntent(Resource.Id.noButton, intent); intent = PendingIntent.GetActivity(context, 0, notificationIntent, 0); contentBigView.SetOnClickPendingIntent(Resource.Id.laterButton, intent); if (medication?.ThumbnailName == null) { contentBigView.SetImageViewBitmap(Resource.Id.imageView, BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.pill64x64)); } else { ImageLoaderService imageLoader = Mvx.Resolve <ImageLoaderService>(); byte[] array = imageLoader.LoadImage(medication.ThumbnailName); contentBigView.SetImageViewBitmap(Resource.Id.imageView, BitmapFactory.DecodeByteArray(array, 0, array.Length)); } builder.SetCustomContentView(contentView); builder.SetCustomBigContentView(contentBigView); return(builder.Build()); }
public FormLoad(ImageLoaderService imageLoaderService, UserInteractionService interactionService) { _imageLoaderService = imageLoaderService; _interactionService = interactionService; InitializeComponent(); _baseSearchPath = null; }
public PostsController(PostsDbContext dbContext, IConfiguration configuration, ImageLoaderService service) { this._dbContext = dbContext; _configuration = configuration; _facebookService = new FacebookService(new FacebookClient()); _imgLoader = service; }
public FileBrowser(ApplicationSettingsService applicationSettingsService, ImageLoaderService imageLoaderService, Autofac.ILifetimeScope scope) { _applicationSettingsService = applicationSettingsService; _applicationSettingsService.LoadSettings(); _imageLoaderService = imageLoaderService; _scope = scope; InitializeComponent(); }
private async void ImageGalleryPage_OnLoaded(object sender, RoutedEventArgs e) { var data = await ImageLoaderService.GetImageGalleryDataAsync((await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures)).SaveFolder); if (data != null) { imageGridView.ItemsSource = data; } }
public FormThumbnailView(FormAddBookmark formAddBookmark, ApplicationSettingsService applicationSettingsService, ImageCacheService imageCacheService, ThumbnailService thumbnailService, ImageLoaderService imageLoaderService) { _formAddBookmark = formAddBookmark; _applicationSettingsService = applicationSettingsService; _imageCacheService = imageCacheService; _thumbnailService = thumbnailService; _imageLoaderService = imageLoaderService; _thumbnailSize = ValidateThumbnailSize(_applicationSettingsService.Settings.ThumbnailSize); _maxThumbnails = _applicationSettingsService.Settings.MaxThumbnails; _applicationSettingsService.OnSettingsSaved += _applicationSettingsService_OnSettingsSaved; _thumbnailService.LoadThumbnailDatabase(); InitializeComponent(); }
private async void ImageGalleryPage_OnLoaded(object sender, RoutedEventArgs e) { if (SelectedContentFolder != null) { SelectedContentFolder.ContentsChanged += SelectedContentFolder_ContentsChanged; Source = await ImageLoaderService.GetImageGalleryDataAsync(SelectedContentFolder); if (Source != null) { imagesGridView.ItemsSource = Source; } } }
public FormImageView(int id, FormAddBookmark formAddBookmark, BookmarkManager bookmarkManager, ApplicationSettingsService applicationSettingsService, ImageCacheService imageCache, ImageLoaderService imageLoaderService) { InitializeComponent(); _imageViewFormInfo = new ImageViewFormImageInfo(this, null, 0); _observers = new List <IObserver <ImageViewFormInfoBase> >(); pictureBox.Paint += pictureBox_Paint; FormId = id; _formAddBookmark = formAddBookmark; _bookmarkManager = bookmarkManager; _applicationSettingsService = applicationSettingsService; _imageCache = imageCache; _imageLoaderService = imageLoaderService; _lastFormState = WindowState; ReloadSettings(); }
public FormMain(FormAddBookmark formAddBookmark, BookmarkService bookmarkService, FormSettings formSettings, ApplicationSettingsService applicationSettingsService, ImageCacheService imageCacheService, ImageLoaderService imageLoaderService, ILifetimeScope scope, UserInteractionService interactionService) { _formAddBookmark = formAddBookmark; _bookmarkService = bookmarkService; _formSettings = formSettings; _applicationSettingsService = applicationSettingsService; _applicationSettingsService.LoadSettings(); _imageCacheService = imageCacheService; _imageLoaderService = imageLoaderService; _scope = scope; _interactionService = interactionService; InitializeComponent(); _imageViewFormList = new List <FormImageView>(); _windowTitle = "Image Viewer - " + Application.ProductVersion; }
public async Task AccessFolder(FolderItem folder) { if (folder is null) { return; } if (SelectedContentFolder != folder) { if (SelectedContentFolder is object) { SelectedContentFolder.ContentsChanged -= SelectedContentFolder_ContentsChanged; } SelectedContentFolder = folder; SelectedContentFolder.ContentsChanged += SelectedContentFolder_ContentsChanged; } Source = await ImageLoaderService.GetImageGalleryDataAsync(SelectedContentFolder); if (Source != null) { imagesGridView.ItemsSource = Source; } }
public static Notification GetNotification(Context context, MedicationDosage medication, NotificationOccurrence notificationOccurrence, Intent notificationIntent) { var builder = new NotificationCompat.Builder(context); builder.SetContentTitle(medication.Name); builder.SetTicker($"[PILLER] {medication.Name}"); builder.SetSmallIcon(Resource.Drawable.pill64x64); var data = JsonConvert.DeserializeObject <SettingsData>(Mvx.Resolve <ISettings>().GetValue <string>(SettingsData.Key)); Android.Net.Uri ring = Android.Net.Uri.Parse(data.RingUri); builder.SetSound(ring); builder.SetPriority((int)NotificationPriority.High); builder.SetVisibility((int)NotificationVisibility.Public); // visible on locked screen RemoteViews contentView = new RemoteViews(context.PackageName, Resource.Layout.customNotification); contentView.SetTextViewText(Resource.Id.titleTextView, medication.Name + " " + medication.Dosage); contentView.SetTextViewText(Resource.Id.descTextView, FormatOccurrence(notificationOccurrence.OccurrenceDateTime)); //contentView.SetImageViewBitmap(Resource.Id.iconView, BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.pill64x64)); RemoteViews contentBigView = new RemoteViews(context.PackageName, Resource.Layout.customBigNotification); contentBigView.SetTextViewText(Resource.Id.titleTextView, medication.Name + " " + medication.Dosage); contentBigView.SetTextViewText(Resource.Id.descTextView, FormatOccurrence(notificationOccurrence.OccurrenceDateTime)); if (medication?.ThumbnailName == null) { var roundedImage = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.pill64x64); contentView.SetImageViewBitmap(Resource.Id.imageView, roundedImage); contentBigView.SetImageViewBitmap(Resource.Id.iconView, roundedImage); } else { var imageLoader = Mvx.Resolve <ImageLoaderService>(); byte[] array = imageLoader.LoadImage(medication.ThumbnailName); contentView.SetImageViewBitmap(Resource.Id.imageView, BitmapFactory.DecodeByteArray(array, 0, array.Length)); contentBigView.SetImageViewBitmap(Resource.Id.imageView, BitmapFactory.DecodeByteArray(array, 0, array.Length)); } var medicationId = medication.Id.Value; var notificationId = notificationOccurrence.Id.Value; System.Diagnostics.Debug.Write(notificationId); Intent okIntent = new Intent(notificationIntent); Intent noIntent = new Intent(notificationIntent); Intent laterIntent = new Intent(notificationIntent); notificationIntent.PutExtra(NotificationPublisher.MEDICATION_ID, medicationId); okIntent.PutExtra(NotificationPublisher.MEDICATION_ID, medicationId); noIntent.PutExtra(NotificationPublisher.MEDICATION_ID, medicationId); laterIntent.PutExtra(NotificationPublisher.MEDICATION_ID, medicationId); notificationIntent.PutExtra(NotificationPublisher.NOTIFICATION_ID, notificationId); okIntent.PutExtra(NotificationPublisher.NOTIFICATION_ID, notificationId); noIntent.PutExtra(NotificationPublisher.NOTIFICATION_ID, notificationId); laterIntent.PutExtra(NotificationPublisher.NOTIFICATION_ID, notificationId); okIntent.SetAction("OK"); noIntent.SetAction("LATER"); //laterIntent.SetAction("LATER"); PendingIntent ok_intent = PendingIntent.GetBroadcast(context, Environment.TickCount, okIntent, 0); contentBigView.SetOnClickPendingIntent(Resource.Id.okButton, ok_intent); PendingIntent no_intent = PendingIntent.GetBroadcast(context, Environment.TickCount, noIntent, 0); contentBigView.SetOnClickPendingIntent(Resource.Id.noButton, no_intent); //PendingIntent later_intent = PendingIntent.GetBroadcast(context, Environment.TickCount, laterIntent, 0); //contentBigView.SetOnClickPendingIntent(Resource.Id.laterButton, later_intent); //contentBigView.SetImageViewBitmap(Resource.Id.imageView, BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.pill64x64)); if (medication?.ThumbnailName == null) { contentBigView.SetImageViewBitmap(Resource.Id.imageView, BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.pill64x64)); } else { ImageLoaderService imageLoader = Mvx.Resolve <ImageLoaderService>(); byte[] array = imageLoader.LoadImage(medication.ThumbnailName); contentBigView.SetImageViewBitmap(Resource.Id.imageView, BitmapFactory.DecodeByteArray(array, 0, array.Length)); } builder.SetCustomContentView(contentView); builder.SetCustomBigContentView(contentBigView); var notification = builder.Build(); // action upon notification click var notificationMainAction = new Intent(context, typeof(NotificationPublisher)); notificationMainAction.PutExtra(NotificationPublisher.MEDICATION_ID, medicationId); notificationMainAction.PutExtra(NotificationPublisher.NOTIFICATION_ID, notificationId); notificationMainAction.SetAction("GO_TO_MEDICATION"); var flags = (PendingIntentFlags)((int)PendingIntentFlags.CancelCurrent | (int)NotificationFlags.AutoCancel); notification.ContentIntent = PendingIntent.GetBroadcast(context, notificationId, notificationMainAction, flags); // action upon notification dismiss var notificationDismissAction = new Intent(context, typeof(NotificationPublisher)); notificationDismissAction.PutExtra(NotificationPublisher.MEDICATION_ID, medicationId); notificationDismissAction.PutExtra(NotificationPublisher.NOTIFICATION_ID, notificationId); notificationDismissAction.SetAction("NOTIFCATION_DISMISS"); //var flags = (PendingIntentFlags)((int)PendingIntentFlags.CancelCurrent | (int)NotificationFlags.AutoCancel); notification.DeleteIntent = PendingIntent.GetBroadcast(context, notificationId, notificationDismissAction, flags); return(notification); }
public ImageReferenceCollection(List <int> randomImagePosList, ImageLoaderService imageLoaderService) { _randomImagePosList = randomImagePosList; _imageLoaderService = imageLoaderService; }