Let's say that we have a class
public class Account
{
public string HostName { get; set; }
if (this.ActiveControl.GetType() == typeof(TextBox)) | |
{ | |
TextBox textBox = (TextBox)this.ActiveControl; | |
String text = ((Label)sender).Text; | |
int pos = textBox.SelectionStart; | |
textBox.Text = textBox.Text.Insert(pos, text); | |
//Fix cursor position | |
textBox.Focus(); | |
textBox.SelectionStart = pos; | |
textBox.SelectionLength = text.Length; |
//When using MFC wizard to generate a project, it will ask developer to choose an application look style. | |
//Say we have chosen "Office 2007 Blue" as default and want to change it into "Windows 7". Here is how to: | |
//1. In MainFrm.cpp, we will see: | |
CMainFrame::CMainFrame() | |
{ | |
// TODO: add member initialization code here | |
theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_OFF_2007_BLUE); | |
} |
protected override CreateParams CreateParams | |
{ | |
get | |
{ | |
CreateParams cp = base.CreateParams; | |
//WS_EX_TOOLWINDOW = 0x80 | |
cp.ExStyle |= 0x80; | |
return cp; | |
} | |
} |
/// <summary> | |
/// Inject onclick handler to close button | |
/// </summary> | |
private void InjectJS() | |
{ | |
HtmlDocument doc = webContent.Document; | |
HtmlElement closeBtnElement = doc.GetElementById(CloseButtonId); | |
if (closeBtnElement == null) | |
return; |
HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection(); | |
String sHeader = httpConnection.getHeaderFieldKey(i); | |
if (sHeader.equals("content-length")) { | |
//Unpredictable | |
//Under the same server setup, the API level before 2.3.3 will return true. | |
//But not this one | |
} | |
var account = new Account(); | |
var validator = new AccountValidator(); | |
account.Map<validator>( | |
) |
#!/bin/sh | |
# Helper | |
safeRunCommand() { | |
typeset cmd="$*" | |
typeset ret_code | |
echo cmd=$cmd | |
eval $cmd | |
ret_code=$? |
Injected script has no access to chrome.i18n
namespace. It would be a problem when injected script requires some i18n work.
A solution is describled in this documentation.
The i18n method proposed in this official documentation suggests that develops put all i18n string in messages.json
file.
/* converted on Thu Feb 6, 2014, 00:09 (UTC+08) by jison-to-w3c v0.33.722 which is Copyright (c) 2011-2013 by Gunther Rademacher <[email protected]> */ | |
Root ::= Body? | |
Body ::= Line ( TERMINATOR Line | TERMINATOR )* | |
Line ::= Expression | |
| Statement | |
Statement | |
::= Return | |
| Comment | |
| STATEMENT |