Some good examples of convention:
1. Name controllers with trailing word “Controller”
AccountController.cs
HomeController.cs
Monthly Archives: May 2014
Baby step 1 – getting around – links and such
Recipe:
1. Controller – add ActionResult to existing controller(HomeController)
2. View – add the Raisor CSHtml
1. Controller – add ActionResult to existing controller: /home/Controllers/HomeController.cs
namespace MVC_Richtest.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
public ActionResult About()
{
return View();
}
public ActionResult Argh()
{
return View();
}
}
}
2. Create a corresponding file in /views/Home/Argh.cshtml
@{
ViewBag.Title = "Argh";
}
<h2>Ahoy Matey</h2>
<p>
No doubt ye be wonderin' what this page be about. Well, argh, it is about nothin' special, see. And any scalaway sea cow's loving scourge should know better. Argh!
</p>
Log to debugger view
Step 1: define a TAG so we use log filters (can also be any string you choose)
static public String TAG= Activity.class.getName();
Step 2: write [ d=debug, e=error, i=info, v=verbose w=warning
Log.v(TAG, "Message here");
Button – click monitor onclick and onrelease
Button bXMinus = (Button) findViewById(R.id.btnXMinus);
bXMinus.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN) {
sendMessage("jog x -1");
} else if (event.getAction() == MotionEvent.ACTION_UP) {
sendMessage("jog x 0");
}
return true;
}
});