Beispiel #1
0
        private void listViewEx1_DoubleClick(object sender, EventArgs e)
        {
            int          trophyID = ((ListView)sender).SelectedItems[0].ImageIndex;// 在這裡imageid其實等於trophy ID   ex 白金0號, 1...
            ListViewItem lvi      = ((ListView)sender).SelectedItems[0];

            if (unlocker[trophyID].IsUnlock && unlocker[trophyID].TrophyInfo.IsSync)   // 尚未同步的才可編輯
            {
                MessageBox.Show("Sync trophy can't be edit");
            }
            else if (unlocker[trophyID].IsUnlock)
            { // 已經取得的獎杯,刪除之
                if (MessageBox.Show("Delete trophy", "Are you sure you want to delete the trophy?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    //tpsn.DeleteTrophyByID(trophyID);
                    //tusr.LockTrophy(trophyID);
                    lvi.SubItems[4].Text = "No";
                    lvi.BackColor        = Color.LightGray;
                    lvi.SubItems[6].Text = new DateTime(0).ToString(dtpForm.dateTimePicker1.CustomFormat);
                    unlocker.LockTrophy(trophyID);
                    //tusr.LockTrophy(trophyID);
                    CompletionRates();
                    haveBeenEdited = true;
                }
            }
            else      // nonget
            {
                if (dtpForm.ShowDialog(this) == DialogResult.OK)
                {
                    //tpsn.PutTrophy(trophyID, tusr.trophyTypeTable[trophyID].Type, dtpForm.dateTimePicker1.Value);
                    //tusr.UnlockTrophy(trophyID, dtpForm.dateTimePicker1.Value);
                    lvi.SubItems[4].Text = "Yes";
                    lvi.BackColor        = ((ListView)sender).BackColor;
                    lvi.SubItems[6].Text = dtpForm.dateTimePicker1.Value.ToString(dtpForm.dateTimePicker1.CustomFormat);
                    unlocker.UnlockTrophy(trophyID, dtpForm.dateTimePicker1.Value);
                    //tusr.UnlockTrophy(trophyID, dtpForm.dateTimePicker1.Value);
                    CompletionRates();
                    haveBeenEdited = true;
                }
            }
        }