예제 #1
0
        private void FormAdjustHash_Load(object sender, EventArgs e)
        {
            hashData.UpdatePreviewImage();

            labelHashOrg.Text      = (hashData.ownerOb != null) ? hashData.ownerOb.ToString() : "unknown";
            labelDistance.Text     = hashData.isAuto ? "N/A" : hashData.matchDistance.ToString();
            labelDescDistance.Text = hashData.isAuto ? "<= Classifier based " : hashData.matchDistance == 0 ? "<= Exact match" : "<= Lower is more accurate";
            pictureBox1.Image      = hashData.previewImage;

            comboBoxOwner.Items.Clear();
            comboBoxOwner.Items.AddRange(GenerateHashOwnerOptions(hashData).ToArray());

            bool foundSelection = false;

            for (int idx = 0; idx < comboBoxOwner.Items.Count; idx++)
            {
                HashOwnerItem hashComboItem = (HashOwnerItem)comboBoxOwner.Items[idx];
                if (hashComboItem.SourceObject == hashData.ownerOb ||
                    hashComboItem.SourceObject.ToString() == labelHashOrg.Text)
                {
                    comboBoxOwner.SelectedIndex = idx;
                    foundSelection = true;
                    break;
                }
            }

            if (!foundSelection)
            {
                comboBoxOwner_SelectedIndexChanged(null, null);
            }
        }
예제 #2
0
        private void comboBoxOwner_SelectedIndexChanged(object sender, EventArgs e)
        {
            bool canSave = false;

            if (comboBoxOwner.SelectedItem != null)
            {
                HashOwnerItem hashComboItem = (HashOwnerItem)comboBoxOwner.SelectedItem;
                canSave = labelHashOrg.Text != hashComboItem.SourceObject.ToString();
            }

            buttonOk.Enabled = canSave;
        }
예제 #3
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            HashOwnerItem hashComboItem = (HashOwnerItem)comboBoxOwner.SelectedItem;

            if (hashComboItem != null)
            {
                if (hashData.ownerOb == null || (labelHashOrg.Text != hashComboItem.SourceObject.ToString()))
                {
                    PlayerSettingsDB.Get().RemoveKnownHash(hashData);
                    hashData.ownerOb       = hashComboItem.SourceObject;
                    hashData.matchDistance = 0;
                    hashData.isAuto        = false;

                    PlayerSettingsDB.Get().AddKnownHash(hashData);
                }
            }

            DialogResult = DialogResult.OK;
            Close();
        }