CodecsSettings.xaml.cs 2.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Linphone.Resources;
using Linphone.Model;

namespace Linphone.Views
{
    public partial class CodecsSettings : PhoneApplicationPage
    {
        private SettingsManager _appSettings = new SettingsManager();

        public CodecsSettings()
        {
            InitializeComponent();
            BuildLocalizedApplicationBar();

            AMRNB.IsChecked = _appSettings.AMRNB;
            AMRWB.IsChecked = _appSettings.AMRWB;
            Speex16.IsChecked = _appSettings.Speex16;
            Speex8.IsChecked = _appSettings.Speex8;
            PCMU.IsChecked = _appSettings.PCMU;
            PCMA.IsChecked = _appSettings.PCMA;
Sylvain Berfini's avatar
Sylvain Berfini committed
30
            G722.IsChecked = _appSettings.G722;
31
            ILBC.IsChecked = _appSettings.ILBC;
Sylvain Berfini's avatar
Sylvain Berfini committed
32
            SILK16.IsChecked = _appSettings.SILK16;
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
            GSM.IsChecked = _appSettings.GSM;
        }
        private void cancel_Click_1(object sender, EventArgs e)
        {
            NavigationService.GoBack();
        }

        private void save_Click_1(object sender, EventArgs e)
        {
            _appSettings.AMRNB = AMRNB.IsChecked;
            _appSettings.AMRWB = AMRWB.IsChecked;
            _appSettings.Speex16 = Speex16.IsChecked;
            _appSettings.Speex8 = Speex8.IsChecked;
            _appSettings.PCMU = PCMU.IsChecked;
            _appSettings.PCMA = PCMA.IsChecked;
            _appSettings.PCMA = PCMA.IsChecked;
Sylvain Berfini's avatar
Sylvain Berfini committed
49
            _appSettings.G722 = G722.IsChecked;
50
            _appSettings.ILBC = ILBC.IsChecked;
Sylvain Berfini's avatar
Sylvain Berfini committed
51
            _appSettings.SILK16 = SILK16.IsChecked;
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
            _appSettings.GSM = GSM.IsChecked;

            NavigationService.GoBack();
        }
        private void BuildLocalizedApplicationBar()
        {
            ApplicationBar = new ApplicationBar();

            ApplicationBarIconButton appBarSave = new ApplicationBarIconButton(new Uri("/Assets/AppBar/save.png", UriKind.Relative));
            appBarSave.Text = AppResources.SaveSettings;
            ApplicationBar.Buttons.Add(appBarSave);
            appBarSave.Click += save_Click_1;

            ApplicationBarIconButton appBarCancel = new ApplicationBarIconButton(new Uri("/Assets/AppBar/cancel.png", UriKind.Relative));
            appBarCancel.Text = AppResources.CancelChanges;
            ApplicationBar.Buttons.Add(appBarCancel);
            appBarCancel.Click += cancel_Click_1;
        }
    }
}