Exemple #1
0
        public override void CF_setupReadSettings(int currentpage, bool advanced)
        {
            try
            {
                ButtonHandler[CFSetupButton.One] = new CFSetupHandler(SetUserName);
                ButtonText[CFSetupButton.One]    = this.pluginLang.ReadField("/APPLANG/SETUP/USERNAME");
                ButtonValue[CFSetupButton.One]   = this.pluginConfig.ReadField("/APPCONFIG/USERNAME");

                ButtonHandler[CFSetupButton.Two] = new CFSetupHandler(SetPassword);
                ButtonText[CFSetupButton.Two]    = this.pluginLang.ReadField("/APPLANG/SETUP/PASSWORD");
                string encryptedPassword = this.pluginConfig.ReadField("/APPCONFIG/PASSWORD");
                ButtonValue[CFSetupButton.Two] = String.IsNullOrEmpty(encryptedPassword) ? String.Empty : new String('•', 8);

                ButtonHandler[CFSetupButton.Three] = new CFSetupHandler(SetLocation);
                ButtonText[CFSetupButton.Three]    = this.pluginLang.ReadField("/APPLANG/SETUP/LOCATION");
                ButtonValue[CFSetupButton.Three]   = GetLocation();

                ButtonHandler[CFSetupButton.Four] = new CFSetupHandler(SetBitrate);
                ButtonText[CFSetupButton.Four]    = this.pluginLang.ReadField("/APPLANG/SETUP/BITRATE");
                ButtonValue[CFSetupButton.Four]   = GetBitrateString();

                //[GrantA] Auto play music boolean button.
                ButtonHandler[CFSetupButton.Five] = new CFSetupHandler(SetAutoPlay);
                ButtonText[CFSetupButton.Five]    = this.pluginLang.ReadField("/APPLANG/SETUP/AUTOPLAY");
                ButtonValue[CFSetupButton.Five]   = GetAutoPlayString();
            }
            catch (Exception errmsg) { CFTools.writeError(errmsg.Message, errmsg.StackTrace); }
        }
        private void SetAudioFormat(ref object value)
        {
            try
            {
                object resultObject;
                string resultvalue, resulttext;

                CFControls.CFListViewItem[] audioFormatItems = new CFControls.CFListViewItem[3];
                audioFormatItems[0] = new CFControls.CFListViewItem(GetAudioFormatDisplay(AudioFormats.AAC_PLUS), AudioFormats.AAC_PLUS.ToString(), 0, false, (object)AudioFormats.AAC_PLUS);
                audioFormatItems[1] = new CFControls.CFListViewItem(GetAudioFormatDisplay(AudioFormats.MP3), AudioFormats.MP3.ToString(), 0, false, (object)AudioFormats.MP3);
                audioFormatItems[2] = new CFControls.CFListViewItem(GetAudioFormatDisplay(AudioFormats.MP3_HIFI), AudioFormats.MP3_HIFI.ToString(), 0, false, (object)AudioFormats.MP3_HIFI);

                AudioFormats audioFormat = AudioFormats.MP3;

                try
                {
                    audioFormat = (AudioFormats)Enum.Parse(typeof(AudioFormats), this.pluginConfig.ReadField("/APPCONFIG/AUDIOFORMAT"));
                }
                catch { }

                //TODO: Pass in current value so the list shows the correct item selected initially, this doesn't seem to work as-is
                DialogResult dialogResult = this.CF_systemDisplayDialog(CF_Dialogs.FileBrowser, this.pluginLang.ReadField("/APPLANG/SETUP/AUDIOFORMAT"), null, audioFormat.ToString(), out resultvalue, out resulttext, out resultObject, audioFormatItems, false, true, false, false, false, false, 1);

                if (dialogResult == DialogResult.OK)
                {
                    audioFormat = (AudioFormats)resultObject;

                    // save user value, note this does not save to file yet, as this should only be done when user confirms settings
                    // being overwritten when they click the "Save" button.  Saving is done internally by the CFSetup instance if
                    // pluginConfig and pluginLang were properly set before callin CF_initSetup().
                    this.pluginConfig.WriteField("/APPCONFIG/AUDIOFORMAT", audioFormat.ToString());

                    // Display new value on Settings Screen button
                    ButtonValue[(int)value] = resulttext;

                    if (audioFormat == AudioFormats.MP3_HIFI)
                    {
                        CFDialogParams dialogParams = new CFDialogParams("High quality audio is only available to Pandora One subscribers. If you are not a subscriber regular quality will be used instead.");
                        this.CF_displayDialog(CF_Dialogs.OkBox, dialogParams);
                    }
                    else if (audioFormat == AudioFormats.AAC_PLUS)
                    {
                        System.Reflection.Assembly assembly = System.Reflection.Assembly.GetEntryAssembly();
                        string bassAacAssemblyPath          = System.IO.Path.GetDirectoryName(assembly.Location) + "\\bass_aac.dll";

                        if (!File.Exists(bassAacAssemblyPath))
                        {
                            CFDialogParams dialogParams = new CFDialogParams("Centrafuse does not natively support the AAC audio format which is used by the mobile quality setting. To enable mobile quality playback you need to install the bass_aac.dll audio extension which can be downloaded from www.un4seen.com. Place the DLL in the Centrafuse directory. If you do not install this library you will not be able to listen to Pandora using the mobile quality setting.");
                            this.CF_displayDialog(CF_Dialogs.OkBoxBig, dialogParams);
                        }
                    }
                }
            }
            catch (Exception errmsg) { CFTools.writeError(errmsg.Message, errmsg.StackTrace); }
        }
        private void ClearFavorites(ref object value)
        {
            try
            {
                CFDialogParams dialogParams = new CFDialogParams();
                dialogParams.displaytext = "Are you sure you want to clear your favorite stations?";
                DialogResult dialogResult = CF_displayDialog(CF_Dialogs.YesNo, dialogParams);

                if (dialogResult == DialogResult.OK)
                {
                    this.pluginConfig.WriteField("/APPCONFIG/FAVORITES", String.Empty);
                }
            }
            catch (Exception errmsg) { CFTools.writeError(errmsg.Message, errmsg.StackTrace); }
        }
Exemple #4
0
        private void SetPassword(ref object value)
        {
            try
            {
                object tempobject;
                string resultvalue, resulttext;

                // Display OSK for user to type password
                DialogResult dialogResult = this.CF_systemDisplayDialog(CF_Dialogs.OSK, this.pluginLang.ReadField("/APPLANG/SETUP/PASSWORD"), String.Empty, "PASSWORD", out resultvalue, out resulttext, out tempobject, null, true, true, true, true, false, false, 1);

                if (dialogResult == DialogResult.OK)
                {
                    // save user value, note this does not save to file yet, as this should only be done when user confirms settings
                    // being overwritten when they click the "Save" button.  Saving is done internally by the CFSetup instance if
                    // pluginConfig and pluginLang were properly set before callin CF_initSetup().
                    this.pluginConfig.WriteField("/APPCONFIG/PASSWORD", EncryptionHelper.EncryptString(resultvalue, PASSWORD));

                    // Display new value on Settings Screen button
                    ButtonValue[(int)value] = new String('•', 8);
                }
            }
            catch (Exception errmsg) { CFTools.writeError(errmsg.Message, errmsg.StackTrace); }
        }
        public override void CF_setupReadSettings(int currentpage, bool advanced)
        {
            try
            {
                ButtonHandler[CFSetupButton.One] = new CFSetupHandler(SetUserName);
                ButtonText[CFSetupButton.One]    = this.pluginLang.ReadField("/APPLANG/SETUP/USERNAME");
                ButtonValue[CFSetupButton.One]   = this.pluginConfig.ReadField("/APPCONFIG/USERNAME");

                ButtonHandler[CFSetupButton.Two] = new CFSetupHandler(SetPassword);
                ButtonText[CFSetupButton.Two]    = this.pluginLang.ReadField("/APPLANG/SETUP/PASSWORD");
                string encryptedPassword = this.pluginConfig.ReadField("/APPCONFIG/PASSWORD");
                ButtonValue[CFSetupButton.Two] = String.IsNullOrEmpty(encryptedPassword) ? String.Empty : new String('•', 8);

                ButtonHandler[CFSetupButton.Three] = new CFSetupHandler(SetAudioFormat);
                ButtonText[CFSetupButton.Three]    = this.pluginLang.ReadField("/APPLANG/SETUP/AUDIOFORMAT");
                AudioFormats audioFormat = AudioFormats.MP3;
                try
                {
                    audioFormat = (AudioFormats)Enum.Parse(typeof(AudioFormats), this.pluginConfig.ReadField("/APPCONFIG/AUDIOFORMAT"));
                }
                catch {}
                ButtonValue[CFSetupButton.Three] = GetAudioFormatDisplay(audioFormat);

                ButtonHandler[CFSetupButton.Four] = new CFSetupHandler(ClearFavorites);
                ButtonText[CFSetupButton.Four]    = this.pluginLang.ReadField("/APPLANG/SETUP/CLEARFAVORITES");
                ButtonValue[CFSetupButton.Four]   = this.pluginLang.ReadField("/APPLANG/SETUP/CLEARFAVORITESPROMPT");

                ButtonHandler[CFSetupButton.Five] = new CFSetupHandler(SetClearCache);
                ButtonText[CFSetupButton.Five]    = this.pluginLang.ReadField("/APPLANG/SETUP/CLEARCACHE");
                ButtonValue[CFSetupButton.Five]   = this.pluginConfig.ReadField("/APPCONFIG/CLEARCACHE");

                ButtonHandler[CFSetupButton.Six] = new CFSetupHandler(SetLogEvents);
                ButtonText[CFSetupButton.Six]    = this.pluginLang.ReadField("/APPLANG/SETUP/LOGEVENTS");
                ButtonValue[CFSetupButton.Six]   = this.pluginConfig.ReadField("/APPCONFIG/LOGEVENTS");
            }
            catch (Exception errmsg) { CFTools.writeError(errmsg.Message, errmsg.StackTrace); }
        }
Exemple #6
0
        private void SetBitrate(ref object value)
        {
            try
            {
                string currentBitrate = GetBitrateString();

                CFControls.CFListViewItem[] audioFormatItems = new CFControls.CFListViewItem[3];
                audioFormatItems[0] = new CFControls.CFListViewItem(sp_bitrate.BITRATE_96k.ToString(), sp_bitrate.BITRATE_96k.ToString(), false);
                audioFormatItems[1] = new CFControls.CFListViewItem(sp_bitrate.BITRATE_160k.ToString(), sp_bitrate.BITRATE_160k.ToString(), false);
                audioFormatItems[2] = new CFControls.CFListViewItem(sp_bitrate.BITRATE_320k.ToString(), sp_bitrate.BITRATE_320k.ToString(), false);

                object resultObject;
                string resultvalue, resulttext;

                DialogResult result = this.CF_systemDisplayDialog(CF_Dialogs.FileBrowser, this.pluginLang.ReadField("/APPLANG/SETUP/BITRATE"), currentBitrate, currentBitrate, out resultvalue, out resulttext, out resultObject, audioFormatItems, false, true, false, false, false, false, 1);

                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    this.pluginConfig.WriteField("/APPCONFIG/BITRATE", resulttext);
                    ButtonValue[(int)value] = resulttext;
                }
            }
            catch (Exception errmsg) { CFTools.writeError(errmsg.Message, errmsg.StackTrace); }
        }