@@ -112,17 +112,25 @@ internal void Disable()
112112 catch { }
113113 }
114114
115- private void AddMenu ( ref ToolStripMenuItem tsmiContainer , ref ToolStripMenuItem tsmiLastWindow , ref ToolStripComboBox tscbWindows )
116- {
117- tsmiContainer = new ToolStripMenuItem ( KPRes . AutoType + ": " , m_imgDefaultIcon ) ;
118- string s = "Add" ;
119- var f = KeePass . Program . Translation . Forms . FirstOrDefault ( x => x . FullName == "KeePass.Forms.PwEntryForm" ) ;
120- if ( f != null )
115+ private static string _sAddText = string . Empty ;
116+ private static string GetTextForAdd ( )
117+ {
118+ if ( string . IsNullOrEmpty ( _sAddText ) )
121119 {
122- var c = f . Controls . FirstOrDefault ( x => x . Name == "m_btnAutoTypeAdd" ) ;
123- if ( c != null ) s = c . Text ;
120+ _sAddText = "Add" ;
121+ var f = KeePass . Program . Translation . Forms . FirstOrDefault ( x => x . FullName == "KeePass.Forms.PwEntryForm" ) ;
122+ if ( f != null )
123+ {
124+ var c = f . Controls . FirstOrDefault ( x => x . Name == "m_btnAutoTypeAdd" ) ;
125+ if ( c != null ) _sAddText = c . Text ;
126+ }
124127 }
125- tsmiContainer . Text += s ;
128+ return _sAddText ;
129+ }
130+
131+ private void AddMenu ( ref ToolStripMenuItem tsmiContainer , ref ToolStripMenuItem tsmiLastWindow , ref ToolStripComboBox tscbWindows )
132+ {
133+ tsmiContainer = new ToolStripMenuItem ( KPRes . AutoType + ": " + GetTextForAdd ( ) , m_imgDefaultIcon ) ;
126134 tsmiContainer . DropDown = new ToolStripDropDown ( ) ;
127135 tsmiContainer . DropDown . LayoutStyle = ToolStripLayoutStyle . Table ;
128136 var settings = tsmiContainer . DropDown . LayoutSettings as TableLayoutSettings ;
@@ -151,11 +159,10 @@ private void AddMenu(ref ToolStripMenuItem tsmiContainer, ref ToolStripMenuItem
151159
152160 private void OnKeyDown ( object sender , KeyEventArgs e )
153161 {
154- if ( e . KeyCode == Keys . Enter )
155- {
156- var t = ( sender as ToolStripComboBox ) . GetCurrentParent ( ) as ToolStripDropDown ;
157- t . Items [ 2 ] . PerformClick ( ) ;
158- }
162+ if ( e . KeyCode != Keys . Enter ) return ;
163+
164+ var t = ( sender as ToolStripComboBox ) . GetCurrentParent ( ) as ToolStripDropDown ;
165+ t . Items [ 2 ] . PerformClick ( ) ;
159166 }
160167
161168 private void OnAddPreviousWindow ( object sender , EventArgs e )
@@ -226,9 +233,7 @@ private AWMDuplicateHandling GetDuplicateHandling(string s)
226233 else
227234 {
228235 string text = PluginTranslate . AWMCheckDuplicateInfo + "\n \n " + string . Format ( PluginTranslate . AWMCheckDuplicateDetails ,
229- DialogResult . Yes . ToString ( ) ,
230- DialogResult . No . ToString ( ) ,
231- DialogResult . Cancel . ToString ( ) ) ;
236+ KPRes . Yes , KPRes . No , KPRes . Cancel ) ;
232237 DialogResult r = MessageBox . Show ( text , PluginTranslate . PluginName + ": " + m_tsmiCtxContainer . Text . Replace ( "&" , string . Empty ) ,
233238 MessageBoxButtons . YesNoCancel ) ;
234239 if ( r == DialogResult . Yes ) return AWMDuplicateHandling . Edit ;
0 commit comments