Module 14 Application Settings, State, and Life Cycle.

Slides:



Advertisements
Similar presentations
Module 1: Creating an Application by Using Windows Presentation Foundation Overview of WPF Creating a Simple WPF Application Handling Events and Commands.
Advertisements

Chapter 12: Using ADO.NET 2.0 Programming with Microsoft Visual Basic 2005, Third Edition.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Programming Based on Events
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Using Multiple Forms. Creating a New Form ProjectAdd Windows Form.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are.
Chapter Extension 6 Using Microsoft Access © 2008 Pearson Prentice Hall, Experiencing MIS, David Kroenke.
Microsoft ® Official Course Monitoring and Troubleshooting Custom SharePoint Solutions SharePoint Practice Microsoft SharePoint 2013.
Module 15 Configuring and Deploying Windows Client Applications.
Guide to MCSE , Enhanced 1 Activity 10-1: Restarting Windows Server 2003 Objective: to restart Windows Server 2003 Start  Shut Down  Restart Configure.
Excel Connector for JIRA Installation and functional presentation.
Tutorial 7: Sub and Function Procedures1 Tutorial 7 Sub and Function Procedures.
Module 14: Configuring Print Resources and Printing Pools.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Module 11 Control Customization. Module Overview Overview of Control Authoring Creating Controls Managing Control Appearance by Using Visual States Integrating.
Module 14: WCF Send Adapters. Overview Lesson 1: Introduction to WCF Send Adapters Lesson 2: Consuming a Web Service Lesson 3: Consuming Services from.
INSPIRING CREATIVE AND INNOVATIVE MINDS Module 4: Adding Code to a Microsoft ASP.NET Web Form Implementing Code-Behind Pages Adding Event Procedures to.
Introduction to Matlab & Data Analysis
Developing Web Applications Using Microsoft ® Visual Studio ® 2008.
1/36 Database Programming with Visual Basic.Net and MS Access IKE Lab. Yunho Song Database Management and Analysis.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
2 Copyright © 2004, Oracle. All rights reserved. Running a Forms Developer Application.
Excel Connector for JIRA Installation and functional presentation.
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Key Applications Module Lesson 21 — Access Essentials
Working with option button, check box, and list box controls Visual Basic for Applications 13.
BIL528 – Bilgisayar Programlama II Introduction 1.
Module 12 Attached Properties and Behaviors in WPF.
Module 10 Administering and Configuring SharePoint Search.
Module 7: Accessing Data by Using ADO.NET
Global.asax file. Agenda What is Global.asax file How to add the Global.asax file What are the default events available Explanation to Application_Level.
Module 4: Building DataSets. Overview Working in a Disconnected Environment Building DataSets and DataTables Binding and Saving a DataSet Defining Data.
Module 2 Introduction to Visual Studio 2010 and WPF Version 4.
Module 3: Managing a Microsoft ® Windows ® Small Business Server Environment.
Module 8: Implementing an Active Directory Domain ® Services Monitoring Plan.
Module 1 Windows Client Application Design. Module Overview Windows Client Technologies Architectural Patterns.
Module 13 Animations in WPF. Module Overview Using Animations Using Triggers Implementing Data Visualizations.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Bookstore Application: Middle Tier Introducing Code-Behind Files, Session State.
Module 3 Designing and Developing a User Interface.
Module 8 Enhancing User Interface Responsiveness.
Module 9: Using XML Web Services in a C# Application.
Module 4: Creating a Web Application with Web Forms
Module 4 Taking Control of the User Interface. Module Overview Sharing Logical Resources in an Application Creating Consistent User Interfaces by Using.
Chapter 3 I Need a Tour Guide (Introduction to Visual Basic 2010) Clearly Visual Basic: Programming with Visual Basic nd Edition.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
Understand Databound Controls Windows Development Fundamentals LESSON 4.2A.
Module 1 Introducing C# and the.NET Framework. Module Overview Introduction to the.NET Framework 4 Creating Projects Within Visual Studio 2010 Writing.
Module 6: Administering Reporting Services. Overview Server Administration Performance and Reliability Monitoring Database Administration Security Administration.
Microsoft ® Official Course Module 9 Working with Business Connectivity Services.
2 Copyright © 2004, Oracle. All rights reserved. Running a Forms Developer Application.
COMPUTER PROGRAMMING I Apply Procedures to Develop List Box and Combo Box Objects.
Portal v2.6 Service Pack 1 Update. 2 Portal v2.6 Service Pack 1 6/27/2016 ©2007 GE Fanuc Intelligent Platforms All Rights Reserved Portal v2.6 Service.
Module 3: Creating Windows-based Applications. Overview Creating the Main Menu Creating and Using Common Dialog Boxes Creating and Using Custom Dialog.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
Chapter 1: An Introduction to Visual Basic .NET
Running a Forms Developer Application
Working in the Forms Developer Environment
Session Variables and Post Back
Deploying and Configuring SSIS Packages
Using Multiple Forms.
Module 13: Creating Data Visualizations with Power View
CIS16 Application Programming with Visual Basic
Module 12: Implementing an Analysis Services Tabular Data Model
Module 10: Creating a Web Application with Web Forms
Lecture Set 10 Windows Controls and Forms
Database Applications
Module 8: Creating Windows-based Applications
Presentation transcript:

Module 14 Application Settings, State, and Life Cycle

Module Overview Managing Application State by Using Application Settings Managing the Application Life Cycle

Lesson 1: Managing Application State by Using Application Settings Understanding Application Settings Adding and Removing Application Settings Understanding the Settings Classes Reading and Writing Settings

User.config file App.config file Web service URL Connection string Understanding Application Settings Application Settings Settings class Application-scoped settings User-scoped settings

Adding and Removing Application Settings To add application settings by using the Project Designer: In the Settings grid, click a blank row In the Name column, type the name for the setting In the Type list, click the data type for the setting In the Scope list, click Application or User In the Value column, type a default value for the setting In the Settings grid, click a blank row In the Name column, type the name for the setting In the Type list, click the data type for the setting In the Scope list, click Application or User In the Value column, type a default value for the setting To remove application settings: In the Settings grid, click the row for the setting to remove, and then press DELETE

Settings provider classes Settings classes public class MyUserSettings : ApplicationSettingsBase { [UserScopedSetting()] public Color BackgroundColor { get { return ((Color)this["BackgroundColor"]); } set { this["BackgroundColor"] = (Color)value; } } public class MyUserSettings : ApplicationSettingsBase { [UserScopedSetting()] public Color BackgroundColor { get { return ((Color)this["BackgroundColor"]); } set { this["BackgroundColor"] = (Color)value; } } Understanding the Settings Classes SettingsBase ApplicationSettingsBase SettingsProvider SettingsProviderAttribute XML LocalFileSettingsProvider MyUserSettings

Reading and Writing Settings... <ComboBox x:Name="Fonts" Grid.Column="1" ItemsSource="{x:Static Fonts.SystemFontFamilies}" SelectedItem="{Binding Source={x:Static p:Settings.Default}, Path=UserFont, Mode=TwoWay}"> <ComboBox x:Name="Fonts" Grid.Column="1" ItemsSource="{x:Static Fonts.SystemFontFamilies}" SelectedItem="{Binding Source={x:Static p:Settings.Default}, Path=UserFont, Mode=TwoWay}"> private void Ok_Click(object sender, RoutedEventArgs e) { Properties.Settings.Default.Save(); } private void Cancel_Click(object sender, RoutedEventArgs e) { Properties.Settings.Default.Reload(); } private void Ok_Click(object sender, RoutedEventArgs e) { Properties.Settings.Default.Save(); } private void Cancel_Click(object sender, RoutedEventArgs e) { Properties.Settings.Default.Reload(); }

Lesson 2: Managing the Application Life Cycle Understanding the Application Class Handling Application Events

Application definition: Understanding the Application Class <Application xmlns=" xmlns:x=" x:Class="MyApplication.App" /> <Application xmlns=" xmlns:x=" x:Class="MyApplication.App" /> Application services: Create and manage common application infrastructure Track and interact with the application life cycle Retrieve and process command-line parameters Share application-level properties and resources Detect and respond to unhandled exceptions Return exit codes Manage windows in stand-alone applications Track and manage navigation

Handling Application Events Application Object Application Code Run method Startup Deactivated SessionEnding Exit Shutdown method Activated Not canceled Canceled Explicit shutdown Operating System

Lab: Creating a Settings Dialog Box Exercise 1: Creating Application and User Settings by Using Visual Studio Exercise 2: Creating a Dialog Box Exercise 3: Reading and Writing Settings Exercise 4: Consuming Settings Properties Logon information Estimated time: 60 minutes

Lab Scenario You have been asked to update the Work Orders WPF application to remember the position and size of the main application window between sessions. You have also been asked to update the application to provide a settings dialog box to enable the user to configure the application. The settings dialog box should provide a way to view the database connection string details.

Lab Review Review Questions What is the difference between application and user settings? Which method do you use to show a Window class as a dialog box?

Module Review and Takeaways Review Questions