Пример #1
0
 private void setImage_btn_Click(object sender, RoutedEventArgs e)
 {
     if (CustomBackgroundImage != null && !CustomBackgroundImage.selected)
     {
         BackgroundImageCache.setCustomBackgroundImage();
         //chatDetailsDummy_cdc.loadBackgrundImage();
     }
 }
Пример #2
0
        //--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\
        #region --Set-, Get- Methods--


        #endregion
        //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
        #region --Misc Methods (Public)--


        #endregion

        #region --Misc Methods (Private)--
        private async Task browseBackgroundAsync()
        {
            FileOpenPicker picker = new FileOpenPicker
            {
                ViewMode = PickerViewMode.Thumbnail,
                SuggestedStartLocation = PickerLocationId.PicturesLibrary
            };

            picker.FileTypeFilter.Add(".jpg");
            picker.FileTypeFilter.Add(".jpeg");
            picker.FileTypeFilter.Add(".png");

            StorageFile file = await picker.PickSingleFileAsync();

            if (file != null)
            {
                string path = await BackgroundImageCache.saveAsCustomBackgroundImageAsync(file);

                if (path != null)
                {
                    BackgroundImageCache.setCustomBackgroundImage();
                    CustomBackgroundImage = null;
                    CustomBackgroundImage = BackgroundImageCache.customBackgroundImage;
                    //chatDetailsDummy_cdc.loadBackgrundImage();
                    Logger.Info("Custom background image set to: " + file.Path);
                }
                else
                {
                    showInfo("Failed to pick image!");
                    Logger.Warn("Failed to set image as background image. Path is null!");
                }
            }
            else
            {
                showInfo("Selection canceled!");
            }
        }