示例#1
0
        private async void WaktuHabis_Load(object sender, EventArgs e)
        {
            circularProgressBar1.Minimum = 0;
            circularProgressBar1.Value   = 0;
            client = new FireSharp.FirebaseClient(config);
            int              i         = 0;
            double           nilai2    = (nilai * 10) / 3;
            FirebaseResponse responseM = await client.GetTaskAsync("Counter");

            counter ctn = responseM.ResultAs <counter>();

            circularProgressBar1.Maximum = ctn.M;
            while (true)
            {
                circularProgressBar1.Value = i;
                i++;
                if (i > ctn.M)
                {
                    break;
                }

                FirebaseResponse response = await client.GetTaskAsync("User_Account/" + i);

                Data data = response.ResultAs <Data>();
                if (username == data.username)
                {
                    var penilaian = new Penilaian
                    {
                        nama     = data.namaDepan + data.namaBelakang,
                        nip      = data.nip,
                        C1       = Convert.ToSingle(string.Format("{0:0.##}", nilai2)),
                        C2       = 0,
                        C3       = 0,
                        C4       = 0,
                        C5       = 0,
                        username = data.username
                    };
                    FirebaseResponse updt = await client.UpdateTaskAsync("Penilaian/" + i, penilaian);

                    Penilaian pn = updt.ResultAs <Penilaian>();
                }
            }
            var   ss  = new SoalSelesai();
            Soal1 obj = (Soal1)Application.OpenForms["Soal1"];

            obj.Close();
            this.Close();
            ss.Show();
        }
示例#2
0
        private async void button2_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                int              i         = 0;
                double           nilai2    = (nilai * 10) / 3;
                FirebaseResponse responseM = await client.GetTaskAsync("Counter");

                counter ctn = responseM.ResultAs <counter>();
                while (true)
                {
                    i++;
                    if (i > ctn.M)
                    {
                        break;
                    }

                    FirebaseResponse response = await client.GetTaskAsync("User_Account/" + i);

                    Data data = response.ResultAs <Data>();
                    if (username == data.username)
                    {
                        var penilaian = new Penilaian
                        {
                            nama     = data.namaDepan + data.namaBelakang,
                            nip      = data.nip,
                            C1       = Convert.ToSingle(string.Format("{0:0.##}", nilai2)),
                            C2       = 0,
                            C3       = 0,
                            C4       = 0,
                            C5       = 0,
                            username = data.username
                        };
                        FirebaseResponse updt = await client.UpdateTaskAsync("Penilaian/" + i, penilaian);

                        Penilaian pn = updt.ResultAs <Penilaian>();
                    }
                }
                var   ss  = new SoalSelesai();
                Soal1 obj = (Soal1)Application.OpenForms["Soal1"];
                obj.Close();
                this.Close();
                ss.Show();
            }
        }