If I assign value to Button.Enabled property and then read it back right away after it then it will not read back the new state.
btnDecrypt.Enabled = mSelectedFile <> Nothing And tbName.Text.Length > 1
Var fm As MenuItem = Self.MenuBar.FindItemByTag("decrypt")
If fm <> Nothing Then
fm.Enabled = btnDecrypt.Enabled # Here we will not be reading the new state of the btnDecrypt.Enabled
End If
So in the code above then it will take 2 rounds to get the menu enabled. (which by that time might be wrong state)
The code bellow works since it does not read back the btnDecrypt.Enabled property.
btnDecrypt.Enabled = mSelectedFile <> Nothing And tbName.Text.Length > 1
Var fm As MenuItem = Self.MenuBar.FindItemByTag("decrypt")
If fm <> Nothing Then
fm.Enabled = mSelectedFile <> Nothing And tbName.Text.Length > 1
End If