SlideShare ist ein Scribd-Unternehmen logo
1 von 57
Downloaden Sie, um offline zu lesen
Tool Development
Chapter 01: Introduction to Tool Development
Nick Prühs
About Me
“Best Bachelor“ Computer Science
Kiel University, 2009
Master Games
Hamburg University of Applied Sciences,
2011
Lead Programmer
Daedalic Entertainment, 2011-2012
Co-Founder
slash games, 2013
Microsoft MVP
2015
2 / 79
First Things First
• At npruehs.de/teaching you‘ll always find
• these slides
• solutions to all assignments
• Ask your questions – any time!
• Each lecture will close with
• further reading
• an optional assignment
• Contact me any time at dev@npruehs.de!
3 / 58
Objectives
• To get an idea of the basic development process of
good Desktop applications
• To understand the importance of good UI and UX
design
• To learn how to development a basic Desktop
application with Windows Presentation Foundation
4 / 58
Motivation
“You wouldn't use a
screwdriver on a nail.”
5 / 60
Motivation
• First, you should make the tools!
• Save development time
• Can be shipped to players
• Can even be your main business field (Adobe, Nevigo)
6 / 58
StarCraft II World Editor
Motivation
• Highly workflow-dependent
• Level Editor
• Blueprint Editor
• Common Functionality
• New
• Load & Save
• Selection & Inspector
• Brush
• Perspectives & Zoom
• Copy & Paste & Cut
• Undo & Redo
• Settings
• Test Run
7 / 58
Requirements
• Responsiveness
• Avoid blocking UI!
8 / 58This should never happen!
Requirements
• Robust error handling
• Handle exceptions!
9 / 58
This must never happen. Never, never, never, never, never!
Requirements
• Extensibility
• Adaptive window size
• Backward compatibility
• WYSIWYG
• Localization
• Security Context
10 / 58
Development Process
1. Design
1. Define Functional Requirements
2. Analyze Target Group
3. Develop Overall Application Architecture
2. Implement
1. Create Prototypes
2. Develop Application
3. Test
1. Write Unit Tests
2. Perform Usability Tests
11 / 58
UI Design Guidelines
• Less UI is better UI.
• The more functionality that is exposed at any one time,
the more difficult it is for a user to find the functionality
that they need.
• Consistent UI is good UI.
• Providing a consistent UI enables a user to become more
proficient with an application in a much shorter time.
12 / 58
UX Design Guidelines
• Support the minimum Windows effective
resolution of 800x600 pixels.
• Use determinate progress bars for operations that
require a bounded amount of time.
• Even if that amount of time cannot be accurately
predicted.
• Tab order should flow from left to right, top to
bottom.
13 / 58
UX Design Guidelines
• Assign shortcut keys to the most commonly used
commands.
• It's rude to interrupt.
• When an application displays a dialog box, it forces the
user to stop whatever it is that they are doing and pay
attention to something else. If it is possible, remove the
need for a dialog box completely by avoiding error cases
and other disruptive user experiences.
• And many, many, many, many more… (see
References)
14 / 58
Model-View-Controller
• Design pattern that separates data from its visual
representation
• Model: Data, such as names, phone numbers, or health
points.
• View: Visual representation of that data, such as console
output, UI textfields or health bars.
• Controller: Layer that separates model from view,
serving as interface for any interaction with the data.
15 / 58
Model-View-Controller
16 / 58
Model-View-Controller
• Allows exchanging views or modifying the model
without breaking existing functionality.
• For instance, write console client first and GUI client
after.
• Greatly improves your application architecture
through separation of concerns.
• Anybody always knows where to look in your code.
17 / 58
Introduction to Windows
Presentation Foundation (WPF)
• Presentation system for building Windows client
applications
• Part of the Microsoft .NET Framework
• Both standalone and browser-hosted applications
• Resolution-independent and vector-based
rendering engine
18 / 58
Architecture of
WPF Applications
• Extensible Application Markup Language
(XAML) markup for defining the application
appearance
• XML-based markup language
• Used to create windows, dialog boxes, pages, and
controls
• Code-Behind for defining the application behavior
• Responds to user interaction
• Implements Business Logic
19 / 58
WPF Example #1
XAML
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Window with Button" Width="250" Height="100">
<!-- Add button to window. -->
<Button Name="button">Click Me!</Button>
</Window>
20 / 58
Rendered View
WPF Example #2
XAML
21 / 58
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="WpfApplication1.MainWindow"
Title="Window with Button"
Width="250" Height="100">
<Button Name="Button" Click="button_Click">Click Me!</Button>
</Window>
WPF Example #2
XAML
22 / 58
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="WpfApplication1.MainWindow"
Title="Window with Button"
Width="250" Height="100">
<Button Name="Button" Click="button_Click">Click Me!</Button>
</Window>
WPF Example #2
XAML
23 / 58
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="WpfApplication1.MainWindow"
Title="Window with Button"
Width="250" Height="100">
<Button Name="Button" Click="button_Click">Click Me!</Button>
</Window>
WPF Example #2
C#
24 / 58
namespace WpfApplication1
{
public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
}
void button_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Hello, Windows Presentation Foundation!");
}
}
}
WPF Example #2
C#
25 / 58
namespace WpfApplication1
{
public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
}
void button_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Hello, Windows Presentation Foundation!");
}
}
}
WPF Example #2
C#
26 / 58
namespace WpfApplication1
{
public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
}
void button_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Hello, Windows Presentation Foundation!");
}
}
}
WPF Example #2
C#
27 / 58
namespace WpfApplication1
{
public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
}
void button_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Hello, Windows Presentation Foundation!");
}
}
}
WPF Example #2
Rendered View
28 / 58
Excursus: C# Events
• Enable a class or object to notify other classes or
objects when something of interest occurs
• Class that sends (or raises) the event is called the
publisher.
• Classes that receive (or handle) the event are called
subscribers.
29 / 58
C# Events
• Events are declared using delegates.
• Similar to “function pointer”
• Type that defines a method signature
• Used to pass methods as arguments to other methods
• Clients give the class delegates to methods that
should be called when the event occurs.
• When the event occurs, the delegate(s) given to the
class are invoked.
30 / 58
C# Events Example
C#
31 / 58
public class Actor
{
private int health;
public int Health
{
get { return this.health; }
set { this.health = value; }
}
}
C# Events Example
C#
32 / 58
public class Actor
{
private int health;
public delegate void HealthChangedDelegate(int newHealth);
public event HealthChangedDelegate HealthChanged;
public int Health
{
get { return this.health; }
set { this.health = value; }
}
}
C# Events Example
C#
33 / 58
set
{
if (this.health == value)
{
return;
}
this.health = value;
HealthChangedDelegate handler = this.HealthChanged;
if (handler != null)
{
handler(this.health);
}
}
C# Events Example
C#
34 / 58
set
{
if (this.health == value)
{
return;
}
this.health = value;
HealthChangedDelegate handler = this.HealthChanged;
if (handler != null)
{
handler(this.health);
}
}
C# Events Example
C#
35 / 58
set
{
if (this.health == value)
{
return;
}
this.health = value;
HealthChangedDelegate handler = this.HealthChanged;
if (handler != null)
{
handler(this.health);
}
}
C# Events Example
C#
36 / 58
public class HealthBar
{
public HealthBar(Actor actor)
{
actor.HealthChanged += this.OnHealthChanged;
}
private void OnHealthChanged(int newHealth)
{
// Update health bar...
}
}
WPF Application Class
• Handles startup and lifetime management, shared
properties, and shared resources
• Supports both standalone and browser-hosted
applications
XAML
<Application x:Class="WpfApplication1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml" />
37 / 58
WPF Application Class
• Handles startup and lifetime management, shared
properties, and shared resources
• Supports both standalone and browser-hosted
applications
XAML
<Application x:Class="WpfApplication1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml" />
38 / 58
WPF Controls
• Basic Controls
• Labels
• Buttons
• Textboxes
• Checkboxes, ComboBoxes, RadioButtons
• Panels, Boxes, Scrollbars
• Menus, Dialog Boxes
• Progress Bars, Status Bars
• Advanced Controls
• Grids, Lists and Trees
• Calendars
• Document Viewers (XPS, *sigh*…)
• Images, Media Players
39 / 58
Label Control
Text label for a control.
XAML
<Label>This is a label.</Label>
Rendered View
40 / 58
Button Control
Button that reacts to the mouse clicks.
XAML
<Button Name="ButtonQuit“ Click="ButtonQuit_OnClick">
Quit
</Button>
Rendered View
41 / 58
TextBox Control
Used to display or edit text.
XAML
<TextBox Name="TextBoxName" TextChanged="TextBoxName_OnTextChanged">
Please enter your name!
</TextBox>
Rendered View
42 / 58
CheckBox Control
Control that a user can select and clear.
XAML
<CheckBox Name="CheckBoxEnabled“ IsChecked="True"
Checked="CheckBoxEnabled_OnChecked“
Unchecked="CheckBoxEnabled_OnUnchecked">
Enabled
</CheckBox>
Rendered View
43 / 58
RadioButton Control
Control that a user can select, but not clear.
XAML
<StackPanel>
<RadioButton Name="RadioButtonColorRed" GroupName="Color“ IsChecked="True"
Checked="RadioButtonColorRed_OnChecked">Red</RadioButton>
<RadioButton Name="RadioButtonColorGreen" GroupName="Color“
Checked="RadioButtonColorGreen_OnChecked">Green</RadioButton>
<RadioButton Name="RadioButtonColorBlue" GroupName="Color“
Checked="RadioButtonColorBlue_OnChecked">Blue</RadioButton>
</StackPanel>
44 / 58
RadioButton Control
Control that a user can select, but not clear.
Rendered View
45 / 58
ComboBox Control
Drop-down list that can be shown or hidden by
clicking the arrow on the control.
XAML
<ComboBox Name="ComboBoxColor" />
C#
this.ComboBoxColor.ItemsSource =
new List<string> { "Red", "Green", "Blue" };
46 / 58
ComboBox Control
Drop-down list that can be shown or hidden by
clicking the arrow on the control.
Rendered View
47 / 58
WPF UI Layout
• Defined by location and size of all controls
• Has to adapt to changes in window size
• This is achieved by relative positioning.
• Determining the final layout is done in two steps:
1. Control tells its parent what location and size it
requires.
2. Parent tells the control what space it can have.
48 / 58
WPF UI Layout Example
XAML
49 / 58
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="WpfApplication1.MainWindow"
Title="Layout with the DockPanel" Height="143" Width="319">
<!-- DockPanel to layout four text boxes. -->
<DockPanel>
<TextBox DockPanel.Dock="Top">Dock = "Top"</TextBox>
<TextBox DockPanel.Dock="Bottom">Dock = "Bottom"</TextBox>
<TextBox DockPanel.Dock="Left">Dock = "Left"</TextBox>
<TextBox Background="White">This TextBox "fills" the remaining space.</TextBox>
</DockPanel>
</Window>
WPF UI Layout Example
Rendered View
50 / 58
Assignment #1
1. Create New Project
1. Download and install Visual Studio Community 2015
from https://www.visualstudio.com/en-us.
2. Create a new WPF application called LevelEditor.
3. Change the title of your MainWindow in the
MainWindow.xaml file.
4. Change the size of your main window to 800 x 600
pixels.
51 / 58
Assignment #1
2. Model-View-Controller
1. Create three folders in your project named Model,
View and Control.
2. Move App.xaml (and App.xaml.cs) to the Control
folder.
3. Move MainWindow.xaml (and MainWindow.xaml.cs)
to the View folder.
4. Update the namespaces and folders of all four files
accordingly.
5. In the MainWindow constructor, grab a reference to
App via the static Application.Current property.
52 / 58
Assignment #1
3. Quit Button
1. In App.xaml.cs, add a Quit method that calls the
application Shutdown method.
2. Add a Quit button to MainWindow.xaml.
3. In MainWindow.xaml.cs, implement the Click event
handler of the button, calling the Quit method of your
App class.
53 / 58
Assignment #1
4. About Window
1. Create a new window called AboutWindow in your View folder.
2. Add some nice information (e.g. your name, application version
number) to that window using the <TextBlock> and
<LineBreak/> tags.
3. In App.xaml.cs, add a About method that instantiates a new
AboutWindow object and calls its Show method.
4. Add an About button to MainWindow.xaml.
5. Change the surronding panel in MainWIndow.xaml from Grid to
DockPanel in order to prevent both buttons from overlapping.
6. In MainWindow.xaml.cs, implement the Click event handler of
the button, calling the About method of your App class.
54 / 58
References
• MSDN. Overview of the User Interface Development Process.
http://msdn.microsoft.com/en-
us/library/windows/desktop/ff728828%28v=vs.85%29.aspx, April 2016.
• MSDN. Implementing a User Interface. http://msdn.microsoft.com/en-
us/library/windows/desktop/ff728823%28v=vs.85%29.aspx, April 2016.
• MSDN. UX checklist for desktop applications.
http://msdn.microsoft.com/en-
us/library/windows/desktop/dn742479.aspx, April 2016.
• MSDN. Windows Presentation Foundation.
http://msdn.microsoft.com/en-us//library/ms754130.aspx , April 2016.
• MSDN. Introduction to WPF. https://msdn.microsoft.com/en-
us/library/mt149842.aspx, April 2016.
• MSDN. Delegates (C# Programming Guide).
http://msdn.microsoft.com/en-us/library/ms173171.aspx, April 2016.
• MSDN. Events (C# Programming Guide). http://msdn.microsoft.com/en-
us/library/awbftdfh.aspx, April 2016.
55 / 58
Thank you!
http://www.npruehs.de
https://github.com/npruehs
@npruehs
dev@npruehs.de
5 Minute Review Session
• Why should you make tools as early as possible?
• Name a few important requirements for all tools!
• What is Model-View-Controller?
• What is the basic architecture of a WPF application?
• How are C# events used?
• How do you define the entrance point of a WPF
application?
• How are the controls arranged by the WPF layout
engine?
• How do you bind data to a WPF control?
57 / 58

Weitere ähnliche Inhalte

Ähnlich wie Tool Development 01 - Introduction to Tool Development

Multi Platform User Exerience
Multi Platform User ExerienceMulti Platform User Exerience
Multi Platform User Exerience
Tanya Zavialova
 
PLATEAU 2011 - Capturing and Analyzing Low-Level Events from the Code Editor
PLATEAU 2011 - Capturing and Analyzing Low-Level Events from the Code EditorPLATEAU 2011 - Capturing and Analyzing Low-Level Events from the Code Editor
PLATEAU 2011 - Capturing and Analyzing Low-Level Events from the Code Editor
YoungSeok Yoon
 

Ähnlich wie Tool Development 01 - Introduction to Tool Development (20)

Introduction to UX for Mesiniaga Academy
Introduction to UX for Mesiniaga AcademyIntroduction to UX for Mesiniaga Academy
Introduction to UX for Mesiniaga Academy
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
 
Common Project Mistakes (And How to Avoid Them)
Common Project Mistakes (And How to Avoid Them)Common Project Mistakes (And How to Avoid Them)
Common Project Mistakes (And How to Avoid Them)
 
Android by Swecha
Android by SwechaAndroid by Swecha
Android by Swecha
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0
 
Unit 2
Unit 2Unit 2
Unit 2
 
The Bespoke Software Product Factory (2007)
The Bespoke Software Product Factory (2007)The Bespoke Software Product Factory (2007)
The Bespoke Software Product Factory (2007)
 
TLC2018 Thomas Haver: The Automation Firehose - Be Strategic and Tactical
TLC2018 Thomas Haver: The Automation Firehose - Be Strategic and TacticalTLC2018 Thomas Haver: The Automation Firehose - Be Strategic and Tactical
TLC2018 Thomas Haver: The Automation Firehose - Be Strategic and Tactical
 
Devry cis 321 week 7 milestone 5 and milestone 6
Devry cis 321 week 7 milestone 5 and milestone 6Devry cis 321 week 7 milestone 5 and milestone 6
Devry cis 321 week 7 milestone 5 and milestone 6
 
Tool Development 09 - Localization & Testing
Tool Development 09 - Localization & TestingTool Development 09 - Localization & Testing
Tool Development 09 - Localization & Testing
 
Better User Experience with .NET
Better User Experience with .NETBetter User Experience with .NET
Better User Experience with .NET
 
OOSE UNIT-1.pdf
OOSE UNIT-1.pdfOOSE UNIT-1.pdf
OOSE UNIT-1.pdf
 
User Experience Design for Embedded Devices
User Experience Design for Embedded DevicesUser Experience Design for Embedded Devices
User Experience Design for Embedded Devices
 
UX (User Experience) Process, May 2017
UX (User Experience) Process, May 2017UX (User Experience) Process, May 2017
UX (User Experience) Process, May 2017
 
Citrix Labs Rapid Prototyping Workshop
Citrix Labs Rapid Prototyping WorkshopCitrix Labs Rapid Prototyping Workshop
Citrix Labs Rapid Prototyping Workshop
 
Multi Platform User Exerience
Multi Platform User ExerienceMulti Platform User Exerience
Multi Platform User Exerience
 
Introduction to Software Engineering.ppt
Introduction to Software Engineering.pptIntroduction to Software Engineering.ppt
Introduction to Software Engineering.ppt
 
MODEL-DRIVEN ENGINEERING (MDE) in Practice
MODEL-DRIVEN ENGINEERING (MDE) in PracticeMODEL-DRIVEN ENGINEERING (MDE) in Practice
MODEL-DRIVEN ENGINEERING (MDE) in Practice
 
Usability principles 1
Usability principles 1Usability principles 1
Usability principles 1
 
PLATEAU 2011 - Capturing and Analyzing Low-Level Events from the Code Editor
PLATEAU 2011 - Capturing and Analyzing Low-Level Events from the Code EditorPLATEAU 2011 - Capturing and Analyzing Low-Level Events from the Code Editor
PLATEAU 2011 - Capturing and Analyzing Low-Level Events from the Code Editor
 

Mehr von Nick Pruehs

Mehr von Nick Pruehs (20)

Unreal Engine Basics 06 - Animation, Audio, Visual Effects
Unreal Engine Basics 06 - Animation, Audio, Visual EffectsUnreal Engine Basics 06 - Animation, Audio, Visual Effects
Unreal Engine Basics 06 - Animation, Audio, Visual Effects
 
Unreal Engine Basics 05 - User Interface
Unreal Engine Basics 05 - User InterfaceUnreal Engine Basics 05 - User Interface
Unreal Engine Basics 05 - User Interface
 
Unreal Engine Basics 04 - Behavior Trees
Unreal Engine Basics 04 - Behavior TreesUnreal Engine Basics 04 - Behavior Trees
Unreal Engine Basics 04 - Behavior Trees
 
Unreal Engine Basics 03 - Gameplay
Unreal Engine Basics 03 - GameplayUnreal Engine Basics 03 - Gameplay
Unreal Engine Basics 03 - Gameplay
 
Unreal Engine Basics 02 - Unreal Editor
Unreal Engine Basics 02 - Unreal EditorUnreal Engine Basics 02 - Unreal Editor
Unreal Engine Basics 02 - Unreal Editor
 
Unreal Engine Basics 01 - Game Framework
Unreal Engine Basics 01 - Game FrameworkUnreal Engine Basics 01 - Game Framework
Unreal Engine Basics 01 - Game Framework
 
Game Programming - Cloud Development
Game Programming - Cloud DevelopmentGame Programming - Cloud Development
Game Programming - Cloud Development
 
Game Programming - Git
Game Programming - GitGame Programming - Git
Game Programming - Git
 
Eight Rules for Making Your First Great Game
Eight Rules for Making Your First Great GameEight Rules for Making Your First Great Game
Eight Rules for Making Your First Great Game
 
Designing an actor model game architecture with Pony
Designing an actor model game architecture with PonyDesigning an actor model game architecture with Pony
Designing an actor model game architecture with Pony
 
Game Programming 13 - Debugging & Performance Optimization
Game Programming 13 - Debugging & Performance OptimizationGame Programming 13 - Debugging & Performance Optimization
Game Programming 13 - Debugging & Performance Optimization
 
Scrum - but... Agile Game Development in Small Teams
Scrum - but... Agile Game Development in Small TeamsScrum - but... Agile Game Development in Small Teams
Scrum - but... Agile Game Development in Small Teams
 
Component-Based Entity Systems (Demo)
Component-Based Entity Systems (Demo)Component-Based Entity Systems (Demo)
Component-Based Entity Systems (Demo)
 
What Would Blizzard Do
What Would Blizzard DoWhat Would Blizzard Do
What Would Blizzard Do
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine Basics
 
Tool Development A - Git
Tool Development A - GitTool Development A - Git
Tool Development A - Git
 
Game Programming 12 - Shaders
Game Programming 12 - ShadersGame Programming 12 - Shaders
Game Programming 12 - Shaders
 
Game Programming 11 - Game Physics
Game Programming 11 - Game PhysicsGame Programming 11 - Game Physics
Game Programming 11 - Game Physics
 
Game Programming 10 - Localization
Game Programming 10 - LocalizationGame Programming 10 - Localization
Game Programming 10 - Localization
 
Game Programming 09 - AI
Game Programming 09 - AIGame Programming 09 - AI
Game Programming 09 - AI
 

Kürzlich hochgeladen

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Kürzlich hochgeladen (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Tool Development 01 - Introduction to Tool Development

  • 1. Tool Development Chapter 01: Introduction to Tool Development Nick Prühs
  • 2. About Me “Best Bachelor“ Computer Science Kiel University, 2009 Master Games Hamburg University of Applied Sciences, 2011 Lead Programmer Daedalic Entertainment, 2011-2012 Co-Founder slash games, 2013 Microsoft MVP 2015 2 / 79
  • 3. First Things First • At npruehs.de/teaching you‘ll always find • these slides • solutions to all assignments • Ask your questions – any time! • Each lecture will close with • further reading • an optional assignment • Contact me any time at dev@npruehs.de! 3 / 58
  • 4. Objectives • To get an idea of the basic development process of good Desktop applications • To understand the importance of good UI and UX design • To learn how to development a basic Desktop application with Windows Presentation Foundation 4 / 58
  • 5. Motivation “You wouldn't use a screwdriver on a nail.” 5 / 60
  • 6. Motivation • First, you should make the tools! • Save development time • Can be shipped to players • Can even be your main business field (Adobe, Nevigo) 6 / 58 StarCraft II World Editor
  • 7. Motivation • Highly workflow-dependent • Level Editor • Blueprint Editor • Common Functionality • New • Load & Save • Selection & Inspector • Brush • Perspectives & Zoom • Copy & Paste & Cut • Undo & Redo • Settings • Test Run 7 / 58
  • 8. Requirements • Responsiveness • Avoid blocking UI! 8 / 58This should never happen!
  • 9. Requirements • Robust error handling • Handle exceptions! 9 / 58 This must never happen. Never, never, never, never, never!
  • 10. Requirements • Extensibility • Adaptive window size • Backward compatibility • WYSIWYG • Localization • Security Context 10 / 58
  • 11. Development Process 1. Design 1. Define Functional Requirements 2. Analyze Target Group 3. Develop Overall Application Architecture 2. Implement 1. Create Prototypes 2. Develop Application 3. Test 1. Write Unit Tests 2. Perform Usability Tests 11 / 58
  • 12. UI Design Guidelines • Less UI is better UI. • The more functionality that is exposed at any one time, the more difficult it is for a user to find the functionality that they need. • Consistent UI is good UI. • Providing a consistent UI enables a user to become more proficient with an application in a much shorter time. 12 / 58
  • 13. UX Design Guidelines • Support the minimum Windows effective resolution of 800x600 pixels. • Use determinate progress bars for operations that require a bounded amount of time. • Even if that amount of time cannot be accurately predicted. • Tab order should flow from left to right, top to bottom. 13 / 58
  • 14. UX Design Guidelines • Assign shortcut keys to the most commonly used commands. • It's rude to interrupt. • When an application displays a dialog box, it forces the user to stop whatever it is that they are doing and pay attention to something else. If it is possible, remove the need for a dialog box completely by avoiding error cases and other disruptive user experiences. • And many, many, many, many more… (see References) 14 / 58
  • 15. Model-View-Controller • Design pattern that separates data from its visual representation • Model: Data, such as names, phone numbers, or health points. • View: Visual representation of that data, such as console output, UI textfields or health bars. • Controller: Layer that separates model from view, serving as interface for any interaction with the data. 15 / 58
  • 17. Model-View-Controller • Allows exchanging views or modifying the model without breaking existing functionality. • For instance, write console client first and GUI client after. • Greatly improves your application architecture through separation of concerns. • Anybody always knows where to look in your code. 17 / 58
  • 18. Introduction to Windows Presentation Foundation (WPF) • Presentation system for building Windows client applications • Part of the Microsoft .NET Framework • Both standalone and browser-hosted applications • Resolution-independent and vector-based rendering engine 18 / 58
  • 19. Architecture of WPF Applications • Extensible Application Markup Language (XAML) markup for defining the application appearance • XML-based markup language • Used to create windows, dialog boxes, pages, and controls • Code-Behind for defining the application behavior • Responds to user interaction • Implements Business Logic 19 / 58
  • 20. WPF Example #1 XAML <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Title="Window with Button" Width="250" Height="100"> <!-- Add button to window. --> <Button Name="button">Click Me!</Button> </Window> 20 / 58 Rendered View
  • 21. WPF Example #2 XAML 21 / 58 <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="WpfApplication1.MainWindow" Title="Window with Button" Width="250" Height="100"> <Button Name="Button" Click="button_Click">Click Me!</Button> </Window>
  • 22. WPF Example #2 XAML 22 / 58 <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="WpfApplication1.MainWindow" Title="Window with Button" Width="250" Height="100"> <Button Name="Button" Click="button_Click">Click Me!</Button> </Window>
  • 23. WPF Example #2 XAML 23 / 58 <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="WpfApplication1.MainWindow" Title="Window with Button" Width="250" Height="100"> <Button Name="Button" Click="button_Click">Click Me!</Button> </Window>
  • 24. WPF Example #2 C# 24 / 58 namespace WpfApplication1 { public partial class MainWindow { public MainWindow() { InitializeComponent(); } void button_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Hello, Windows Presentation Foundation!"); } } }
  • 25. WPF Example #2 C# 25 / 58 namespace WpfApplication1 { public partial class MainWindow { public MainWindow() { InitializeComponent(); } void button_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Hello, Windows Presentation Foundation!"); } } }
  • 26. WPF Example #2 C# 26 / 58 namespace WpfApplication1 { public partial class MainWindow { public MainWindow() { InitializeComponent(); } void button_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Hello, Windows Presentation Foundation!"); } } }
  • 27. WPF Example #2 C# 27 / 58 namespace WpfApplication1 { public partial class MainWindow { public MainWindow() { InitializeComponent(); } void button_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Hello, Windows Presentation Foundation!"); } } }
  • 28. WPF Example #2 Rendered View 28 / 58
  • 29. Excursus: C# Events • Enable a class or object to notify other classes or objects when something of interest occurs • Class that sends (or raises) the event is called the publisher. • Classes that receive (or handle) the event are called subscribers. 29 / 58
  • 30. C# Events • Events are declared using delegates. • Similar to “function pointer” • Type that defines a method signature • Used to pass methods as arguments to other methods • Clients give the class delegates to methods that should be called when the event occurs. • When the event occurs, the delegate(s) given to the class are invoked. 30 / 58
  • 31. C# Events Example C# 31 / 58 public class Actor { private int health; public int Health { get { return this.health; } set { this.health = value; } } }
  • 32. C# Events Example C# 32 / 58 public class Actor { private int health; public delegate void HealthChangedDelegate(int newHealth); public event HealthChangedDelegate HealthChanged; public int Health { get { return this.health; } set { this.health = value; } } }
  • 33. C# Events Example C# 33 / 58 set { if (this.health == value) { return; } this.health = value; HealthChangedDelegate handler = this.HealthChanged; if (handler != null) { handler(this.health); } }
  • 34. C# Events Example C# 34 / 58 set { if (this.health == value) { return; } this.health = value; HealthChangedDelegate handler = this.HealthChanged; if (handler != null) { handler(this.health); } }
  • 35. C# Events Example C# 35 / 58 set { if (this.health == value) { return; } this.health = value; HealthChangedDelegate handler = this.HealthChanged; if (handler != null) { handler(this.health); } }
  • 36. C# Events Example C# 36 / 58 public class HealthBar { public HealthBar(Actor actor) { actor.HealthChanged += this.OnHealthChanged; } private void OnHealthChanged(int newHealth) { // Update health bar... } }
  • 37. WPF Application Class • Handles startup and lifetime management, shared properties, and shared resources • Supports both standalone and browser-hosted applications XAML <Application x:Class="WpfApplication1.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml" /> 37 / 58
  • 38. WPF Application Class • Handles startup and lifetime management, shared properties, and shared resources • Supports both standalone and browser-hosted applications XAML <Application x:Class="WpfApplication1.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml" /> 38 / 58
  • 39. WPF Controls • Basic Controls • Labels • Buttons • Textboxes • Checkboxes, ComboBoxes, RadioButtons • Panels, Boxes, Scrollbars • Menus, Dialog Boxes • Progress Bars, Status Bars • Advanced Controls • Grids, Lists and Trees • Calendars • Document Viewers (XPS, *sigh*…) • Images, Media Players 39 / 58
  • 40. Label Control Text label for a control. XAML <Label>This is a label.</Label> Rendered View 40 / 58
  • 41. Button Control Button that reacts to the mouse clicks. XAML <Button Name="ButtonQuit“ Click="ButtonQuit_OnClick"> Quit </Button> Rendered View 41 / 58
  • 42. TextBox Control Used to display or edit text. XAML <TextBox Name="TextBoxName" TextChanged="TextBoxName_OnTextChanged"> Please enter your name! </TextBox> Rendered View 42 / 58
  • 43. CheckBox Control Control that a user can select and clear. XAML <CheckBox Name="CheckBoxEnabled“ IsChecked="True" Checked="CheckBoxEnabled_OnChecked“ Unchecked="CheckBoxEnabled_OnUnchecked"> Enabled </CheckBox> Rendered View 43 / 58
  • 44. RadioButton Control Control that a user can select, but not clear. XAML <StackPanel> <RadioButton Name="RadioButtonColorRed" GroupName="Color“ IsChecked="True" Checked="RadioButtonColorRed_OnChecked">Red</RadioButton> <RadioButton Name="RadioButtonColorGreen" GroupName="Color“ Checked="RadioButtonColorGreen_OnChecked">Green</RadioButton> <RadioButton Name="RadioButtonColorBlue" GroupName="Color“ Checked="RadioButtonColorBlue_OnChecked">Blue</RadioButton> </StackPanel> 44 / 58
  • 45. RadioButton Control Control that a user can select, but not clear. Rendered View 45 / 58
  • 46. ComboBox Control Drop-down list that can be shown or hidden by clicking the arrow on the control. XAML <ComboBox Name="ComboBoxColor" /> C# this.ComboBoxColor.ItemsSource = new List<string> { "Red", "Green", "Blue" }; 46 / 58
  • 47. ComboBox Control Drop-down list that can be shown or hidden by clicking the arrow on the control. Rendered View 47 / 58
  • 48. WPF UI Layout • Defined by location and size of all controls • Has to adapt to changes in window size • This is achieved by relative positioning. • Determining the final layout is done in two steps: 1. Control tells its parent what location and size it requires. 2. Parent tells the control what space it can have. 48 / 58
  • 49. WPF UI Layout Example XAML 49 / 58 <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="WpfApplication1.MainWindow" Title="Layout with the DockPanel" Height="143" Width="319"> <!-- DockPanel to layout four text boxes. --> <DockPanel> <TextBox DockPanel.Dock="Top">Dock = "Top"</TextBox> <TextBox DockPanel.Dock="Bottom">Dock = "Bottom"</TextBox> <TextBox DockPanel.Dock="Left">Dock = "Left"</TextBox> <TextBox Background="White">This TextBox "fills" the remaining space.</TextBox> </DockPanel> </Window>
  • 50. WPF UI Layout Example Rendered View 50 / 58
  • 51. Assignment #1 1. Create New Project 1. Download and install Visual Studio Community 2015 from https://www.visualstudio.com/en-us. 2. Create a new WPF application called LevelEditor. 3. Change the title of your MainWindow in the MainWindow.xaml file. 4. Change the size of your main window to 800 x 600 pixels. 51 / 58
  • 52. Assignment #1 2. Model-View-Controller 1. Create three folders in your project named Model, View and Control. 2. Move App.xaml (and App.xaml.cs) to the Control folder. 3. Move MainWindow.xaml (and MainWindow.xaml.cs) to the View folder. 4. Update the namespaces and folders of all four files accordingly. 5. In the MainWindow constructor, grab a reference to App via the static Application.Current property. 52 / 58
  • 53. Assignment #1 3. Quit Button 1. In App.xaml.cs, add a Quit method that calls the application Shutdown method. 2. Add a Quit button to MainWindow.xaml. 3. In MainWindow.xaml.cs, implement the Click event handler of the button, calling the Quit method of your App class. 53 / 58
  • 54. Assignment #1 4. About Window 1. Create a new window called AboutWindow in your View folder. 2. Add some nice information (e.g. your name, application version number) to that window using the <TextBlock> and <LineBreak/> tags. 3. In App.xaml.cs, add a About method that instantiates a new AboutWindow object and calls its Show method. 4. Add an About button to MainWindow.xaml. 5. Change the surronding panel in MainWIndow.xaml from Grid to DockPanel in order to prevent both buttons from overlapping. 6. In MainWindow.xaml.cs, implement the Click event handler of the button, calling the About method of your App class. 54 / 58
  • 55. References • MSDN. Overview of the User Interface Development Process. http://msdn.microsoft.com/en- us/library/windows/desktop/ff728828%28v=vs.85%29.aspx, April 2016. • MSDN. Implementing a User Interface. http://msdn.microsoft.com/en- us/library/windows/desktop/ff728823%28v=vs.85%29.aspx, April 2016. • MSDN. UX checklist for desktop applications. http://msdn.microsoft.com/en- us/library/windows/desktop/dn742479.aspx, April 2016. • MSDN. Windows Presentation Foundation. http://msdn.microsoft.com/en-us//library/ms754130.aspx , April 2016. • MSDN. Introduction to WPF. https://msdn.microsoft.com/en- us/library/mt149842.aspx, April 2016. • MSDN. Delegates (C# Programming Guide). http://msdn.microsoft.com/en-us/library/ms173171.aspx, April 2016. • MSDN. Events (C# Programming Guide). http://msdn.microsoft.com/en- us/library/awbftdfh.aspx, April 2016. 55 / 58
  • 57. 5 Minute Review Session • Why should you make tools as early as possible? • Name a few important requirements for all tools! • What is Model-View-Controller? • What is the basic architecture of a WPF application? • How are C# events used? • How do you define the entrance point of a WPF application? • How are the controls arranged by the WPF layout engine? • How do you bind data to a WPF control? 57 / 58