Exemplo n.º 1
0
        public void Save(ClientSettings clientSettings)
        {
            try
            {
                using (StreamWriter sw = new StreamWriter(mPath + mFileName))
                {
                    XmlSerializer ser = new XmlSerializer(typeof(ClientSettings));
                    ser.Serialize(sw, clientSettings);
                    sw.Close();
                }
            }
            catch (Exception)
            {
#if (DEBUG)
                throw;
#endif
            }
        }
Exemplo n.º 2
0
        public SettingsWindow(String path)
        {
            InitializeComponent();

            LocalizeComponent();
            BrandComponent();

            //TO DO: Open configuration
            mClientSettingsSerializer = new ClientSettingsSerializer(path);
            mClientSettings = mClientSettingsSerializer.Load();



            //Basic
            checkBoxConfirmClosing.Checked = mClientSettings.ProgramConfirmClosing;
            checkBoxEnableQA.Checked = mClientSettings.ProgramEnableQualityAgent;
            checkBoxStartup.Checked = mClientSettings.ProgramAtStartup;

            checkBoxContactsServer.Checked = mClientSettings.ContactsEnableServerStore;
            checkBoxContactsOutlook.Checked = mClientSettings.ContactsEnableOutlookStore;
            checkBoxContactsLocal.Checked = true; //Always available

            //Language
            String cultureInfo = Thread.CurrentThread.CurrentUICulture.Name;

            if (cultureInfo == "es-ES")
            {
                radioButtonEspanol.Checked = true;
            }
            else if (cultureInfo == "de-DE")
            {
                radioButtonDeutsch.Checked = true;
            }
            else if (cultureInfo == "it-CH")
            {
                radioButtonItalian.Checked = true;
            }
            else //    if (cultureInfo == "en-US")
            {
                radioButtonEnglish.Checked = true;
            }

                




            //Phone
            checkBoxEnableSipDiagnosticLogging.Checked = mClientSettings.PhoneEnableSIPDiagnostic;
            trackBarMicrophone.Value = mClientSettings.PhoneAudioMicrophoneVolume;
            trackBarSpeaker.Value = mClientSettings.PhoneAudioSpeakerVolume;

            listBoxAvailableCodecs.Items.Clear();
            listBoxEnabledCodecs.Items.Clear();

            foreach (AudioCodec audioCodec in mClientSettings.PhoneAvailableMediaFormats)
            {
                if (!listBoxAvailableCodecs.Items.Contains(audioCodec)) listBoxAvailableCodecs.Items.Add(audioCodec);
            }

            foreach (AudioCodec audioCodec in mClientSettings.PhoneEnabledMediaFormats)
            {
                if (!listBoxEnabledCodecs.Items.Contains(audioCodec)) listBoxEnabledCodecs.Items.Add(audioCodec);
            }

            radioButtonRingToneCustom.Checked = !mClientSettings.PhoneDefaultRingToneEnabled;
            radioButtonRingToneDefault.Checked = mClientSettings.PhoneDefaultRingToneEnabled;


            if (File.Exists(mClientSettings.PhoneCustomRingTone))
            {
                FileInfo fileInfo = new FileInfo(mClientSettings.PhoneCustomRingTone);
                if (fileInfo.Extension.ToLower() == ".mp3")
                {
                    textBoxRingTonePath.Text = mClientSettings.PhoneCustomRingTone;
                }
            }

        }
Exemplo n.º 3
0
        //Public Methods
        public ClientSettings Load()
        {
            ClientSettings clientSettings = new ClientSettings();
            try
            {
                using (StreamReader sr = new StreamReader(mPath + mFileName))
                {
                    if (File.Exists(mPath + mFileName))
                    {
                        XmlSerializer des = new XmlSerializer(typeof(ClientSettings));
                        clientSettings = (ClientSettings)des.Deserialize(new System.Xml.XmlTextReader(sr));
                        sr.Close();
                    }
                }
            }
            catch (Exception)
            {
                if (File.Exists(mPath + mFileName))
                {

#if (DEBUG)
                    throw;
#else
                    File.Delete(mPath + mFileName);
#endif

                }
            }
            if (clientSettings.PhoneEnabledMediaFormats == null || clientSettings.PhoneEnabledMediaFormats.Count == 0)
            {
                clientSettings.PhoneEnabledMediaFormats = new List<AudioCodec>();
                clientSettings.PhoneEnabledMediaFormats.Add(new AudioCodec(AudioCodec.AudioCodecFormat.G729, "G729"));
                clientSettings.PhoneEnabledMediaFormats.Add(new AudioCodec(AudioCodec.AudioCodecFormat.iLBC_30Ms, "iLBC 30Ms"));
                clientSettings.PhoneEnabledMediaFormats.Add(new AudioCodec(AudioCodec.AudioCodecFormat.uLaw_8k, "uLaw 8k"));
                clientSettings.PhoneEnabledMediaFormats.Add(new AudioCodec(AudioCodec.AudioCodecFormat.aLaw_8k, "aLaw 8k"));
            }

            

            return clientSettings;
         
        }