本文整理汇总了C#中KeePass.UI.PwDocument类的典型用法代码示例。如果您正苦于以下问题:C# PwDocument类的具体用法?C# PwDocument怎么用?C# PwDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PwDocument类属于KeePass.UI命名空间,在下文中一共展示了PwDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateNewDocument
public PwDocument CreateNewDocument(bool bMakeActive)
{
PwDocument ds = new PwDocument();
if((m_vDocs.Count == 1) && (!m_vDocs[0].Database.IsOpen) &&
(m_vDocs[0].LockedIoc.Path.Length == 0))
{
m_vDocs.RemoveAt(0);
m_dsActive = ds;
}
m_vDocs.Add(ds);
if(bMakeActive) m_dsActive = ds;
NotifyActiveDocumentSelected();
return ds;
}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:17,代码来源:DocumentManagerEx.cs
示例2: UpdateUI
public void UpdateUI(bool bRecreateTabBar, PwDocument dsSelect,
bool bUpdateGroupList, PwGroup pgSelect, bool bUpdateEntryList,
PwGroup pgEntrySource, bool bSetModified, Control cOptFocus)
{
if(bRecreateTabBar) RecreateUITabs();
if(dsSelect != null) m_docMgr.ActiveDocument = dsSelect;
SelectUITab();
UpdateImageLists(false);
if(bUpdateGroupList) UpdateGroupList(pgSelect);
if(bUpdateEntryList) UpdateEntryList(pgEntrySource, false);
else { Debug.Assert(pgEntrySource == null); }
UpdateUIState(bSetModified, cOptFocus);
}
开发者ID:riking,项目名称:go-keepass2,代码行数:18,代码来源:MainForm_Functions.cs
示例3: GetTabText
private void GetTabText(PwDocument dsInfo, out string strName,
out string strTip)
{
if(!IsFileLocked(dsInfo))
{
string strPath = dsInfo.Database.IOConnectionInfo.Path;
strName = UrlUtil.GetFileName(strPath);
if(dsInfo.Database.Modified) strName += "*";
strTip = StrUtil.EncodeToolTipText(strPath);
if(dsInfo.Database.IsOpen)
{
if(dsInfo.Database.Name.Length > 0)
strTip += "\r\n" + StrUtil.EncodeToolTipText(
dsInfo.Database.Name);
}
}
else // Locked
{
string strPath = dsInfo.LockedIoc.Path;
strName = UrlUtil.GetFileName(strPath);
strName += " [" + KPRes.Locked + "]";
strTip = StrUtil.EncodeToolTipText(strPath);
}
}
开发者ID:riking,项目名称:go-keepass2,代码行数:26,代码来源:MainForm_Functions.cs
示例4: MakeDocumentActive
public void MakeDocumentActive(PwDocument ds)
{
if(ds == null) { Debug.Assert(false); return; }
ds.Database.UINeedsIconUpdate = true;
UpdateUI(false, ds, true, null, true, null, false);
RestoreWindowState(ds.Database);
UpdateUIState(false);
}
开发者ID:riking,项目名称:go-keepass2,代码行数:11,代码来源:MainForm_Functions.cs
示例5: CloseDocument
internal void CloseDocument(PwDocument dsToClose, bool bLocking,
bool bExiting, bool bUpdateUI)
{
PwDocument ds = (dsToClose ?? m_docMgr.ActiveDocument);
PwDatabase pd = ds.Database;
bool bIsActive = (ds == m_docMgr.ActiveDocument);
Program.TriggerSystem.RaiseEvent(EcasEventIDs.ClosingDatabaseFilePre,
EcasProperty.Database, pd);
if(this.FileClosingPre != null)
{
FileClosingEventArgs fcea = new FileClosingEventArgs(pd);
this.FileClosingPre(null, fcea);
if(fcea.Cancel) return;
}
if(pd.Modified) // Implies pd.IsOpen
{
bool bInvokeSave = false;
// https://sourceforge.net/p/keepass/discussion/329220/thread/c3c823c6/
bool bCanAutoSave = AppPolicy.Current.SaveFile;
if(Program.Config.Application.FileClosing.AutoSave && bCanAutoSave)
bInvokeSave = true;
else
{
FileSaveOrigin fso = FileSaveOrigin.Closing;
if(bLocking) fso = FileSaveOrigin.Locking;
if(bExiting) fso = FileSaveOrigin.Exiting;
DialogResult dr = FileDialogsEx.ShowFileSaveQuestion(
pd.IOConnectionInfo.GetDisplayName(), fso);
if(dr == DialogResult.Cancel) return;
else if(dr == DialogResult.Yes) bInvokeSave = true;
else if(dr == DialogResult.No) { } // Changes are lost
}
if(bInvokeSave)
{
SaveDatabase(pd, null);
if(pd.Modified) return;
}
}
Program.TriggerSystem.RaiseEvent(EcasEventIDs.ClosingDatabaseFilePost,
EcasProperty.Database, pd);
if(this.FileClosingPost != null)
{
FileClosingEventArgs fcea = new FileClosingEventArgs(pd);
this.FileClosingPost(null, fcea);
if(fcea.Cancel) return;
}
IOConnectionInfo ioClosing = pd.IOConnectionInfo.CloneDeep();
pd.Close();
if(!bLocking) m_docMgr.CloseDatabase(pd);
if(bIsActive)
{
m_tbQuickFind.Items.Clear();
m_tbQuickFind.Text = string.Empty;
if(!bLocking)
{
m_docMgr.ActiveDatabase.UINeedsIconUpdate = true;
ResetDefaultFocus(null);
}
}
if(bUpdateUI)
UpdateUI(true, null, true, null, true, null, false);
// NativeMethods.ClearIconicBitmaps(this.Handle);
if(this.FileClosed != null)
{
FileClosedEventArgs fcea = new FileClosedEventArgs(ioClosing);
this.FileClosed(null, fcea);
}
}
开发者ID:riking,项目名称:go-keepass2,代码行数:82,代码来源:MainForm_Functions.cs
示例6: IsFileLocked
public bool IsFileLocked(PwDocument ds)
{
if(ds == null) ds = m_docMgr.ActiveDocument;
return (ds.LockedIoc.Path.Length != 0);
}
开发者ID:riking,项目名称:go-keepass2,代码行数:6,代码来源:MainForm_Functions.cs
示例7: MenuProcessGroup
private static void MenuProcessGroup(PwDocument ds,
ToolStripMenuItem tsmiContainer, PwGroup pgSource)
{
if((pgSource.Groups.UCount == 0) && (pgSource.Entries.UCount == 0))
return;
foreach(PwGroup pg in pgSource.Groups)
{
ToolStripMenuItem tsmi = MenuCreateGroup(ds, pg);
tsmiContainer.DropDownItems.Add(tsmi);
MenuProcessGroup(ds, tsmi, pg);
}
foreach(PwEntry pe in pgSource.Entries)
MenuAddEntry(ds, tsmiContainer, pe);
}
开发者ID:ashwingj,项目名称:keepass2,代码行数:16,代码来源:EntryMenu.cs
示例8: MenuGetImageIndex
private static int MenuGetImageIndex(PwDocument ds, PwIcon pwID,
PwUuid pwCustomID)
{
if((pwCustomID != PwUuid.Zero) && (ds ==
Program.MainForm.DocumentManager.ActiveDocument))
{
return (int)PwIcon.Count +
Program.MainForm.DocumentManager.ActiveDatabase.GetCustomIconIndex(
pwCustomID);
}
if((int)pwID < (int)PwIcon.Count) return (int)pwID;
return (int)PwIcon.Key;
}
开发者ID:ashwingj,项目名称:keepass2,代码行数:15,代码来源:EntryMenu.cs
示例9: MenuCreateGroup
private static ToolStripMenuItem MenuCreateGroup(PwDocument ds,
PwGroup pg)
{
ToolStripMenuItem tsmi = new ToolStripMenuItem();
tsmi.Text = pg.Name;
tsmi.ImageIndex = MenuGetImageIndex(ds, pg.IconId, pg.CustomIconUuid);
return tsmi;
}
开发者ID:ashwingj,项目名称:keepass2,代码行数:8,代码来源:EntryMenu.cs
示例10: MenuAddEntry
private static void MenuAddEntry(PwDocument ds, ToolStripMenuItem tsmiContainer,
PwEntry pe)
{
ToolStripMenuItem tsmiEntry = new ToolStripMenuItem();
string strTitle = pe.Strings.ReadSafe(PwDefs.TitleField);
string strUser = pe.Strings.ReadSafe(PwDefs.UserNameField);
string strText = string.Empty;
if((strTitle.Length > 0) && (strUser.Length > 0))
strText = strTitle + ": " + strUser;
else if(strTitle.Length > 0) strText = strTitle;
else if(strUser.Length > 0) strText = strUser;
tsmiEntry.Text = strText;
tsmiEntry.ImageIndex = MenuGetImageIndex(ds, pe.IconId, pe.CustomIconUuid);
tsmiContainer.DropDownItems.Add(tsmiEntry);
ToolStripMenuItem tsmi;
tsmi = new ToolStripMenuItem(KPRes.AutoType);
tsmi.ImageIndex = (int)PwIcon.Run;
tsmi.Tag = pe;
tsmi.Click += OnAutoType;
tsmi.Enabled = pe.GetAutoTypeEnabled();
tsmiEntry.DropDownItems.Add(tsmi);
tsmiEntry.DropDownItems.Add(new ToolStripSeparator());
tsmi = new ToolStripMenuItem(KPRes.Copy + " " + KPRes.UserName);
tsmi.ImageIndex = (int)PwIcon.UserKey;
tsmi.Tag = pe;
tsmi.Click += OnCopyUserName;
tsmiEntry.DropDownItems.Add(tsmi);
tsmi = new ToolStripMenuItem(KPRes.Copy + " " + KPRes.Password);
tsmi.ImageIndex = (int)PwIcon.Key;
tsmi.Tag = pe;
tsmi.Click += OnCopyPassword;
tsmiEntry.DropDownItems.Add(tsmi);
}
开发者ID:ashwingj,项目名称:keepass2,代码行数:38,代码来源:EntryMenu.cs
示例11: CloseDatabase
public void CloseDatabase(PwDatabase pwDatabase)
{
int iFoundPos = -1;
for(int i = 0; i < m_vDocs.Count; ++i)
{
if(m_vDocs[i].Database == pwDatabase)
{
iFoundPos = i;
m_vDocs.RemoveAt(i);
break;
}
}
if(iFoundPos != -1)
{
if(m_vDocs.Count == 0)
m_vDocs.Add(new PwDocument());
if(iFoundPos == m_vDocs.Count) --iFoundPos;
m_dsActive = m_vDocs[iFoundPos];
NotifyActiveDocumentSelected();
}
else { Debug.Assert(false); }
}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:24,代码来源:DocumentManagerEx.cs
示例12: CloseDatabase
public void CloseDatabase(PwDatabase pwDatabase)
{
int iFoundPos = -1;
for(int i = 0; i < m_vDocs.Count; ++i)
{
if(m_vDocs[i].Database == pwDatabase)
{
iFoundPos = i;
break;
}
}
if(iFoundPos < 0) { Debug.Assert(false); return; }
bool bClosingActive = (m_vDocs[iFoundPos] == m_dsActive);
m_vDocs.RemoveAt(iFoundPos);
if(m_vDocs.Count == 0)
m_vDocs.Add(new PwDocument());
if(bClosingActive)
{
int iNewActive = Math.Min(iFoundPos, m_vDocs.Count - 1);
m_dsActive = m_vDocs[iNewActive];
NotifyActiveDocumentSelected();
}
else { Debug.Assert(m_vDocs.Contains(m_dsActive)); }
}
开发者ID:riking,项目名称:go-keepass2,代码行数:27,代码来源:DocumentManagerEx.cs
示例13: CloseDocument
private void CloseDocument(PwDocument ds, bool bLocking, bool bExiting)
{
if(ds == null) ds = m_docMgr.ActiveDocument;
PwDatabase pd = ds.Database;
IOConnectionInfo ioClosing = pd.IOConnectionInfo.CloneDeep();
if(pd.Modified) // Implies pd.IsOpen
{
if(Program.Config.Application.FileClosing.AutoSave)
{
OnFileSave(null, EventArgs.Empty);
if(pd.Modified) return;
}
else
{
FileSaveOrigin fso = FileSaveOrigin.Closing;
if(bLocking) fso = FileSaveOrigin.Locking;
if(bExiting) fso = FileSaveOrigin.Exiting;
DialogResult dr = FileDialogsEx.ShowFileSaveQuestion(
pd.IOConnectionInfo.GetDisplayName(), fso, this.Handle);
if(dr == DialogResult.Cancel) return;
else if(dr == DialogResult.Yes)
{
OnFileSave(null, EventArgs.Empty);
if(pd.Modified) return;
}
else if(dr == DialogResult.No) { } // Changes are lost
}
}
pd.Close();
if(!bLocking) m_docMgr.CloseDatabase(pd);
m_tbQuickFind.Items.Clear();
m_tbQuickFind.Text = string.Empty;
if(!bLocking)
{
m_docMgr.ActiveDatabase.UINeedsIconUpdate = true;
UpdateUI(true, null, true, null, true, null, false);
}
// NativeMethods.ClearIconicBitmaps(this.Handle);
if(FileClosed != null)
{
FileClosedEventArgs fcea = new FileClosedEventArgs(ioClosing);
FileClosed(null, fcea);
}
}
开发者ID:elitak,项目名称:keepass,代码行数:53,代码来源:MainForm_Functions.cs
示例14: CloseDocument
internal void CloseDocument(PwDocument dsToClose, bool bLocking, bool bExiting)
{
PwDocument ds = (dsToClose ?? m_docMgr.ActiveDocument);
bool bIsActive = object.ReferenceEquals(ds, m_docMgr.ActiveDocument);
PwDatabase pd = ds.Database;
Program.TriggerSystem.RaiseEvent(EcasEventIDs.ClosingDatabaseFilePre,
pd.IOConnectionInfo.Path);
if(this.FileClosingPre != null)
{
FileClosingEventArgs fcea = new FileClosingEventArgs(pd);
this.FileClosingPre(null, fcea);
if(fcea.Cancel) return;
}
if(pd.Modified) // Implies pd.IsOpen
{
bool bInvokeSave = false;
if(Program.Config.Application.FileClosing.AutoSave)
bInvokeSave = true;
else
{
FileSaveOrigin fso = FileSaveOrigin.Closing;
if(bLocking) fso = FileSaveOrigin.Locking;
if(bExiting) fso = FileSaveOrigin.Exiting;
DialogResult dr = FileDialogsEx.ShowFileSaveQuestion(
pd.IOConnectionInfo.GetDisplayName(), fso);
if(dr == DialogResult.Cancel) return;
else if(dr == DialogResult.Yes) bInvokeSave = true;
else if(dr == DialogResult.No) { } // Changes are lost
}
if(bInvokeSave)
{
SaveDatabase(pd, null);
if(pd.Modified) return;
}
}
Program.TriggerSystem.RaiseEvent(EcasEventIDs.ClosingDatabaseFilePost,
pd.IOConnectionInfo.Path);
if(this.FileClosingPost != null)
{
FileClosingEventArgs fcea = new FileClosingEventArgs(pd);
this.FileClosingPost(null, fcea);
if(fcea.Cancel) return;
}
IOConnectionInfo ioClosing = pd.IOConnectionInfo.CloneDeep();
pd.Close();
if(!bLocking) m_docMgr.CloseDatabase(pd);
if(bIsActive)
{
m_tbQuickFind.Items.Clear();
m_tbQuickFind.Text = string.Empty;
}
if(!bLocking)
{
m_docMgr.ActiveDatabase.UINeedsIconUpdate = true;
UpdateUI(true, null, true, null, true, null, false);
ResetDefaultFocus(null);
}
// NativeMethods.ClearIconicBitmaps(this.Handle);
if(this.FileClosed != null)
{
FileClosedEventArgs fcea = new FileClosedEventArgs(ioClosing);
this.FileClosed(null, fcea);
}
}
开发者ID:saadware,项目名称:kpn,代码行数:77,代码来源:MainForm_Functions.cs
示例15: GetTabText
private void GetTabText(PwDocument dsInfo, out string strName,
out string strTip)
{
if(IsFileLocked(dsInfo) == false) // Not locked
{
strTip = dsInfo.Database.IOConnectionInfo.Path;
strName = UrlUtil.GetFileName(strTip);
if(dsInfo.Database.Modified) strName += "*";
if(dsInfo.Database.IsOpen)
{
if(dsInfo.Database.Name.Length > 0)
strTip += "\r\n" + dsInfo.Database.Name;
}
}
else // Locked
{
strTip = dsInfo.LockedIoc.Path;
strName = UrlUtil.GetFileName(strTip);
strName += " [" + KPRes.Locked + "]";
}
}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:23,代码来源:MainForm_Functions.cs
注:本文中的KeePass.UI.PwDocument类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论