FullScreenPicture.xaml.cs 2.02 KB
Newer Older
Margaux Clerc's avatar
Margaux Clerc committed
1 2 3 4 5 6 7 8 9 10 11 12 13
/*
FullScreenPicture.xaml.cs
Copyright (C) 2015  Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
14
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
Margaux Clerc's avatar
Margaux Clerc committed
15 16 17 18 19 20 21 22
*/

using System;
using Linphone.Model;
using Windows.UI.Xaml.Navigation;
using Windows.UI.Xaml.Media.Imaging;
using Windows.UI.Xaml.Controls;

Erwan Croze's avatar
Erwan Croze committed
23
namespace Linphone.Views {
Margaux Clerc's avatar
Margaux Clerc committed
24 25 26
    /// <summary>
    /// Displays on full screen received or sent pictures
    /// </summary>
Erwan Croze's avatar
Erwan Croze committed
27
    public partial class FullScreenPicture : Page {
Margaux Clerc's avatar
Margaux Clerc committed
28 29
        private String _fileName;

Erwan Croze's avatar
Erwan Croze committed
30
        public FullScreenPicture() {
Margaux Clerc's avatar
Margaux Clerc committed
31 32 33
            InitializeComponent();
        }

Erwan Croze's avatar
Erwan Croze committed
34
        protected override async void OnNavigatedTo(NavigationEventArgs e) {
Margaux Clerc's avatar
Margaux Clerc committed
35 36
            base.OnNavigatedTo(e);

Erwan Croze's avatar
Erwan Croze committed
37
            if (e.Parameter is String) {
Margaux Clerc's avatar
Margaux Clerc committed
38 39
                _fileName = (e.Parameter as String);
                BitmapImage image = await Utils.ReadImageFromTempStorage(_fileName);
Erwan Croze's avatar
Erwan Croze committed
40
                if (image != null) {
Margaux Clerc's avatar
Margaux Clerc committed
41
                    Image.Source = image;
Erwan Croze's avatar
Erwan Croze committed
42
                } else {
Margaux Clerc's avatar
Margaux Clerc committed
43 44 45 46 47
                    //TODO ?
                }
            }
        }

Erwan Croze's avatar
Erwan Croze committed
48
        private async void Save_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) {
Margaux Clerc's avatar
Margaux Clerc committed
49 50 51 52 53
            bool result = await Utils.SavePictureInMediaLibrary(_fileName);
            //MessageBox.Show(result ? AppResources.FileSavingSuccess : AppResources.FileSavingFailure, AppResources.FileSaving, MessageBoxButton.OK); bool result = Utils.SavePictureInMediaLibrary(_fileName);
        }
    }
}