Exemple #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 (tpsn[trophyID].HasValue && tpsn[trophyID].Value.IsSync)   // 尚未同步的才可編輯
            {
                MessageBox.Show(Properties.strings.SyncedTrophyCanNotEdit);
            }
            else if (tpsn[trophyID].HasValue)     // 已經取得的獎杯,刪除之
            {
                if (trophyID != 0 && (tpsn.Count == tusr.all_trophy_number))
                {
                    MessageBox.Show(Properties.strings.CantLoclPlatinumBeforOther);
                }
                else if (MessageBox.Show(Properties.strings.DeleteTrophyConfirm, Properties.strings.Delete, MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    tpsn.DeleteTrophyByID(trophyID);
                    tusr.LockTrophy(trophyID);
                    lvi.SubItems[4].Text = Properties.strings.no;
                    lvi.BackColor        = Color.LightGray;
                    lvi.SubItems[6].Text = new DateTime(0).ToString(dtpForm.dateTimePicker1.CustomFormat);
                    tusr.LockTrophy(trophyID);
                    CompletionRates();
                    haveBeenEdited = true;
                }
            }
            else      // nonget
            {
                if (trophyID == 0 && tconf.HasPlatinium && (tpsn.Count < baseGamaCount))
                {
                    MessageBox.Show(Properties.strings.CantUnloclPlatinumBeforOther); //if the ammount of unlcoked trophies >= baseGameCount it will also let you unlock platinium
                }
                else 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 = Properties.strings.yes;
                    lvi.BackColor        = ((ListView)sender).BackColor;
                    lvi.SubItems[6].Text = dtpForm.dateTimePicker1.Value.ToString(dtpForm.dateTimePicker1.CustomFormat);
                    tusr.UnlockTrophy(trophyID, dtpForm.dateTimePicker1.Value);
                    CompletionRates();
                    haveBeenEdited = true;
                }
            }
        }
Exemple #2
0
 private void DeleteTrophy(int trophyId, ListViewItem lvi)
 {
     if (IsTrophySync(trophyId))
     {
         MessageBox.Show(Properties.strings.SyncedTrophyCanNotEdit);
     }
     else
     if (trophyId != 0 && tconf[trophyId].gid == 0 && IsTrophyAchieved(0))
     {
         MessageBox.Show(Properties.strings.CantLoclPlatinumBeforOther);
     }
     else
     if (MessageBox.Show(Properties.strings.DeleteTrophyConfirm, Properties.strings.Delete, MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         tpsn.DeleteTrophyByID(trophyId);
         tusr.LockTrophy(trophyId);
         lvi.SubItems[4].Text = Properties.strings.no;
         lvi.BackColor        = Color.LightGray;
         lvi.SubItems[6].Text = string.Empty;
         CompletionRates();
         haveBeenEdited = true;
     }
 }