Sunday, November 29, 2015

Let's code visual studio community 2015

Let's take on a quest of developing apps for Windows.

I started by searching for books. I found an article that suggested to use a free IDE called visual studio community 2015. Link to article.

Then I found a tutorial video on YouTube. I recommend starting with part two here (at 9min 45sec). Of course install the IDE first. Program was generated from a template as seen at 55 seconds in that video.

From the start screen inside IDE I discovered some sample code. Use this link to get there. BasicInput caught my attention. After downloading the master ZIP file, extracting and opening the .SLN file, IDE told me to install additional content to work with UWP (universal windows platform). The IDE is about 6gb large, no idea how large the UWP is. I'm waiting for the download.

I created website https://livingwater.visualstudio.com in the setup wizard of IDE. Maybe it has something of use there,

Aha! A little bit more hands-on in this video (at 13:05). Starting interface setup ends at 25:05. In terms of MVC (model view controller), model and view are done in the 1st hour. Here starts program logic wiring (connecting UI with functionality coding).


Summary of app building
  • In a solution create new project of windows forms application in C# language. That will hold the UI of a program.
  • Create UI elements using toolbox to the left in IDE. Simple elements like buttons, labels and text areas can be found under "common controls". Text area is simply TextBox with enabled multiple lines in element properties.
  • Create another project of class library in C# under same solution to hold data.
  • Create class with "add" (Ctrl+Shift+A), make class public, type prop and hit Tab twice to add variables to the class.
  • Variable types I learned about: int, string, bool, decimal, double, List<className> (basically an array of class objects)
  • Edit UI logic by right clicking the windows forms app (extension .CS) and selecting View code (F7) 
  • Connect class library to windows forms app. In video it's at 42:40. Right click "references" in windows forms app, select "Project" on the left (and solution under that), check the class library checkbox.
  • Create constructor from snippet by typing ctor and hitting Tab twice (at 53:25). No return variable preceding. 
  • If any Lists<> are used, instantiate them in parent class constructor. Lists have method Add(). Use it as functionName(new class {args}) and end with semicolon ;
  • Create BindingSource var=new BindingSource(); in the windows forms app main class. 
  • Assign event to button (at 1:20:8). MessageBox.Show("string");
  • Refresh bindings with bindingObject.ResetBindings(false); A fancy way of transferring data between objects.
  • ListBox actions Add() and Clear(). Foreach loop: Where(x => x.property == comparison), foreach(Class var in obj).
  • Filter applied twice, use method ToList(). Update bindings.

More progress updates as they come.


No comments:

Post a Comment