예제 #1
0
 public static string GetPEDCValueString(PwEntry pe)
 {
     if (!m_dPEDValuesString.ContainsKey(pe.Uuid))
     {
         PEDCalcValue pcv_entry = pe.GetPEDValue(false);
         bool         bInherit  = pcv_entry.Inherit;
         if (bInherit)
         {
             pcv_entry = pe.GetPEDValue(true);
         }
         string sUnit = pcv_entry.ToString(true);
         m_dPEDValuesString[pe.Uuid] = sUnit + (bInherit ? "*" : string.Empty);
         PluginDebug.AddInfo("Add PEDCValue-string to buffer", 0,
                             "Entry: " + pe.Uuid.ToHexString() + " / " + pe.Strings.ReadSafe(PwDefs.TitleField),
                             "Value: " + m_dPEDValuesString[pe.Uuid]);
     }
     return(m_dPEDValuesString[pe.Uuid]);
 }
예제 #2
0
        private void OnPEDMenuOpening(object sender, EventArgs e)
        {
            ToolStripMenuItem tsmi = sender as ToolStripMenuItem;

            if (tsmi == null)
            {
                return;
            }
            if (tsmi.DropDown == null)
            {
                return;
            }
            PEDValue_QuickAction pqaActions = tsmi.DropDown.Tag as PEDValue_QuickAction;

            if (pqaActions == null)
            {
                return;
            }
            if ((tsmi == m_ContextMenuEntry) || (tsmi == m_MainMenuEntry))
            {
                PwEntry[]    pe         = m_host.MainWindow.GetSelectedEntries();
                PEDCalcValue pcvInherit = pe[0].GetPEDValueInherit();
                pqaActions.SetInheritValue(pcvInherit);
                pqaActions.SetValue(pe[0].GetPEDValue(false));
            }
            else if ((tsmi == m_ContextMenuGroup) || (tsmi == m_MainMenuGroup))
            {
                PwGroup      pg         = m_host.MainWindow.GetSelectedGroup();
                PEDCalcValue pcvInherit = pg.GetPEDValueInherit();
                pqaActions.SetInheritValue(pcvInherit);
                pqaActions.SetValue(pg.GetPEDValue(false));
            }
            else if (m_pweForm != null)
            {
                PwEntry pe = m_pweForm.EntryRef;
                m_pweForm.UpdateEntryStrings(true, true);
                PEDCalcValue currentValue = m_pweForm.EntryStrings.ReadPEDCString();
                if (currentValue == null)
                {
                    currentValue = pe.GetPEDValue(false);
                }
                pqaActions.SetInheritValue(pe.GetPEDValueInherit());
                pqaActions.SetValue(currentValue);
            }
        }