示例#1
0
        // 등록
        private async void btn_regist_Click_1(object sender, RoutedEventArgs e)
        {
            if (txt_caption1.Text.Equals(""))
            {
                MessageBoxResult result = MessageBox.Show("Please input caption.");
                return;
            }
            else if (txt_image1.Text.Equals("") || txt_image2.Text.Equals(""))
            {
                MessageBoxResult result = MessageBox.Show("Please select images.");
                return;
            }

            foreach (ParseObject PO in m_RegList)
            {
                if (txt_id.Text.Equals(PO.Get <string>("NFC_id")))
                {
                    MessageBoxResult result = MessageBox.Show("Current NFC id is already exist.");
                    return;
                }
            }

            byte[]    data1 = this.ConvertImageToByte(m_bitmap1);
            ParseFile file1 = new ParseFile("1.png", data1);
            await file1.SaveAsync();

            byte[]    data2 = this.ConvertImageToByte(m_bitmap2);
            ParseFile file2 = new ParseFile("2.png", data2);
            await file2.SaveAsync();

            var NFCreg = new ParseObject("NFC_reg");

            NFCreg["NFC_id"]      = txt_id.Text;
            NFCreg["linked_user"] = "******";
            NFCreg["Caption"]     = txt_caption1.Text;
            NFCreg["File1"]       = file1;
            NFCreg["File2"]       = file2;
            await NFCreg.SaveAsync();

            MessageBox.Show("Regist finish!");

            RefreshList();
        }
示例#2
0
        private async void dataGet()
        {
            //var query = ParseObject.GetQuery("TestObject").OrderByDescending("score");
            try
            {
                var query = ParseObject.GetQuery("TestObject")
                            .OrderByDescending("score");
                IEnumerable <ParseObject> results = await query.FindAsync();

                String Sscore = ""; String Sname = ""; String Scolor = ""; int Srank = 0;
                foreach (ParseObject PO in results)
                {
                    Srank++;
                    Scolor = "ms-appx:/Assets/Quizz/backgrouditem.png";
                    Sscore = "" + PO.Get <int>("score");
                    Sname  = PO.Get <String>("name");
                    if (PO.ObjectId == IsolatedStorageHelper.GetObject <String>("1111"))
                    {
                        Scolor = "ms-appx:/Assets/backgrouditem2.png";
                    }

                    System.Diagnostics.Debug.WriteLine(Sname + Sscore);

                    lstjoueur.Add(new Player()
                    {
                        name = Sname, score = Sscore, color = Scolor, rank = Srank
                    });
                }

                lst.DataContext = lstjoueur;
            }
            catch (WebException ex)
            {
                TFConnection.Visibility = Visibility.Visible;
            }
        }