wpf5concat Start Microsoft Visual Studio. File New Project WPF Application, Name= wpf5concat OK.



Similar documents
Chapter 14 WCF Client WPF Implementation. Screen Layout

This tutorial has been designed for all those readers who want to learn WPF and to apply it instantaneously in different type of applications.

1. WPF Tutorial Page 1 of 431 wpf-tutorial.com

Introduction to Microsoft Access 2007

Hands-On Lab. Building Applications in Silverlight 4 Module 8: Advanced OOB and MEF. Event Administrator Dashboard

טכנולוגיית WPF מספקת למפתחים מודל תכנות מאוחד לחוויית בניית יישומיי. ניהול התצוגה מתבצע בשפת הסימון Extensible Application Markup ) XAML

Microsoft Access 2010 Overview of Basics

Microsoft Virtual Labs. Building Windows Presentation Foundation Applications - C# - Part 1

WPF Learner s Guide to Head First C#

InGenius Connector Enterprise Demo System for Microsoft Dynamics CRM

APPLICATION NOTE. Atmel AVR10006: XDK User Guide. Atmel Microcontrollers. Features. Description

Access II 2007 Workshop

Utilizing Microsoft Access Forms and Reports

ComponentOne. Windows for WPF

A SharePoint Developer Introduction. Hands-On Lab. Lab Manual SPCHOL306 Using Silverlight with the Client Object Model VB

Check out our website!

Microsoft Access 2010 handout

Create PDF invoice in Windows Forms application. Written by Apitron Documentation Team

Windows Presentation Foundation Using C#

A Step by Step Guide for Building an Ozeki VoIP SIP Softphone

BUSINESS OBJECTS XI WEB INTELLIGENCE

Introduction to C#, Visual Studio and Windows Presentation Foundation

How To Develop A Mobile Application On Sybase Unwired Platform

Ohio University Computer Services Center August, 2002 Crystal Reports Introduction Quick Reference Guide

MSVS File New Project ASP.NET Web Application, Name: w25emplo OK.

AGENDA WINDOWS PRESENTATION FOUNDATION LEKTION 4. Statusbar Hyperlänkar WebBrowser TabControl Ribbon ListBox Data Template Resource Dictionary Style

An Introduction to the Windows Presentation Foundation with the Model-View-ViewModel

A database is a collection of data organised in a manner that allows access, retrieval, and use of that data.

Access 2007 Creating Forms Table of Contents

Walkthrough: Creating and Using an ASP.NET Web Service in Visual Web Developer

STEP BY STEP to Build the Application 1. Start a. Open a MvvmLight (WPF4) application and name it MvvmControlChange.

Performance and Usability Improvements for Massive Data Grids using Silverlight

Business Objects Version 5 : Introduction

Word 2003 Tables and Columns

BID2WIN Workshop. Advanced Report Writing

Hands-On Lab. Building a Data-Driven Master/Detail Business Form using Visual Studio Lab version: Last updated: 12/10/2010.

Microsoft Office PowerPoint 2013

Creating Mailing Lables in IBM Cognos 8 Report Studio

Relationships in WPF Applications

USER GUIDE Appointment Manager

Visualization with Excel Tools and Microsoft Azure

Business Objects. Report Writing - CMS Net and CCS Claims

Introduction to Microsoft Access 2003

Introduction to Microsoft Access 2013

Tutorial: Windows Mobile Application Development. Sybase Unwired Platform 2.1 ESD #2

WPF Shapes. WPF Shapes, Canvas, Dialogs 1

Create a Poster Using Publisher

COGNOS KARATE BELT SESSION III CREATING SLOTS

A SharePoint Developer Introduction. Hands-On Lab. Lab Manual HOL8 Using Silverlight with the Client Object Model C#

Tips and Tricks for Printing an Excel Spreadsheet

آموزش DataGrid در WPF به همراه صفحه بندي و جستجوي انتخابی. کلیک کن

Microsoft Excel 2010 Tutorial

Intellect Platform - Tables and Templates Basic Document Management System - A101

Working with SQL Server Integration Services

8 CREATING FORM WITH FORM WIZARD AND FORM DESIGNER

Using SQL Server Management Studio

BusinessObjects: General Report Writing for Version 5

Access NAMES Computerized Database

Excel 2003 Tutorial I

Using an Access Database

Designing Reports in Access

Access 2010: The Navigation Pane

Introduction to Microsoft Access 2010

Introduction to Microsoft Word 2008

Logi Ad Hoc Reporting Report Design Guide

Handout: Creating Forms in Word 2010

Windows Phone 7 Mobile Applications Using Decision Structures

IST 195 Lab 11: MS Access

SQL Server Database Web Applications

GUIDELINES FOR PREPARING POSTERS USING POWERPOINT PRESENTATION SOFTWARE

All V7 registers support barcode printing, except the Sharp 410/420 1A ROM and that limitation is based upon the register.

Business Insight Report Authoring Getting Started Guide

6. If you want to enter specific formats, click the Format Tab to auto format the information that is entered into the field.

Build Your First Web-based Report Using the SAS 9.2 Business Intelligence Clients

Advanced Word for Windows

SAP Business Intelligence (BI) Reporting Training for MM. General Navigation. Rick Heckman PASSHE 1/31/2012

Microsoft Word 2010 Tutorial

Lab 9 Access PreLab Copy the prelab folder, Lab09 PreLab9_Access_intro

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Windows 10 Apps Development

Advanced Database Concepts Using Microsoft Access

WPF Viewer for Reporting Services 2008/2012 Getting Started

User Guide. Trade Finance Global. Reports Centre. October nordea.com/cm OR tradefinance Name of document 8/8 2015/V1

Handout: Word 2010 Tips and Shortcuts

Microsoft Office PowerPoint Creating a new presentation from a design template. Creating a new presentation from a design template

Using Ad-Hoc Reporting

Basic Excel Handbook

Microsoft Silverlight 4 Step by Step

Bookstore Application: Client Tier

Using Microsoft Access Databases

Table and field properties Tables and fields also have properties that you can set to control their characteristics or behavior.

The LSUHSC N.O. Archive

Your First Windows Mobile Application. General

Decision Support AITS University Administration. Web Intelligence Rich Client 4.1 User Guide

Working with sections in Word

Microsoft Access 3: Understanding and Creating Queries

Objectives. Understand databases Create a database Create a table in Datasheet view Create a table in Design view

4. Click on the insert tab: Create a title at the top of the page using word art that says Microsoft Word PD 11-12

Access Using Access

Windows Presentation Foundation Tutorial 1

Transcription:

Start Microsoft Visual Studio. wpf5concat File New Project WPF Application, Name= wpf5concat OK. The Solution Explorer displays: Solution wpf5concat, wpf5concat, Properties, References, App.xaml, MainWindow.xaml. The MainWindow is automatically covered by a Grid element. Click an interior of the MainWindow. This selects the Grid, and surrounds it by a rim. Click three times the left rim to split the Grid into four rows. From the Toolbox drag four StackPanel controls, and drop each of them onto separate Grid s row. In Properties pane, set their names to: spodd, spamick, spselmany, spaa. For every StackPannel, in the Properties pane, set: Orientation= Horizontal, and adjust their dimensions to those of the Grid s rows. From the Toolbox drag and drop some controls: Seven TextBlock controls: txbkodd, txbkeven, txbkoddeven, txbkunidesce, txbkselconc, txbkselmany, txbktmpl, Ten TextBox controls: txbodd, txbeven, txboddeven, txbdesce, txbam, txbjs, txbselmany, txbtmpl, txbpresent, txbaa, Three ListBox controls: lbx1, lbx2, lbx3. Position the controls making use of the properties VerticalAlignment= Stretch or Top, and Margin= e.g. 5,-42, 0, 0. In the Properties pane set the background colors, the Bold (for TextBox controls) and the Text properties: {1,3,5, {2,4,6, clk me, 2clk me, Adam Mickiewicz, Juliusz Slowacki, ^Aa{2c{3de.

See the screenshot. In the Properties pane, in the Events tab, for the controls marked by the Azure background color subscribe for events MouseDown or MouseDoubleClick. To the file MainWindow.xaml.cs add the following code, which includes event handlers. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Text.RegularExpressions; //Regex namespace wpf5concat { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() {InitializeComponent(); //ctor.

private void txboddeven_mousedoubleclick(object sender, MouseButtonEventArgs e) {if(txboddeven.text!="2clk me") {txboddeven.text="2clk me"; txbdesce.text= ""; {Regex rex= new Regex("{,"); //x=>"" ==MatchEvaluator: char[] todd= rex.replace(txbodd. Text,x=>"").ToCharArray(); char[] teven=rex.replace(txbeven.text,x=>"").tochararray(); IEnumerable<char> enoddeven= todd.concat(teven); txboddeven.text= enoddeven.aggregate("{",(x,y)=>x+=y+", ").TrimEnd(' ',',')+""; IEnumerable<int> endesce= enoddeven.select(x=>(int)x).orderbydescending<int,int>(x=>(int)x); txbdesce.text= //seed, accumulate function: endesce.aggregate("{",(x,y)=>x+=y+", ").TrimEnd(' ',',')+""; //, private void lbx1_mousedown(object sender, MouseButtonEventArgs e) {if(lbx1.itemssource!=null) {lbx1.itemssource= null; lbx1.items.add("clk me"); lbx2.itemssource= null; lbx3.itemssource= null; {string[] tam= txbam.text.split( string[] tjs= txbjs.text.split( IEnumerable<string> en= tam.concat(tjs); lbx1.items.clear(); lbx1.itemssource= en.orderby(x=>x); lbx2.itemssource= en.orderbydescending(x=>x[x.length-1]); lbx3.itemssource= en.orderbydescending(x=>x.reverse().aggregate("",(z,y)=>z+=y)); //. private void lbx1_gotfocus(object sender,routedeventargs e) {lbx1.itemssource= null; lbx1.items.clear(); lbx1.items.add("clk me"); lbx2.itemssource= null; lbx3.itemssource= null; private void txbselmany_mousedoubleclick(object sender, MouseButtonEventArgs e) {if(txbselmany.text!="2clk me") {txbselmany.text="2clk me"; {IEnumerable<string> enam= txbam.text.split( IEnumerable<string> enjs= txbjs.text.split( IEnumerable<char> enchar= enam.concat(enjs).selectmany(x=>x); txbselmany.text= enchar.orderby(x=>x).orderby(x=>x<97?x:x-'a'+'a').aggregate("",(x,y)=>x+=y); //.

private void txbpresent_mousedoubleclick(object sender,mousebuttoneventargs e) {if(txbpresent.text!="2clk me") txbpresent.text= "2clk me"; {Regex rex= new Regex(txbTmpl.Text); if(txbselmany.text==null rex.ismatch(txbselmany.text)) txbpresent.text= "present"; txbpresent.text= "absent"; //. private void txbselmany_textchanged(object sender, TextChangedEventArgs e) {if(txbpresent!=null) txbpresent.text="2clk me"; private void txbtmpl_textchanged(object sender, TextChangedEventArgs e) {if(txbpresent!=null) txbpresent.text="2clk me"; private void txbaa_mousedoubleclick(object sender, MouseButtonEventArgs e) {if(txbaa.text!="2clk me") txbaa.text= "2clk me"; {IEnumerable<string> enam= txbam.text.split( IEnumerable<string> enjs= txbjs.text.split( txbaa.text= enam.concat(enjs).select(x=>x.substring(0,3).tochararray()).select(x=>x.select( y=>x[0].tostring().tolower()+y.tostring().toupper()+' ').ToArray()).Select(x=>x.Aggregate("",(z,y)=>z+=y)).Select(x=>x.PadRight(x.Length+9,' ')).Aggregate("",(x,y)=>x+=y); //. //class. After Ctrl + F5:

A double-click on the right-top TextBox control causes concatenation of the odd and even numbers, ordering them and displaying them as characters and as Unicode values. A click on the first of the three ListBox controls causes concatenation of the Adam Mickiewicz and Juliusz Slowacki strings, In the ListBox control lbx1, the four strings are ordered in an ascending (default) manner. In the lbx2 control they are ordered in a descending manner, with respect to the last characters. In the lbx3 control they are ordered in a descending manner, with respect to the reversed order of the characters within each of the four strings. A click on the TextBox control following the SelMany= control displays the characters from the Adam Mickiewicz and Juliusz Slowacki strings, whereby the characters are ordered in an ascending manner. The string ^Aa{2c{3de in the TextBox control is a template used by a Regex object rex. The function IsMatch checks whether the previous character-string contains the template. If it does, the TextBox control below the template displays present. If it does not the displayed text is absent. A click on the very bottom TextBox control displays four groups of characters. Each of these groups consists of three tuples of characters. The upper case characters are the three first characters from the strings Adam, Mickiewicz, Juliusz, Slowacki. Every upper case character is preceded by the first character of these strings, made lower case. The idea here was to demonstrate a bit more sophisticated use of the standard query operators. After clicking or double-clicking the above mentioned controls: The toggle behaviors are implemented for every click (MouseDown) or double click (MouseDoubleClick) events.

The layout of the MainWindow is coded in the MainWindow.xaml file: <Window x:class="wpf5concat.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="80*" /> <RowDefinition Height="110*" /> <RowDefinition Height="60*" /> <RowDefinition Height="60*" /> </Grid.RowDefinitions> <StackPanel Name="spOdd" Height="80" HorizontalAlignment="Left" VerticalAlignment="Top" Width="503" Orientation="Horizontal" Background="#FFFFF0F0"> <TextBlock Name="txbkOdd" Height="23" Text="Odd=" Background="White" Margin="5,-42,0,0" /> <TextBox Name="txbOdd" Height="23" Width="80" Margin="5,-45,0,0" Text="{{1,3,5" FontWeight="Bold" /> <TextBlock Name="txbkEven" Background="White" Height="23" Text="Even=" Margin="10,-42,0,0" /> <TextBox Name="txbEven" FontWeight="Bold" Height="23" Text="{{2,4,6" Width="80" Margin="5,-45,0,0" IsEnabled="True" /> <TextBlock Name="txbkOddEven" Background="White" Height="23" Text="OddEven=" Margin="20,-42,0,0" /> <TextBox Name="txbOddEven" FontWeight="Bold" Height="23" Text="2clk me" Width="170" Margin="5,-45,0,0" IsReadOnly="True" AcceptsReturn="False" IsEnabled="True" AcceptsTab="False" MouseDoubleClick="txbOddEven_MouseDoubleClick" Background="Azure" /> <TextBlock Name="txbkUniDesce" Height="23" Width="65" Margin="- 400,13,0,0" Background="White" Text="UniDesce=" /> <TextBox Name="txbDesce" AcceptsReturn="False" AcceptsTab="False" FontWeight="Bold" Height="23" IsEnabled="True" IsReadOnly="True" Text="" Width="170" Margin="-170,10,0,0" /> <StackPanel Name="spAMick" Grid.Row="1" Height="111" HorizontalAlignment="Left" VerticalAlignment="Top" Width="503" Orientation="Horizontal" Background="#FFEBEBFF"> <TextBox Height="23" Name="txbAM" Width="110" Margin="1,5,0,0" Text="Adam Mickiewicz" FontWeight="Bold" VerticalAlignment="Top" /> <TextBox Height="23" Name="txbJS" Width="105" Margin="4,5,0,0" Text="Juliusz Slowacki" FontWeight="Bold" VerticalAlignment="Top" /> <TextBlock Height="23" Name="txbkSelConc" Text="SelConc=" Margin="5,7,0,0" VerticalAlignment="Top" /> <ListBox Height="95" Name="lbx1" Width="73" Margin="2,4,0,0" Background="Azure" MouseDown="lbx1_MouseDown" VerticalAlignment="Top" FontWeight="Bold" IsEnabled="True" Focusable="True" IsHitTestVisible="True" SelectionMode="Single" IsManipulationEnabled="False" IsTabStop="False" IsTextSearchEnabled="True" IsTextSearchCaseSensitive="False" OverridesDefaultStyle="False" GotFocus="lbx1_GotFocus"> <ListBoxItem Content="clk me" /> </ListBox> <ListBox Height="95" Name="lbx2" Width="73" Margin="3,5,0,0" VerticalAlignment="Top" FontWeight="Bold" /> <ListBox Height="95" Name="lbx3" Width="73" Margin="3,5,0,0" VerticalAlignment="Top" FontWeight="Bold" />

<StackPanel Name="spSelMany" Grid.Row="2" Height="60" HorizontalAlignment="Left" VerticalAlignment="Top" Width="503" Orientation="Horizontal" Background="#FFFFF0F0"> <TextBlock Height="23" Name="txbkSelMany" Text="SelMany=" Background="White" Margin="5,0,0,0" /> <TextBox Height="23" Name="txbSelMany" Width="204" Background="Azure" FontWeight="Bold" MouseDoubleClick="txbSelMany_MouseDoubleClick" TextChanged="txbSelMany_TextChanged" Text="2clk me" /> <TextBlock Height="23" Name="txbkTmpl" Text="reg.expr.Tmpl=" Margin="5,0,0,0" Background="White" /> <TextBox Height="23" Name="txbTmpl" Width="155" Background="White" FontWeight="Bold" VerticalAlignment="Top" Margin="0,10,0,0" Text="^Aa{2c{3de" TextChanged="txbTmpl_TextChanged" /> <TextBox Height="23" Name="txbPresent" Width="60" Text="2clk me" FontWeight="Bold" VerticalAlignment="Center" Margin="-180,27,0,0" Background="Azure" MouseDoubleClick="txbPresent_MouseDoubleClick" /> <StackPanel Name="spAa" Grid.Row="3" Height="60" HorizontalAlignment="Left" VerticalAlignment="Top" Width="503" Orientation="Horizontal" Background="#FFEBEBFF"> <TextBox Height="23" Name="txbAa" Width="340" Margin="10,0,0,0" FontWeight="Bold" Background="Azure" Text="2clk me" MouseDoubleClick="txbAa_MouseDoubleClick" /> </Grid> </Window>