public void Initialize() { //doc setting da luu IsMusic = StorageHelper.GetSetting <bool>(RECORD_MUSIC, true); IsSound = StorageHelper.GetSetting <bool>(RECORD_SOUND, true); //IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication(); //IsolatedStorageFileStream stream = store.OpenFile(SETTING_FILE, FileMode.OpenOrCreate, FileAccess.Read); //StreamReader reader = new StreamReader(stream); //try //{ // IsMusic = reader.ReadLine() != "0"; // IsSound = reader.ReadLine() != "0"; //} //catch //{ // IsMusic = true; // IsSound = true; //} //finally //{ // reader.Close(); // stream.Close(); //} DummyMusicSetting = IsMusic; //neu he thong dang phat nhac truoc khi mo app thi khoa chuc nang dieu khien nhac nen if (MediaPlayer.State == MediaState.Playing) { IsMusic = false; AllowChangeMusicSetting = false; } else { AllowChangeMusicSetting = true; } ContentManager content = main.Content; Texture2D texMusic = content.Load <Texture2D>("Images/btnMusic"); sprMusic = new Sprite2D(texMusic, texMusic.Width, texMusic.Height / 2); Texture2D texSound = content.Load <Texture2D>("Images/btnSound"); sprSound = new Sprite2D(texSound, texSound.Width, texSound.Height / 2); texLock = content.Load <Texture2D>("Images/lockMusic"); updateButton(); MediaPlayer.IsRepeating = true; }
public void Initialize() { IsMusic = true; IsSound = true; AllowChangeMusicSetting = true; ContentManager content = main.Content; Texture2D texMusic = content.Load <Texture2D>("Images/btnMusic"); sprMusic = new Sprite2D(texMusic, texMusic.Width, texMusic.Height / 2); Texture2D texSound = content.Load <Texture2D>("Images/btnSound"); sprSound = new Sprite2D(texSound, texSound.Width, texSound.Height / 2); texLock = content.Load <Texture2D>("Images/lockMusic"); updateButton(); }