1/50 Project Management. 2/50 StumbleUpon 3/50 Overview Customize? Why, what, how?.NET Framework...
-
date post
21-Dec-2015 -
Category
Documents
-
view
217 -
download
1
Transcript of 1/50 Project Management. 2/50 StumbleUpon 3/50 Overview Customize? Why, what, how?.NET Framework...
3/50
Overview
Customize? Why, what, how?.NET Framework overview & fundamentals
Class libraries, namespaces, classesDeclaring and using variablesDefining and using functions
VS Projects & Solutions and folder/file organizationLayered Applications
Business Logic Layer & TestingPresentation Layer (Windows Forms)
4/50
Why customize ArcGIS ? Workflow.
Software does not do EXACTLY what you want to do “out-of-the-box” but has the programming infrastructure required that allows you to customize it to do exactly what you want
5/50
Extending ArcGIS, Add-ins, C#, & ArcObjects
Adding toolbars, buttons, tools, etc.ArcGIS 10.1 provides tools for making Python Add-insArcGIS 10.0 did not (Free webinar)
ArcObjects SDK for the Microsoft .NET Framework will be covered in GIS Customization IIArcObjects is more comprehensive than Python
6/50
ArcEngine
Build your own GIS-enabled appDoes not require ArcGIS but does require ArcEngine runtime ($)Not coveredin Customizationcourses
8/50
Overview
Customize? Why, what, how?.NET Framework overview & fundamentals
Class libraries, namespaces, classesDeclaring and using variablesDefining and using functions
VS Projects & Solutions and folder/file organizationLayered Applications
Business Logic Layer & TestingPresentation Layer (Windows Forms)
9/50
.NET Framework Overview
CLS (Common Language Specification)C#, VB.NET, Managed C++, J#
Framework Class Libraries
CLR (Common Language Runtime)
Windows OSWin32, IIS, MSMQ
Compilers
CIL (Common Intermediate Language)
UIWeb FormWinForm
WPF
ServicesWCF
WorkFlow
Data AccessADO.NET
Entity FramworkLINQ to SQL
Framework Base Classes & CTS (Common Type System)IO, Collections, Security, Threading, etc.
CLS specifes rules .NETlanguages must follow to create.NET code that will reference the.NET Framework Class Libraries(.NET DLL Assemblies) and.NET CTS.
.NET compilers will compile
.NET code into CIL stored in
.NET assemblies (EXE or DLL)
.NET CLR will perform JIT (Just-In-Time compilation) tonative machine code and ensure that the .NET assembly runs properly and securely.
10/50
System.Console.WriteLine() example
mscorlib is requiredby CLR so no referenceis required in code
11/50
Compiling and running
The 4.0 .NETFramework mustbe installed on thecomputer that willrun a 4.0 Assembly(EXE)
Use C# compilerto create hw.exe
Running assemblyinvokes JIT by CLRand runs app
12/50
using keyword for Namespaces
static keyword means you don’t need an instance of the class Program to call the function Main.
13/50
Class libraries, namespaces, classesClass Libraries are stored ina .NET assembly (DLL)
Namespaces are a way ofnaming a group of relatedclasses and other types.
Namespaces can be nested.
Namespaceicon
16/5016 of 29
Scope Review
public
internal (default)
protected
privateEntire solution
Assembly only
Derived classes
Class only
More …
More …
More …
More …
17/50
Types
Variable declaration syntax: [scope] [static] type name;
intlongdoublebooletc.
stringarrayetc.
.NET Classes
Classes youcreate.
18/50
Defining and calling functions
Syntax for defining functions: [scope] [static] return_type name ([params]){ // C# statements} 0 or more params are declared
like variables and comma separated.
22/50
Overview
Customize? Why, what, how?.NET Framework overview & fundamentals
Class libraries, namespaces, classesDeclaring and using variablesDefining and using functions
VS Projects & Solutions and folder/file organizationLayered Applications
Business Logic Layer & TestingPresentation Layer (Windows Forms)
23/50
Projects …
… because any application worth building usually has more than one .cs file and other files (e.g. images, cursors, etc.)
24/50
Solutions …
… because Projects must be part of a Solution
Projects (.csproj)*
Visual Studio Solution (.sln)
26/50
Creating an app dev folder
- Move files up one level into src - Delete solution folder
- Create a New Project … Blank Solution, in src- Save - Exit Visual Studio
Solutions can include code from other CLS languages (e.g. VB.NET)
30/50
StartUp Project
StartUp Project is the first project to run when the application is run
Class Library Projects cannot be set as the StartUp Project
31/50
Overview
Customize? Why, what, how?.NET Framework overview & fundamentals
Class libraries, namespaces, classesDeclaring and using variablesDefining and using functions
VS Projects & Solutions and folder/file organizationLayered Applications
Business Logic Layer & TestingPresentation Layer (Windows Forms)
32/50
Presentation Layer
Layered Applications
Business Logic Layer
Data
Data Access Layer
BLLBusiness objects & logic
DALRead/Write data from/toa database
33/50
Steps to building a layered application
1. Get requirements for application feature(s)2. Decide on a presentation layer and sketch it out
(no code)3. Create the …
Data access layer and tests, debugBusiness logic layer and tests, debugPresentation layer and connect to business layer, debug
4. Test the application5. Create installer6. Deploy application to users7. Repeat until all application features are complete
34/50
Creating a Business Layer
Add Class Library Project to SolutionSuffix name with BLL (e.g. IssueTrackerBLL)Add classes to represent the business objectsAdd properties and methods to these classes to represent the business data and processes respectively
35/50
Testing a Business Layer
Create a Test Project
Common to have one Test Project per application Project
Suffix Test Project name with “Tests”
38/50
Running the test – no debugging
With cursor in test method …
Or right-click and use TestDriven.NET
39/50
Running the test – with debugging
With cursor in test method …
Or right-click and use TestDriven.NET
Need Breakpoint(F9 to toggle)
41/50
Overview
Customize? Why, what, how?.NET Framework overview & fundamentals
Class libraries, namespaces, classesDeclaring and using variablesDefining and using functions
VS Projects & Solutions and folder/file organizationLayered Applications
Business Logic Layer & TestingPresentation Layer (Windows Forms)
42/50
Building a Presentation Layer (UI)
Add UI Application Project that satisfies the requirements
WindowsConsole ApplicationWindows Forms ApplicationWPF Application
WebASP.NET Web ApplicationASP.NET MVC ApplicationSilverlight Application
Suffix Project name with UIThis is the StartUp Project
43/50
Windows Forms Application
A Form is a container for UI controlsCommon for starting form to have name MainForm
Drag & Drop from Toolbox
44/50
Naming child controls
Give child control names prefixesbtn = Buttontxt = TextBoxlbl = Labellst = ListBoxcbo = ComboBoxrdo = RadioButtonetc.
Adding code to controls … Double-click control or code by hand
45/50
“Connecting” the UI and BLL
Add Reference in UI to BLL Project
Add using to UI code(MainForm.cs in this example)
47/50
Links for VS 2010 and C#
“Quick Tour” of the VS 2010 IDE
Beginner Developer Learning Centre
Csharp-station.com tutorial
48/50
Keys to remember
F1 – Context sensitive Help (If cursor is on keyword, help on keyword provided)
F6 – Build code (compile) without runningF5 – Build code (compile) and runF11 – Step through code, into called functionsF10 – Step through code, not into called
functionsShift-F5 – Stop running code F9 – Toggle Breakpoint at current statement
49/50
Overview
Customize? Why, what, how?.NET Framework overview & fundamentals
Class libraries, namespaces, classesDeclaring and using variablesDefining and using functions
VS Projects & Solutions and folder/file organizationLayered Applications
Business Logic Layer & TestingPresentation Layer (Windows Forms)