本文整理汇总了C#中PwIcon类的典型用法代码示例。如果您正苦于以下问题:C# PwIcon类的具体用法?C# PwIcon怎么用?C# PwIcon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PwIcon类属于命名空间,在下文中一共展示了PwIcon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetIconDrawable
public Drawable GetIconDrawable(Resources res, PwDatabase db, PwIcon icon, PwUuid customIconId)
{
if (!customIconId.Equals(PwUuid.Zero)) {
return GetIconDrawable (res, db, customIconId);
}
return GetIconDrawable (res, icon);
}
示例2: IconToResId
public static int IconToResId(PwIcon iconId)
{
BuildList();
int resId;
if (_icons.TryGetValue(iconId, out resId))
return resId;
return Resource.Drawable.ic99_blank;
}
示例3: getIcon
public static Image getIcon(PwDatabase db, ImageList imageList, PwUuid customIconId, PwIcon iconId)
{
if (!PwUuid.Zero.Equals(customIconId))
{
return db.GetCustomIcon(customIconId, 16, 16);
}
else
{
return imageList.Images[(int)iconId];
}
}
示例4: EditGroup
public EditGroup(Context ctx, IKp2aApp app, String name, PwIcon iconid, PwUuid customIconId, PwGroup group, OnFinish finish)
: base(finish)
{
_ctx = ctx;
_name = name;
_iconId = iconid;
Group = group;
_customIconId = customIconId;
_app = app;
_onFinishToRun = new AfterEdit(this, OnFinishToRun);
}
示例5: EcasEventType
public EcasEventType(PwUuid uuidType, string strName, PwIcon pwIcon,
EcasParameter[] vParams, EcasEventCompare f)
{
if((uuidType == null) || (uuidType.EqualsValue(PwUuid.Zero)))
throw new ArgumentNullException("uuidType");
if(strName == null) throw new ArgumentNullException("strName");
// if(vParams == null) throw new ArgumentNullException("vParams");
// if(f == null) throw new ArgumentNullException("f");
m_type = uuidType;
m_strName = strName;
m_pwIcon = pwIcon;
m_vParams = (vParams ?? EcasParameter.EmptyArray);
m_fn = (f ?? EcasEventCompareTrue);
}
示例6: EcasConditionType
public EcasConditionType(PwUuid uuidType, string strName, PwIcon pwIcon,
EcasParameter[] vParams, EcasConditionEvaluate f)
{
if((uuidType == null) || PwUuid.Zero.Equals(uuidType))
throw new ArgumentNullException("uuidType");
if(strName == null) throw new ArgumentNullException("strName");
// if(vParams == null) throw new ArgumentNullException("vParams");
// if(f == null) throw new ArgumentNullException("f");
m_type = uuidType;
m_strName = strName;
m_pwIcon = pwIcon;
m_vParams = (vParams ?? EcasParameter.EmptyArray);
m_fn = (f ?? EcasConditionEvaluateTrue);
}
示例7: SplashIdMapping
public SplashIdMapping(string strTypeName, PwIcon pwIcon, string[] vFieldNames)
{
Debug.Assert(strTypeName != null);
if(strTypeName == null) throw new ArgumentNullException("strTypeName");
Debug.Assert(vFieldNames != null);
if(vFieldNames == null) throw new ArgumentNullException("vFieldNames");
m_strTypeName = strTypeName;
m_pwIcon = pwIcon;
for(int i = 0; i < Math.Min(m_vFieldNames.Length, vFieldNames.Length); ++i)
m_vFieldNames[i] = vFieldNames[i];
}
示例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;
}
示例9: InitEntryTab
private void InitEntryTab()
{
m_pwEntryIcon = m_pwEntry.IconId;
m_pwCustomIconID = m_pwEntry.CustomIconUuid;
if(!m_pwCustomIconID.Equals(PwUuid.Zero))
{
// int nInx = (int)PwIcon.Count + m_pwDatabase.GetCustomIconIndex(m_pwCustomIconID);
// if((nInx > -1) && (nInx < m_ilIcons.Images.Count))
// m_btnIcon.Image = m_ilIcons.Images[nInx];
// else m_btnIcon.Image = m_ilIcons.Images[(int)m_pwEntryIcon];
Image imgCustom = m_pwDatabase.GetCustomIcon(m_pwCustomIconID);
// m_btnIcon.Image = (imgCustom ?? m_ilIcons.Images[(int)m_pwEntryIcon]);
UIUtil.SetButtonImage(m_btnIcon, (imgCustom ?? m_ilIcons.Images[
(int)m_pwEntryIcon]), true);
}
else
{
// m_btnIcon.Image = m_ilIcons.Images[(int)m_pwEntryIcon];
UIUtil.SetButtonImage(m_btnIcon, m_ilIcons.Images[
(int)m_pwEntryIcon], true);
}
bool bHideInitial = m_cbHidePassword.Checked;
m_icgPassword.Attach(m_tbPassword, m_cbHidePassword, m_lblPasswordRepeat,
m_tbRepeatPassword, m_lblQuality, m_pbQuality, m_lblQualityInfo,
m_ttRect, this, bHideInitial, false);
if(m_pwEntry.Expires)
{
m_dtExpireDateTime.Value = m_pwEntry.ExpiryTime;
m_cbExpires.Checked = true;
}
else // Does not expire
{
m_dtExpireDateTime.Value = DateTime.Now.Date;
m_cbExpires.Checked = false;
}
m_cgExpiry.Attach(m_cbExpires, m_dtExpireDateTime);
if(m_pwEditMode == PwEditMode.ViewReadOnlyEntry)
{
m_tbTitle.ReadOnly = m_tbUserName.ReadOnly = m_tbPassword.ReadOnly =
m_tbRepeatPassword.ReadOnly = m_tbUrl.ReadOnly =
m_rtNotes.ReadOnly = true;
m_btnIcon.Enabled = m_btnGenPw.Enabled = m_cbExpires.Enabled =
m_dtExpireDateTime.Enabled =
m_btnStandardExpires.Enabled = false;
m_rtNotes.SelectAll();
m_rtNotes.BackColor = m_rtNotes.SelectionBackColor =
AppDefs.ColorControlDisabled;
m_rtNotes.DeselectAll();
m_ctxToolsUrlSelApp.Enabled = m_ctxToolsUrlSelDoc.Enabled = false;
m_ctxToolsFieldRefsInTitle.Enabled = m_ctxToolsFieldRefsInUserName.Enabled =
m_ctxToolsFieldRefsInPassword.Enabled = m_ctxToolsFieldRefsInUrl.Enabled =
m_ctxToolsFieldRefsInNotes.Enabled = false;
m_ctxToolsFieldRefs.Enabled = false;
m_btnOK.Enabled = false;
}
// Show URL in blue, if it's black in the current visual theme
if(m_tbUrl.ForeColor.ToArgb() == Color.Black.ToArgb())
m_tbUrl.ForeColor = Color.Blue;
}
示例10: OnBtnPickIcon
private void OnBtnPickIcon(object sender, EventArgs e)
{
if(m_pwEditMode == PwEditMode.ViewReadOnlyEntry) return;
IconPickerForm ipf = new IconPickerForm();
ipf.InitEx(m_ilIcons, (uint)PwIcon.Count, m_pwDatabase,
(uint)m_pwEntryIcon, m_pwCustomIconID);
if(ipf.ShowDialog() == DialogResult.OK)
{
if(!ipf.ChosenCustomIconUuid.Equals(PwUuid.Zero)) // Custom icon
{
m_pwCustomIconID = ipf.ChosenCustomIconUuid;
UIUtil.SetButtonImage(m_btnIcon, m_pwDatabase.GetCustomIcon(
m_pwCustomIconID), true);
}
else // Standard icon
{
m_pwEntryIcon = (PwIcon)ipf.ChosenIconId;
m_pwCustomIconID = PwUuid.Zero;
UIUtil.SetButtonImage(m_btnIcon, m_ilIcons.Images[
(int)m_pwEntryIcon], true);
}
}
UIUtil.DestroyForm(ipf);
}
示例11: FindCreateGroup
public static PwGroup FindCreateGroup(this PwDatabase database, string tag, string name, PwIcon icon = PwIcon.Folder)
{
foreach (PwGroup rootGroup in database.RootGroup.GetGroups(true))
{
if (rootGroup.Notes.Contains(tag))
{
return rootGroup;
}
}
//if we cant find the group yet, we create a new one and add it to the rootGroup
PwGroup group = new PwGroup(true, true, name, icon);
group.Notes = tag;
group.SetParent(database.RootGroup);
Debug.Assert(null != group, "group for " + tag + " - " + name + " is 'null' but should not!");
return group;
}
示例12: AssignDrawableTo
public void AssignDrawableTo(ImageView iv, Resources res, PwDatabase db, PwIcon icon, PwUuid customIconId)
{
}
示例13: iconToBase64
/// <summary>
/// extract the current icon information for this entry
/// </summary>
/// <param name="customIconUUID"></param>
/// <param name="iconId"></param>
/// <returns></returns>
private string iconToBase64(PwUuid customIconUUID, PwIcon iconId)
{
Image icon = null;
PwUuid uuid = null;
string imageData = "";
if (customIconUUID != PwUuid.Zero)
{
string cachedBase64 = DataExchangeModel.IconCache.GetIconEncoding(customIconUUID);
if (string.IsNullOrEmpty(cachedBase64))
{
object[] delParams = { customIconUUID };
object invokeResult = host.MainWindow.Invoke(
new KeePassRPCExt.GetCustomIconDelegate(
KeePassRPCPlugin.GetCustomIcon), delParams);
if (invokeResult != null)
{
icon = (Image)invokeResult;
}
if (icon != null)
{
uuid = customIconUUID;
}
} else
{
return cachedBase64;
}
}
// this happens if we didn't want to or couldn't find a custom icon
if (icon == null)
{
int iconIdInt = (int)iconId;
uuid = new PwUuid( new byte[]{
(byte)(iconIdInt & 0xFF), (byte)(iconIdInt & 0xFF),
(byte)(iconIdInt & 0xFF), (byte)(iconIdInt & 0xFF),
(byte)(iconIdInt >> 8 & 0xFF), (byte)(iconIdInt >> 8 & 0xFF),
(byte)(iconIdInt >> 8 & 0xFF), (byte)(iconIdInt >> 8 & 0xFF),
(byte)(iconIdInt >> 16 & 0xFF), (byte)(iconIdInt >> 16 & 0xFF),
(byte)(iconIdInt >> 16 & 0xFF), (byte)(iconIdInt >> 16 & 0xFF),
(byte)(iconIdInt >> 24 & 0xFF), (byte)(iconIdInt >> 24 & 0xFF),
(byte)(iconIdInt >> 24 & 0xFF), (byte)(iconIdInt >> 24 & 0xFF)
} );
string cachedBase64 = DataExchangeModel.IconCache.GetIconEncoding(uuid);
if (string.IsNullOrEmpty(cachedBase64))
{
object[] delParams = { (int)iconId };
object invokeResult = host.MainWindow.Invoke(
new KeePassRPCExt.GetIconDelegate(
KeePassRPCPlugin.GetIcon), delParams);
if (invokeResult != null)
{
icon = (Image)invokeResult;
}
} else
{
return cachedBase64;
}
}
if (icon != null)
{
// we found an icon but it wasn't in the cache so lets
// calculate its base64 encoding and then add it to the cache
MemoryStream ms = new MemoryStream();
icon.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
imageData = Convert.ToBase64String(ms.ToArray());
DataExchangeModel.IconCache.AddIcon(uuid, imageData);
}
return imageData;
}
示例14: ReadIcon
private static PwIcon ReadIcon(XmlNode xmlChild, PwIcon pwDefault)
{
int nIcon;
if(StrUtil.TryParseInt(XmlUtil.SafeInnerText(xmlChild), out nIcon))
{
if((nIcon >= 0) && (nIcon < (int)PwIcon.Count)) return (PwIcon)nIcon;
}
else { Debug.Assert(false); }
return pwDefault;
}
示例15: InitEntryTab
private void InitEntryTab()
{
m_pwEntryIcon = m_pwEntry.IconId;
m_pwCustomIconID = m_pwEntry.CustomIconUuid;
if(m_pwCustomIconID != PwUuid.Zero)
{
int nInx = (int)PwIcon.Count + m_pwDatabase.GetCustomIconIndex(m_pwCustomIconID);
if((nInx > -1) && (nInx < m_ilIcons.Images.Count))
m_btnIcon.Image = m_ilIcons.Images[nInx];
else m_btnIcon.Image = m_ilIcons.Images[(int)m_pwEntryIcon];
}
else m_btnIcon.Image = m_ilIcons.Images[(int)m_pwEntryIcon];
bool bHideInitial = m_cbHidePassword.Checked;
m_secPassword.Attach(m_tbPassword, ProcessTextChangedPassword, bHideInitial);
m_secRepeat.Attach(m_tbRepeatPassword, ProcessTextChangedRepeatPw, bHideInitial);
m_tbTitle.Text = m_vStrings.ReadSafe(PwDefs.TitleField);
m_tbUserName.Text = m_vStrings.ReadSafe(PwDefs.UserNameField);
byte[] pb = m_vStrings.GetSafe(PwDefs.PasswordField).ReadUtf8();
m_secPassword.SetPassword(pb);
m_secRepeat.SetPassword(pb);
MemUtil.ZeroByteArray(pb);
m_tbUrl.Text = m_vStrings.ReadSafe(PwDefs.UrlField);
m_rtNotes.Text = m_vStrings.ReadSafe(PwDefs.NotesField);
m_dtExpireDateTime.CustomFormat = DateTimeFormatInfo.CurrentInfo.ShortDatePattern +
" " + DateTimeFormatInfo.CurrentInfo.LongTimePattern;
if(m_pwEntry.Expires)
{
m_dtExpireDateTime.Value = m_pwEntry.ExpiryTime;
m_cbExpires.Checked = true;
}
else // Does not expire
{
m_dtExpireDateTime.Value = DateTime.Now;
m_cbExpires.Checked = false;
}
if(m_pwEditMode == PwEditMode.ViewReadOnlyEntry)
{
m_tbTitle.ReadOnly = m_tbUserName.ReadOnly = m_tbPassword.ReadOnly =
m_tbRepeatPassword.ReadOnly = m_tbUrl.ReadOnly =
m_rtNotes.ReadOnly = true;
m_btnIcon.Enabled = m_btnGenPw.Enabled =
m_tbRepeatPassword.Enabled = m_cbExpires.Enabled =
m_dtExpireDateTime.Enabled =
m_btnStandardExpires.Enabled = false;
m_rtNotes.SelectAll();
m_rtNotes.BackColor = m_rtNotes.SelectionBackColor =
AppDefs.ColorControlDisabled;
m_rtNotes.DeselectAll();
m_btnOK.Enabled = false;
}
// Show URL in blue, if it's black in the current visual theme
if(m_tbUrl.ForeColor.ToArgb() == Color.Black.ToArgb())
m_tbUrl.ForeColor = Color.Blue;
}