1. Trang chủ
  2. » Công Nghệ Thông Tin

c# 4, asp.net 4, and wpf, with visual studio 2010 jump start

130 440 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 130
Dung lượng 14,58 MB

Nội dung

Christian Nagel, Bill Evjen, Rod Stephens Jump Start C# 4, ASP.NET 4, & WPF with Visual Studio 2010 Wrox Programmer to Programmer™ Join the discussion @ p2p.wrox.com C# 4, ASP.NET 4, & WPF with Visual Studio 2010 Jump Start Christian Nagel Bill Evjen Jay Glynn Karli Watson Morgan Skinner Scott Hanselman Devin Rader Rod Stephens iii CONTENTS Contents Professional C#4 and .net Part i: 4 Covariance and Contra-variance 2 Covariance with Generic Interfaces 3 Contra-Variance with Generic Interfaces 4 Tuples 5 The Dynamic Type 6 Dynamic Behind the Scenes 7 Code Contracts 11 Preconditions 13 Postconditions 14 Invariants 15 Contracts for Interfaces 15 Tasks 17 Starting Tasks 18 Continuation Tasks 19 Task Hierarchies 19 Results from Tasks 20 Parallel Class 21 Looping with the Parallel.For Method 21 Looping with the Parallel.ForEach Method 24 Invoking Multiple Methods with the Parallel.Invoke Method 24 Cancellation Framework 25 Cancellation of Parallel.For 25 Cancellation of Tasks 27 Taskbar and Jump List 28 Professional asP.net 4 in C# and VBPart ii: Chart Server Control 35 ASP.NET AJAX Control Toolkit 39 Downloading and Installing the AJAX Control Toolkit 40 ColorPickerExtender 42 Extending <outputCache> 43 .NET 4’s New Object Caching Option 44 Historical Debugging with IntelliTrace 47 iv CONTENTS Debugging Multiple Threads 49 ASP.NET MVC 50 Defining Model-View-Controller 50 MVC on the Web Today 51 Model-View-Controller and ASP.NET 52 Using WCF Data Services 55 Creating Your First Service 57 Adding Your Entity Data Model 57 Creating the Service 59 Building an ASP.NET Web Package 64 WPF PROGRAMMER’S REFERENCEPART III: Code-behind Files 69 Example Code 69 Event Name Attributes 70 Resources 72 Defining Resources 72 Merged Resource Dictionaries 74 Styles and Property Triggers 77 Simplifying Properties 77 Unnamed Styles 78 Triggers 79 IsMouseOver Triggers 80 Setting Opacity 80 Event Triggers and Animation 81 Event Triggers 81 Storyboards 83 Media and Timelines 85 Templates 86 Template Overview 87 ContentPresenter 87 Template Binding 88 Template Events 88 Glass Button 89 Researching Control Templates 90 Skins 92 Resource Skins 92 Animated Skins 95 Dynamically Loaded Skins 96 Printing Visual Objects 97 Printing Code-Generated Output 101 v CONTENTS Data Binding 103 Binding Basics 103 ListBox and ComboBox Templates 106 Binding Database Objects 108 Transformations 109 Eects 110 Documents 111 Fixed Documents 112 Flow Documents 114 Three-Dimensional Drawing 115 Basic Structure 115 Lighting 119 Materials 120 Building Complex Scenes 121 [...]... videos, and two buttons to start and stop the player The second row contains a MediaElement for playing the videos The XAML code of the user interface is shown below The buttons are associated with the commands MediaCommands.Play and MediaCommands.Stop, which map to the handler methods OnPlay() and OnStop() With the MediaElement the property LoadedBehavior is set to Manual so that the player doesn’t start. .. PROFESSIONAL C# 4 AND NET 4  ❘  18 Starting Tasks To start a task, you can use either the TaskFactory or the constructor of the Task and the Start( ) method The Task constructor just gives you more flexibility in creating the task When starting a task, an instance of the Task class can be created and the code that should run can be assigned, with an Action or Action delegate, with either no... of the contract methods are annotated with the attribute [Conditional(“CONTRACTS_FULL“)], all runtime checks are only done with this setting To work with code contracts you can use classes that are available with NET 4 in the namespace System.Diagnostics.Contracts However, there’s no tool included with Visual Studio 2010 You need to download an extension to Visual Studio from Microsoft DevLabs: http://msdn.microsoft.com/en-us/devlabs/dd491992... information is shown with the visual state Another feature of the taskbar is the Jump List Clicking the right mouse key on a taskbar button opens the Jump List This list can be customized per application With Microsoft Outlook, you can go directly to the Inbox, Calendar, Contacts, and Tasks or create a new e-mail With Microsoft Word, you can open the recent documents PROFESSIONAL C# 4 AND NET 4  ❘  29... loop loop 0 started 50 started 25 started 75 started 50 finished 25 finished 0 finished PROFESSIONAL C# 4 AND NET 4  ❘  27 loop 1 started loop 26 started loop 51 started loop 75 finished loop 76 started ** token canceled loop 1 finished loop 51 finished loop 26 finished loop 76 finished The operation was canceled Cancellation of Tasks The same cancellation pattern is used with tasks First, a new CancellationTokenSource... static analysis with this tool, the Visual Studio Team System is required; for r ­ untime analysis, Visual Studio Standard edition is enough Code contracts are defined with the Contract class All contract requirements that you define in a method, no matter if they are preconditions or postconditions, must be placed at the beginning of the method You can also assign a global event handler to the event... PROFESSIONAL C# 4 AND NET 4  ❘  12 within the code for runtime checks, check the contracts during compile time, and add contract information to the generated XML documentation The following figure shows the project properties for the code contracts in Visual Studio 2010 Here, you can define what level of runtime checking should be done, indicate if assert dialogs should be opened on contract failures, and configure... 51, 75, and 76 were all started This is on a system with a quad-core CPU With the cancellation, all other iterations were canceled before starting The iterations that were started are allowed to finish because cancellation is always done in a cooperative way so as to avoid the risk of resource leaks when iterations are canceled somewhere in between loop loop loop loop loop loop loop 0 started 50 started... the property LoadedBehavior is set to Manual so that the player doesn’t start immediately on loading the video ... contains two ThumbButtonInfo elements, which have Command set to the same commands as the play and stop Button elements created previously With these buttons, you can control the application in the same way as with the other Button elements in the application The image for the buttons in the taskbar is taken from resources with the keys StartImage and StopImage . Stephens Jump Start C# 4, ASP. NET 4, & WPF with Visual Studio 2010 Wrox Programmer to Programmer™ Join the discussion @ p2p.wrox.com C# 4, ASP. NET 4, & WPF with Visual Studio 2010 Jump Start. version 4 of the .NET Framework, this behavior was not possible with generics. With C# 4, the language is extended to support covariance and contra-variance with generic inter- faces and generic delegates as F# where they are used often. With .NET 4, tuples are available with the .NET Framework for all .NET languages. .NET 4 defines eight generic Tuple classes and one static Tuple class that act

Ngày đăng: 31/03/2014, 16:41

TỪ KHÓA LIÊN QUAN