Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 1 Making a C# GUI Program

Similar presentations


Presentation on theme: "Lecture 1 Making a C# GUI Program"— Presentation transcript:

1 Lecture 1 Making a C# GUI Program
CS1S467 GUI Programming Lecture 1 Making a C# GUI Program

2 I am Dr Peter Plassmann peter.plassmann@southwales.ac.uk
J226 (office) / J150 (lab) 01443 /

3 My Co-Lecturer Dr Mark Ware
J302 (office) /

4 Today RU Here Lecture slides are NOT good for learning Module content
Difference Interpretation – Compilation .NET overview Structure of a C# program Lab preview

5 https://ruhere.southwales.ac.uk/

6 RFID Card Readers

7 RU Here Card

8 Electronic Register

9 Today RU Here Lecture slides are NOT good for learning Module content
Difference Interpretation – Compilation .NET overview Structure of a C# program Lab preview

10 Lecture Slides Lecture Slides are unsuitable for learning how to program! You just get an illusion of learning! Programming is a craft. You have to do it to learn it.

11 Can you ride a bike by knowing this?
Lecture Slides Can you ride a bike by knowing this?

12 Occasionally in Lectures
Lecture Slides This Lecture Occasionally in Lectures Labs, & Home

13 Today RU Here Lecture slides are NOT good for learning Module content
Difference Interpretation – Compilation .NET overview Structure of a C# program Lab preview

14 Timetable You Lectures Labs
1 hour lecture Mondays, 11:00 to 12:00, H230 Labs 2 hours lab Thursdays, 15:00 to 17:00, J113 You should all be Information Communications Technology (BSc / MComp) students

15 Assessment No Exam 2 Courseworks We know, you must be gutted...
In labs, programming tasks CW 1: 40% CW 2: 60% To pass: CW1 * CW2 *0.6 > 40%

16 Module Content BlackBoard tour now (content, assignments, books, resources, labs, ...)

17 We Are Using C# C ‘dialect’ by MS (derived from J++ but a $20 million legal dispute later…) C is most popular programming language (Java, C# 2nd) Identical principle, different implementation: C# under .NET Java under JVM (Java Virtual Machine)

18 We Are Using Visual Studio 2017

19 Today RU Here Lecture slides are NOT good for learning Module content
Difference Interpretation – Compilation .NET overview Structure of a C# program Lab preview

20 Making a Python Program
Hello.py Human readable text file Interpretation of text file by Python Interpreter - line by line: translate to machine code, then run - this is VERY slow Python Interpreter for Windows PC Python Interpreter for Ubuntu PC Python Interpreter for Android Phone Output always the same “Hello World” “Hello World” “Hello World”

21 Making a C Program Hello.c Hello.exe “Hello World”
Human readable text file Compilation of text file by the C compiler (e.g. gcc) Executable file, runs directly on the target system (but not other systems) Hello.exe Running of .EXE executable by target OS only Windows PC Ubuntu PC Android Phone “Hello World”

22 Making a Java Program Hello.java Hello.class “Hello World”
Human readable text file Compilation of text file by ‘javac’ compiler ‘Byte Code’ file, interpreted by different dedicated Java Virtual Machines (JVMs) Hello.class JVM for Windows PC JVM for Ubuntu PC JVM for Android Phone Interpretation of Byte Code by JVMs Output always the same “Hello World” “Hello World” “Hello World”

23 monoDroid for Android Phone
Making a C# Program Hello.cs Human readable text file Compilation of text file by C# compiler into CIL (Common Intermediate Language) .exe CIL executable, JIT (Just In Time) compiled by the .NET or mono CLR (the Common Language Runtime) Hello.exe Running of exe Code under the .NET/mono CLR .NET for Windows PC mono for Ubuntu PC monoDroid for Android Phone Output always the same “Hello World” “Hello World” “Hello World”

24 Today RU Here Lecture slides are NOT good for learning Module content
Difference Interpretation – Compilation .NET overview Structure of a C# program Lab preview

25 CIL+CLR+BCL+"stuff" = .NET
We are using these parts only The .NET Framework Stack from:

26 Why the Complexity? Safety of code execution (e.g. array buffer overflows) Garbage collection (avoid memory leaks) Operating Systems agnostic (develop once, run anywhere. Java OK, Microsoft - kicking & screaming - .NET going Open Source) Many languages - 1 platform now some details……

27 Today RU Here Lecture slides are NOT good for learning Module content
Difference Interpretation – Compilation .NET overview Structure of a C# program Lab preview

28 Structure of a C# Program
Every C# (and Java, C, VB, ...) Program starts with ‘Main()’ ‘Main()’ is located in the ‘Program.cs’ file: using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace ExampleProgram { static class Program // The main entry point for the application. static void Main() Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }

29 Structure of a C# Program
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ExampleProgram { public partial class Form1 : Form public Form1() InitializeComponent(); } The ‘Form1.cs’ file Application.Run(new Form1());

30 Structure of a C# Program
The ‘bits and pieces: ‘using’: libraries with functionality, most default ones not needed ‘namespace’: combines multiple .cs files to a single program, normally one file contains one class ‘public partial class’: several classes make a program, required for OO programming. ‘{‘ and ‘}’ brackets: a pair defines a block. Note the alignment using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ExampleProgram { public partial class Form1 : Form public Form1() InitializeComponent(); }

31 Today RU Here Lecture slides are NOT good for learning Module content
Difference Interpretation – Compilation .NET overview Structure of a C# program Lab preview

32 Preview of Lab Session Where are the files? Where is my exectutable?
Debug vs. Release How to copy a C# Project between computers The ‘Properties’ pane The ‘Toolbox’ pane How to run, how to stop a program

33 End of Lecture 1


Download ppt "Lecture 1 Making a C# GUI Program"

Similar presentations


Ads by Google