本文整理汇总了C#中KeePass.UI.DynamicMenuEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DynamicMenuEventArgs类的具体用法?C# DynamicMenuEventArgs怎么用?C# DynamicMenuEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DynamicMenuEventArgs类属于KeePass.UI命名空间,在下文中一共展示了DynamicMenuEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnShowEntriesByTag
private void OnShowEntriesByTag(object sender, DynamicMenuEventArgs e)
{
if(e == null) { Debug.Assert(false); return; }
ShowEntriesByTag(e.Tag as string);
}
示例2: OnCopyCustomString
private void OnCopyCustomString(object sender, DynamicMenuEventArgs e)
{
string strKey = (e.Tag as string);
if(strKey == null) { Debug.Assert(false); return; }
PwEntry pe = GetSelectedEntry(false);
if(pe == null) { Debug.Assert(false); return; }
if(ClipboardUtil.CopyAndMinimize(pe.Strings.GetSafe(strKey), true,
this, pe, m_docMgr.ActiveDatabase))
StartClipboardCountdown();
}
示例3: OnEntryBinaryOpen
private void OnEntryBinaryOpen(object sender, DynamicMenuEventArgs e)
{
if(e == null) { Debug.Assert(false); return; }
EntryBinaryDataContext ctx = (e.Tag as EntryBinaryDataContext);
if(ctx == null) { Debug.Assert(false); return; }
PwEntry pe = ctx.Entry;
if(pe == null) { Debug.Assert(false); return; }
Debug.Assert(object.ReferenceEquals(pe, GetSelectedEntry(false)));
if(string.IsNullOrEmpty(ctx.Name)) { Debug.Assert(false); return; }
ProtectedBinary pb = pe.Binaries.Get(ctx.Name);
if(pb == null) { Debug.Assert(false); return; }
ProtectedBinary pbMod = BinaryDataUtil.Open(ctx.Name, pb, ctx.Options);
if(pbMod != null)
{
pe.Binaries.Set(ctx.Name, pbMod);
pe.Touch(true, false);
RefreshEntriesList();
UpdateUIState(true);
}
}
示例4: OnEntryBinaryView
private void OnEntryBinaryView(object sender, DynamicMenuEventArgs e)
{
PwEntry pe = GetSelectedEntry(false);
if(pe == null) { Debug.Assert(false); return; }
ProtectedBinary pbData = pe.Binaries.Get(e.ItemName);
if(pbData == null) { Debug.Assert(false); return; }
DataViewerForm dvf = new DataViewerForm();
dvf.InitEx(e.ItemName, pbData.ReadData());
dvf.ShowDialog();
}
示例5: ExecuteBinaryOpen
private void ExecuteBinaryOpen(PwEntry pe, string strBinName)
{
EntryBinaryDataContext ctx = new EntryBinaryDataContext();
ctx.Entry = pe;
ctx.Name = strBinName;
DynamicMenuEventArgs args = new DynamicMenuEventArgs(strBinName, ctx);
OnEntryBinaryOpen(null, args);
}
示例6: OnEntryMoveToGroup
private void OnEntryMoveToGroup(object sender, DynamicMenuEventArgs e)
{
PwGroup pgTo = (e.Tag as PwGroup);
if(pgTo == null) { Debug.Assert(false); return; }
m_pgActiveAtDragStart = GetSelectedGroup();
MoveOrCopySelectedEntries(pgTo, DragDropEffects.Move);
}
示例7: OnOpenUrl
private void OnOpenUrl(object sender, DynamicMenuEventArgs e)
{
if(e == null) { Debug.Assert(false); return; }
OpenWithItem it = (e.Tag as OpenWithItem);
if(it == null) { Debug.Assert(false); return; }
PwEntry[] v = Program.MainForm.GetSelectedEntries();
if(v == null) { Debug.Assert(false); return; }
foreach(PwEntry pe in v)
{
string strUrl = pe.Strings.ReadSafe(PwDefs.UrlField);
if(string.IsNullOrEmpty(strUrl)) continue;
WinUtil.OpenUrlWithApp(strUrl, pe, it.FilePath);
}
}
示例8: OnEntryBinaryView
private void OnEntryBinaryView(object sender, DynamicMenuEventArgs e)
{
PwEntry pe = GetSelectedEntry(false);
if(pe == null) { Debug.Assert(false); return; }
EditableBinaryAttachment eba = (e.Tag as EditableBinaryAttachment);
ProtectedBinary pbData = pe.Binaries.Get((eba != null) ? eba.Name :
e.ItemName);
if(pbData == null) { Debug.Assert(false); return; }
if(eba == null) // Not editable
{
DataViewerForm dvf = new DataViewerForm();
dvf.InitEx(e.ItemName, pbData.ReadData());
UIUtil.ShowDialogAndDestroy(dvf);
}
else
{
DataEditorForm def = new DataEditorForm();
def.InitEx(eba.Name, pbData.ReadData());
def.ShowDialog();
if(def.EditedBinaryData != null) // User changed the data
{
pe.Binaries.Set(eba.Name, new ProtectedBinary(false,
def.EditedBinaryData));
pe.Touch(true, false);
RefreshEntriesList();
UpdateUIState(true);
}
UIUtil.DestroyForm(def);
}
}
示例9: OnShowEntriesByTag
private void OnShowEntriesByTag(object sender, DynamicMenuEventArgs e)
{
string strTag = (e.Tag as string);
if(strTag == null) { Debug.Assert(false); return; }
if(strTag.Length == 0) return; // No assert
PwDatabase pd = m_docMgr.ActiveDatabase;
if((pd == null) || !pd.IsOpen) { Debug.Assert(false); return; }
PwObjectList<PwEntry> vEntries = new PwObjectList<PwEntry>();
pd.RootGroup.FindEntriesByTag(strTag, vEntries, true);
PwGroup pgResults = new PwGroup(true, true);
pgResults.IsVirtual = true;
foreach(PwEntry pe in vEntries) pgResults.AddEntry(pe, false);
UpdateUI(false, null, false, null, true, pgResults, false);
}
示例10: ExecuteBinaryEditView
private void ExecuteBinaryEditView(string strBinName, ProtectedBinary pb)
{
BinaryDataClass bdc = BinaryDataClassifier.Classify(strBinName,
pb.ReadData());
DynamicMenuEventArgs args = new DynamicMenuEventArgs(strBinName,
DataEditorForm.SupportsDataType(bdc) ?
new EditableBinaryAttachment(strBinName) : null);
OnEntryBinaryView(null, args);
}
示例11: OnCopyCustomString
private void OnCopyCustomString(object sender, DynamicMenuEventArgs e)
{
PwEntry pe = GetSelectedEntry(false);
if(pe == null) return;
if(ClipboardUtil.CopyAndMinimize(pe.Strings.GetSafe(e.ItemName), true,
this, pe, m_docMgr.ActiveDatabase))
StartClipboardCountdown();
}
示例12: m_dynCustomStrings_MenuClick
void m_dynCustomStrings_MenuClick(object sender, DynamicMenuEventArgs e)
{
PwEntry pe = m_host.MainWindow.GetSelectedEntry(false);
if (pe == null) return;
if (ClipboardUtil.CopyAndMinimize(pe.Strings.ReadSafe((string)e.Tag), true, m_host.MainWindow, pe, m_host.Database))
m_host.MainWindow.StartClipboardCountdown();
}
示例13: OnProfilesDynamicMenuClick
private void OnProfilesDynamicMenuClick(object sender, DynamicMenuEventArgs e)
{
PwProfile pwp = null;
if(e.ItemName == DeriveFromPrevious)
{
byte[] pbCur = m_secPassword.ToUtf8();
ProtectedString psCur = new ProtectedString(true, pbCur);
Array.Clear(pbCur, 0, pbCur.Length);
pwp = PwProfile.DeriveFromPassword(psCur);
}
else
{
foreach(PwProfile pwgo in Program.Config.PasswordGenerator.UserProfiles)
{
if(pwgo.Name == e.ItemName)
{
pwp = pwgo;
break;
}
}
}
if(pwp != null)
{
ProtectedString psNew = new ProtectedString(true);
PwGenerator.Generate(psNew, pwp, null, Program.PwGeneratorPool);
byte[] pbNew = psNew.ReadUtf8();
m_secPassword.SetPassword(pbNew);
m_secRepeat.SetPassword(pbNew);
Array.Clear(pbNew, 0, pbNew.Length);
}
else { Debug.Assert(false); }
}
示例14: OnShowQRCode
public void OnShowQRCode(object sender, DynamicMenuEventArgs e)
{
var key = e.Tag as string;
if (key == null)
{
return;
}
var pe = host.MainWindow.GetSelectedEntry(true);
if (pe == null)
{
return;
}
var context = new SprContext(pe, host.Database, SprCompileFlags.All);
var value = SprEngine.Compile(pe.Strings.GetSafe(key).ReadString(), context);
try
{
var data = new QRCodeGenerator().CreateQrCode(value, QRCodeGenerator.ECCLevel.L);
if (data != null)
{
var form = new ShowQRCodeForm(
host,
data.GetBitmap(10, Color.Black, Color.White),
SprEngine.Compile(pe.Strings.GetSafe(PwDefs.TitleField).ReadString(), context),
TryTranslateKey(key)
);
form.ShowDialog();
}
}
catch
{
MessageBox.Show("The data can't be displayed as a QR Code.");
}
}
示例15: OnAddEntryTag
private void OnAddEntryTag(object sender, DynamicMenuEventArgs e)
{
string strTag = (e.Tag as string);
if(strTag == null) { Debug.Assert(false); return; }
if(strTag.Length == 0)
{
SingleLineEditForm dlg = new SingleLineEditForm();
dlg.InitEx(KPRes.TagNew, KPRes.TagAddNew, KPRes.Name + ":",
Properties.Resources.B48x48_KMag, string.Empty, null);
if(UIUtil.ShowDialogNotValue(dlg, DialogResult.OK)) return;
strTag = dlg.ResultString;
UIUtil.DestroyForm(dlg);
}
if(!string.IsNullOrEmpty(strTag))
AddOrRemoveTagsToFromSelectedEntries(strTag, true);
}