示例#1
0
        private async void Sign_In(object sender, RoutedEventArgs e)
        {
            if (Email.Text == "")
            {
                EmailLabel.Opacity = 1;
                return;
            }
            else if (Password.Password == "")
            {
                PasswordLabel.Opacity = 1;
                return;
            }

            var response = await MusicILike.SignIn(JsonConvert.SerializeObject(new
            {
                email    = Email.Text,
                password = Password.Password
            }));

            if (response.status == 1)
            {
                Debug.WriteLine("Logged in successfully");
            }
            else
            {
                Debug.WriteLine("Failed");
            }
        }
示例#2
0
 public Profile()
 {
     this.InitializeComponent();
     if (MusicILike.GetToken() != "")
     {
         InitProfile();
     }
 }
示例#3
0
        private async void InitProfile()
        {
            var profile = JObject.Parse(await MusicILike.GetProfile());

            Avatar.Source     = new BitmapImage(new Uri((string)profile["avatar"], UriKind.Absolute));
            FirstName.Text    = (string)profile["firstName"];
            LastName.Text     = (string)profile["lastName"];
            Phone.Text        = (string)profile["phone"];
            Address.Text      = (string)profile["address"];
            Introduction.Text = (string)profile["introduction"] ?? "No introduction";
            Gender.Text       = (int)profile["gender"] == 0 ? "Male" : "Female";
            Birthday.Text     = (string)profile["birthday"];
            Email.Text        = (string)profile["email"];
            CreatedAt.Text    = (string)profile["createdAt"];
        }
示例#4
0
        private async void Create_Song(object sender, RoutedEventArgs e)
        {
            foreach (StackPanel child in Form.Children.OfType <StackPanel>().ToList())
            {
                TextBox textBox = child.Children.OfType <TextBox>().FirstOrDefault();
                if (textBox == null)
                {
                    continue;
                }
                else if (textBox.Text == "")
                {
                    child.Children.OfType <TextBlock>().FirstOrDefault().Opacity = 1;
                    return;
                }
            }

            var content = JsonConvert.SerializeObject(new
            {
                name      = Name.Text,
                singer    = Singer.Text,
                author    = Author.Text,
                thumbnail = Thumbnail.Text,
                link      = Link.Text,
            });

            var response = await MusicILike.CreateSong(content);

            if (response.status == 1)
            {
                Debug.WriteLine("Created song successfully");
            }
            else
            {
                Debug.WriteLine("Failed");
            }
        }