<Window WindowStyle="None" MouseLeftButtonDown="WindowMouseLeftButtonDown"/>
<x:Code>
<![CDATA[
private void WindowMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DragMove();
}
]]>
</x:Code>
</Window>
http://stackoverflow.com/a/19136910 The code highlighter should be for XAML/XML, but there's no such highlighting option, so I used HTML.
try {
$order->addItem($item);
} catch (Exception $ex) {
throw $ex;
}
if (SelectionAndTimeData[1] < 2000 or \
SelectionAndTimeData[2] < 1 or SelectionAndTimeData[2] > 12 or \
SelectionAndTimeData[3] < 1 or SelectionAndTimeData[3] > 31 or \
SelectionAndTimeData[4] < 0 or SelectionAndTimeData[4] > 24 or \
SelectionAndTimeData[5] < 0 or SelectionAndTimeData[5] > 60 or \
SelectionAndTimeData[2] < 0 or SelectionAndTimeData[2] >60):
print('***************************************************************************')
print(' Entered date is not valid')
print('****************************************************************************')
@Override
public void afterTextChanged(Editable s) {
switch (paymentType) {
case 0:
if (s.length() == 9) etPaymentAmount.requestFocus();
break;
case 1:
if (s.length() == 9) etPaymentAmount.requestFocus();
break;
}
}
public void Method1(Enum foo)
{
if (GetCondition1(foo))
{
doSomething();
}
}
private bool GetCondition1(Enum foo)
{
if (foo == Enum.Value1)
return true;
return false;
}
protected void EnableEditButtons(bool Value)
{
if (Value == false)
{
buttonAdd.Disabled = true;
buttonDelete.Disabled = true;
}
else
{
buttonAdd.Disabled = false;
buttonDelete.Disabled = false;
}
}
// ...
if (IsEditable(ID))
EnableEditButtons(true);
else
EnableEditButtons(false);
I found this old code in an app I was updating for a client a number of years back. It was so good I documented it on my own blog.
for(var j=0;j<10;j++){
cell=document.createElement('td');
switch(j)
{
case 0:
var date1 = events[i]['start'];
var date2 = events[i]['end'];
cell.appendChild(document.createTextNode(date1.getFullYear()+'/'+date1.getMonth()+'/'+date1.getDate()+' '+date1.getHours()+':'+date1.getMinutes()+' To '+date2.getFullYear()+'/'+date2.getMonth()+'/'+date2.getDate()+' '+date2.getHours()+':'+date2.getMinutes()));
break;
case 1: cell.appendChild(document.createTextNode(events[i]['title'])); break;
case 2: cell.appendChild(document.createTextNode(events[i]['description'])); break;
}
row.appendChild(cell);
}
The for loop that counts to 10, but the last seven
public enum YesNoEnum
{
Yes = 0,
No = 1
}
I also like how they defined the enum values.
<input type="button" value="Go and fill later" onclick="javascript:window.location='<?php echo $url; ?>info.php'" />
Well, a
is obsolete, let's do links as buttons!
if let _ = detailInformation {
loadDetailInformation()
}
when optionals are killing yourself
if( %rightBtnCmd $= "noButtons" )
{
//do nothing, as there are no buttons
}
proprietary script language.
public boolean logout(String token)
{
LogedUser user = logedUsers.remove(token);
return (user != null) ? true : false;
}
var validAccountData = account.email != nil
validAccountData = account.firstName != nil
validAccountData = account.lastName != nil
if validAccountData {
return account
}
return nil
Proper validation