コード例 #1
0
ファイル: ManagerForm.cs プロジェクト: zhuwansu/Rafy
 private void _TabControl1_Selected(object sender, TabControlEventArgs e)
 {
     if (e.TabPage.Text == LicenseManagerResource.ManagerFormTabControl1SelectedQueryAuthentication)
     {
         Task.Run(() =>
         {
             ManagerFormService.BindDataGridView(this.dgvLicenseView);
         });
     }
 }
コード例 #2
0
ファイル: ManagerForm.cs プロジェクト: zhuwansu/Rafy
        private void _DgvContextMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            this.dgvContextMenu.Hide();
            if (this.dgvLicenseView.SelectedRows.Count < 1)
            {
                return;
            }

            var    row         = this.dgvLicenseView.SelectedRows[0];
            var    commandText = e.ClickedItem.Text;
            string dataPropertyName;
            string expressData;

            if (this._commandDictionary.TryGetValue(commandText, out dataPropertyName))
            {
                expressData = row.Cells[dataPropertyName].Value.ToString();
            }
            else
            {
                if (this._delegateDictionary.ContainsKey(e.ClickedItem.Text))
                {
                    this._delegateDictionary[e.ClickedItem.Text](row.Cells["Id"].Value.ToString());
                    MessageBox.Show(@"删除成功", @"提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ManagerFormService.BindDataGridView(this.dgvLicenseView);
                    return;
                }

                var publicKey   = row.Cells["PublicKey"].Value.ToString();
                var licenseCode = row.Cells["LicenseCode"].Value.ToString();
                expressData = RSACryptoService.DecryptString(licenseCode, publicKey);
            }

            try
            {
                Clipboard.SetText(expressData);
                MessageBox.Show(LicenseManagerResource.ManagerFormdgvContextMenuPaste);
            }
            catch (ExternalException)
            {
                MessageBox.Show(@"复制到剪贴版失败,请重试。", LicenseManagerResource.ManagerFormGetLicenseEntityAuthenticationTargetWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }