Ejemplo n.º 1
0
        private void PlaySong(int id)
        {
            me.Stop();
            me.Close();

            Models.AccordEntities DB = new Models.AccordEntities();
            var x = DB.tblSongs.FirstOrDefault(s => s.Id == id);

            byte[] tempsong = x.SongFile.ToArray();

            TbSongName.Text   = x.SongName;
            TbArtistName.Text = x.ArtistName;

            if (File.Exists("temp.mp3"))
            {
                File.Delete("temp.mp3");
            }
            var file = File.OpenWrite("temp.mp3");

            file.Write(tempsong, 0, tempsong.Length);
            file.Close();

            me.Source = new Uri("temp.mp3", UriKind.Relative);
            me.Play();
            Timer.Start();
        }
Ejemplo n.º 2
0
        private async void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            App._user.FirstName   = fNameField.Text;
            App._user.LastName    = lNameField.Text;
            App._user.Email       = emailField.Text;
            App._user.PhoneNumber = phoneNumberField.Text;

            App._user.updateUserProfile();

            MetroDialogSettings mds = new MetroDialogSettings();

            mds.AffirmativeButtonText = "خب";
            mds.ColorScheme           = MetroDialogColorScheme.Inverted;

            //entity

            if (!(String.IsNullOrEmpty(profPath)))
            {
                var db = new Models.AccordEntities();

                var user = db.tblUsers.FirstOrDefault(u => App._user.UserID == u.UserID);
                user.ProfileImage = File.ReadAllBytes(profPath);

                db.Entry(user).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }

            await this.ShowMessageAsync("اعمال تغییرات", "جهت مشاهده تغییرات اعمال شده، صفحه تنظیمات را مجددا باز کنید.", MessageDialogStyle.Affirmative, mds);

            App._user.updateUserProfile();
            UserProfileViewer.User = App._user;
        }