English
Review tasks
Practical tasks by course topic to check your knowledge. Each task is a separate program.
Topic 1. Git version control
- Create a C# "Temperature converter" console program (Celsius, Fahrenheit, Kelvin) in a new Git repository with
.gitignoreand.gitattributesfiles created fromdotnet newtemplates; record the development in at least four commits with meaningful messages, and showgit status,git log --oneline, and the changes of the last commit withgit show --stat. - Create a C# "Task tracker" console program (tasks with a priority and a deadline) in a Git repository, create the branches
feature/priorityandfeature/deadline, make a commit in each, merge the first branch with a fast-forward and the second with a three-way merge after a new commit onmain; delete the merged branches and showgit log --oneline --graph --all. - Create a C# "Phone book" console program (names and phone numbers) in a Git repository, change the same output line in the
feature/formatbranch and onmain, merge the branch, resolve the merge conflict (in the terminal or in Visual Studio 2026), check the build, and complete the merge; show the conflict markers,git statusduring the conflict, and the history graph after the merge. - Create a C# "Cinema box office" console program (showings and ticket sales) in a Git repository and make two erroneous commits: undo the first with
git revert, remove the second withgit reset --hard HEAD~1, and then restore it withgit reflog; showgit log --onelineafter each action and explain when it is acceptable to usegit reset. - Create a C# "Attendance tracker" console program (students and attended classes) in a Git repository, start a change in the
feature/reportbranch, stash the unfinished work withgit stash push -m, switch tomain, fix and commit a bug, return to the branch, restore the stash, and finish the change with a commit; showgit stash listandgit log --oneline --graph --all. - Create a C# "Body mass index calculator" console program (height, weight, BMI) in a Git repository and mark two of its versions with the annotated tags
v1.0.0andv1.1.0with a description of the changes and aCHANGELOG.mdfile; showgit tag -n,git diff --stat v1.0.0 v1.1.0, the contents ofProgram.csin version 1.0.0 (git show v1.0.0:Program.cs), and temporarily switch to it withgit switch --detach. - Create a C# "Warehouse inventory" console program (products and stock) in a Git repository, make three commits in the
experiment/importbranch, one of which fixes a bug that also exists onmain; bring only this fix tomainwithgit cherry-pick, rebase the branch ontomain, and show that Git skipped the already applied commit. - Create a C# "Exam schedule" console program (course, date, room), an empty repository
D:\Labs\remote\Exams.git, and two clones on behalf of two participants; both make commits, the second gets agit pushrejection, runsgit pull, resolves a conflict if necessary, and pushes the changes; showgit log --oneline --graphin both clones andgit remote -v. - Create a C# "Currency converter" console program (an amount and an exchange rate) in a Git repository with a history of at least six commits, one of which introduces a calculation bug; find this commit with
git bisect, inspect it withgit showandgit blame, undo the bug withgit revert, and showgit log --oneline. - Create a C# "Budget tracker" console program (income and expenses) in a Git repository and a
pre-commithook in the.githooksfolder that runsdotnet buildand aborts the commit if the build fails; enable the folder withgit config core.hooksPath .githooks, and show a rejected commit with a compilation error and a successful commit after the fix.
Topic 2. Regular expressions
- Create a console program that asks the user for a postal code (five digits), a phone number
+380XXXXXXXXX, and a datedd.mm.yyyy, checks each value with theRegex.IsMatchmethod with the^and\zanchors, additionally checks that the date exists with theDateOnly.TryParseExactmethod, and prints "valid" for each field or a description of the expected format. - Create a console program that asks the user for a text and a word, finds all occurrences of the word as a whole word case-insensitively (
\bboundaries,Regex.Escape), and prints the number of matches and the position of each. - Create a console program that asks for lines
LastName FirstName, CS-21, 87until an empty line is entered, parses them with a pattern with named groups (last name, first name, group, a score from 0 to 100), rejects invalid lines with a message, and prints a table of students and the average score of each group. - Create a console program that reads text from a file, replaces
yyyy-mm-dddates withdd.mm.yyyyusing group substitution, and dollar prices$12.50with prices in hryvnias at a rate entered by the user using theReplacemethod with aMatchEvaluator, and prints the result and the number of replacements of each kind. - Create a console program that asks for a line of numbers separated by any number of commas, semicolons, spaces, or tabs, splits it with the
Regex.Splitmethod, checks each number with theTryParsemethod, and prints the sum, the average, and the invalid elements. - Create a console program that asks for a password, checks it with a single pattern with lookaheads (at least 10 characters, an uppercase and a lowercase letter, a digit, no spaces), and if the check fails, determines and prints all the violated rules with separate patterns.
- Create a console program that reads a text file with Windows line endings, in
RegexOptions.Multilinemode finds lines that start with the wordsHACKorFIXMEcase-insensitively, and prints the number of each line and the text after the keyword without the\rcharacter. - Create a console program with a static
partialclass in which patterns for an email address, a Ukrainian IBAN, and a postal code are declared with the[GeneratedRegex]attribute; the program reads values from a file (one per line) and prints a table "value – type – format valid". - Create a console program that asks for a number of characters n, builds a string of n letters
aand a!character, checks it with the pattern^(a+)+$with a 200 ms timeout, catchesRegexMatchTimeoutException, and then checks the same string with theRegexOptions.NonBacktrackingoption and the equivalent pattern^a+$, printing the time of each check. - Create a console program that reads an application log file with lines
2026-09-17 10:15:32 [ERROR] text, counts the entries by level (INFO,WARN,ERROR), replaces the numbers in the error texts withNto group identical messages, and prints the five most frequent error messages with their counts.
Topic 3. Windows Forms fundamentals
- Create a Windows Forms application in which the user enters the lengths of the three sides of a triangle in text fields and, after clicking the Calculate button, sees the perimeter, the area by Heron's formula, and the type of the triangle. Invalid values (not numbers, non-positive numbers, sides that do not form a triangle) are marked with an
ErrorProvidercomponent. - Create a Windows Forms "User registration" application with fields for a login (3–20 Latin letters and digits), an email, a password, and a password confirmation. The fields are validated in
Validatingevents with anErrorProvider, the Cancel button closes the form without validation, and the Register button shows aMessageBoxonly when the data is valid. - Create a Windows Forms application for ordering coffee with a choice of drink (
RadioButton), size (ComboBox), extras (CheckBox), and quantity (NumericUpDown). The price is updated after every change by one shared event handler, and the Order button shows the order summary in aMessageBox. - Create a Windows Forms application with a list of cities in a
ListBoxand a city name input field with Add, Remove, and Sort buttons. Empty names and duplicates are not added (a message in aMessageBox), the Remove button is available only when a city is selected, and a label shows the number of cities. - Create a Windows Forms "Questionnaire" application with labels and fields laid out in a
TableLayoutPaneland OK and Cancel buttons anchored to the bottom-right corner of the form (Anchor). When the window is resized, the fields stretch, the form has a minimum size, and the Enter and Esc keys press the corresponding buttons. - Create a Windows Forms "Notepad" application with a File main menu (New, Open…, Save As…, Exit) with shortcut keys, a multiline text field filling the whole form, and a status bar with the number of characters. Files are opened and saved through
OpenFileDialogandSaveFileDialog, and read and write errors are shown in aMessageBox. - Create a Windows Forms "Countdown timer" application in which the user sets the minutes and seconds in
NumericUpDowncontrols and starts, pauses, and resets the countdown with buttons. ATimercomponent updates the label every second, and when the countdown ends the form changes its background color and shows aMessageBox. - Create a Windows Forms application with a main form with a list of products and a modal form for adding a product (name, price, quantity) with OK and Cancel buttons. The modal form validates the fields and closes with
DialogResult.OKonly when the data is valid; the main form adds the product and shows the total cost. - Create a Windows Forms "Student records" application with a
DataGridViewtable bound to aBindingList<T>through aBindingSource, and fields for the last name, group, and average score (60–100) with Add and Delete buttons. The status bar shows the number of students and the group's average score. - Create a Windows Forms application that, while the mouse moves over a panel, shows the cursor coordinates in the status bar, after a left click adds an "X, Y" point to a
ListBox, after Ctrl+Z is pressed (the form'sKeyDownevent withKeyPreview) removes the last point, and whose list context menu contains the Copy (copy the points to the clipboard) and Clear commands.
Topic 4. GDI+ graphics
- Create a Windows Forms application that in the
OnPaintmethod draws a house made of a rectangle, a triangular roof (FillPolygon), hatched windows, and a sun circle; the drawing scales to the window size and does not disappear after the window is minimized. - Create a Windows Forms application that draws three rectangles filled with
SolidBrush,HatchBrush, andLinearGradientBrushbrushes, with the brush names as labels centered in the rectangles; the hatch style is chosen in aComboBox. - Create a Windows Forms application in which text entered in a field is displayed in a frame in the center of the window; the font size is automatically chosen with
MeasureStringso that the text takes up no more than 80 % of the window width. - Create a Windows Forms application that plots the function y =
− 4 on an interval given by the user (the start is less than the end) with axes, ticks, and labels; mathematical coordinates are converted to pixels with theMatrixclass. - Create a Windows Forms application that creates a 400 × 300
Bitmap, draws a 5 × 5 multiplication table with borders in it, and saves the image to a PNG file chosen in aSaveFileDialog; the image is shown in aPictureBox. - Create a Windows Forms application that opens an image and converts it to a negative with the
GetPixelandSetPixelmethods, showing the original and the result; an invalid file is reported without crashing the program. - Create a Windows Forms application in which the user draws rectangles with the mouse (press, drag, release), all rectangles are stored in a list, and a right click deletes the rectangle under the cursor.
- Create a Windows Forms application in which a ball (a circle) moves and bounces off the edges of the window on a
Timer, the speed is changed with the "+" and "−" keys, and the animation does not flicker thanks to double buffering. - Create a custom
BatteryIndicatorcontrol with aLevelproperty (0–100) with theCategory,Description, andDefaultValueattributes that draws a battery with charge segments, and a form on which the level is changed with aTrackBar. - Create a Windows Forms application that draws five shapes (a circle, a square, a triangle, a star, an ellipse) as
GraphicsPathobjects and, after a mouse click, prints the name of the shape under the cursor in the status bar (anIsVisiblecheck).
Topic 5. Asynchrony with async/await
- Create a Windows Forms application that, after a button is clicked, counts in
Task.Runthe number of primes up to the entered number (no more than 50,000,000). During the calculation the button is disabled, the cursor shows a wait state, and the result and the time are printed in a label. - Create a Windows Forms "Notes" application that asynchronously opens and saves text files (
File.ReadAllTextAsync,File.WriteAllTextAsync) through the common dialogs and shows read and write errors in aMessageBoxwithout blocking the interface. - Create a Windows Forms application that simulates a long-running operation of ten steps (
Task.Delayof 500 ms each) with progress in aProgressBarthroughIProgress<int>and a Cancel button; after cancellation a label shows the number of the step at which the operation was stopped. - Create a Windows Forms application that asynchronously copies a selected file into a selected folder in 1 MB chunks with progress in percent and a Cancel button; after cancellation the partially copied file is deleted.
- Create a Windows Forms application that starts five simulated downloads of different durations at the same time, shows the completion time of each in a list (
Task.WhenAll), and the name of the fastest one (Task.WhenAny). - Create a Windows Forms application that performs a simulated operation of a random duration from 1 to 5 s with a timeout set in a
NumericUpDown; if the operation does not finish in time, it is canceled, and a label shows "Timeout". - Create a Windows Forms application that processes 20 simulated tasks (
Task.Delayof a random duration), running no more than a given number at the same time (SemaphoreSlim), and shows in a label the current and the maximum number of tasks running at the same time. - Create a Windows Forms application that asynchronously processes several selected text files at the same time (a word count); if some files could not be read, the application shows the results of the successful files and a list of all errors (
Task.WhenAll,Exception.InnerExceptions). - Create a Windows Forms application that asynchronously reads a large text file line by line through a method that returns
IAsyncEnumerable<string>and adds the lines containing an entered word to aListBoxas soon as they are found, with the ability to cancel. - Create a Windows Forms application in which a background task generates a random temperature measurement every second and updates a label and a list of the last 10 measurements without cross-thread access errors (
Control.InvokeAsyncorIProgress<T>), and buttons start and stop the measurements.
Topic 6. DI, configuration, logging
- Create a console program in which the
IMessageSenderinterface has two implementations (email and SMS, console output), theOrderServiceservice receives it through its constructor, and the implementation is chosen by the registration in theServiceCollectionaccording to the wordemailorsmsentered by the user. - Create a console program that registers three services with the Singleton, Scoped, and Transient lifetimes, creates two scopes, and prints the IDs of the instances obtained in each scope, as well as messages about the objects being disposed.
- Create a console program in which three payment methods (card, cash, transfer) are registered as keyed
IPaymentservices; the user enters an amount and a method, and for an unknown method the program prints the list of available ones. - Create a console program with a host and a
BackgroundServicethat every N seconds (N inappsettings.json) logs the current time and the iteration number, and after Ctrl+C logs the total number of iterations. - Create a console program with a host that prints the values of the
App:NameandApp:Portkeys and the environment name and demonstrates overriding the values fromappsettings.jsonwith anappsettings.Development.jsonfile, an environment variable, and a command-line argument. - Create a console program with a host in which the
Smtpsection (server, port 1–65535, sender address) is bound to an options class withValidateDataAnnotationsandValidateOnStartvalidation, and the program prints the options or exits with an error message. - Create a console program with a host that reads a database connection string from user secrets, prints it with the password hidden, and reports if the secret is not set; describe the
dotnet user-secretscommands for the setup. - Create a console program in which an order processing service receives an
ILogger<T>and writes structured messages with theOrderIdandAmountfields at different levels, and the minimum level for the service's category is set inappsettings.json. - Create a Windows Forms application with a host in which the main form is created by the container and receives a calculator service and an
ILogger<T>through its constructor, and every calculation is logged. - Create a library with a service that determines whether a store is open (the opening hours in
IOptions<T>, the time fromTimeProvider) and xUnit.net unit tests withFakeTimeProviderandNullLogger<T>for the boundaries of the working hours.
Topic 7. SQL and ADO.NET
- Create an SQL script for PostgreSQL that creates the
departmentsandemployeestables with identity primary keys, a foreign key, andNOT NULL,UNIQUE(email), andCHECK(a positive salary) constraints, fills them with five rows, and prints the employees with the department names. - Create an SQL script for the
productstable (name, category, price, quantity) that adds products with anINSERT … RETURNINGstatement, raises the prices of products of a given category by 5 %, deletes products with zero quantity, and prints the state of the table after each statement. - Create an SQL script that, for the
studentstable (name, group, year of admission, average score), prints the students of a group with a score from 75 to 90 sorted by score in descending order, and also finds students whose last name starts with a given letter (ILIKE). - Create an SQL script for the
authors,books, andbook_authors(N:M) tables that prints the books with all their authors, the authors without books (LEFT JOIN), and the number of books of each author. - Create an SQL script for the
orderstable (customer, date, amount) that prints the number and total of orders by month and the customers with an order total over 10,000 UAH (GROUP BY,HAVING). - Create a C# console program that connects to PostgreSQL through an
NpgsqlDataSource(the connection string in user secrets) and prints all rows of thecitiestable (name, population) as an aligned table, reading them with anNpgsqlDataReaderwithNULLchecks. - Create a C# console program that asks for part of a product name and prints the matching products from the
productstable of a PostgreSQL database with a parameterizedILIKEquery; show that the input' OR '1'='1does not return all rows. - Create a C# console program that prints the number of records and the minimum and maximum price in the
productstable with theExecuteScalarAsyncmethod, and adds a product entered from the keyboard with validation with theExecuteNonQueryAsyncmethod. - Create a C# console program that transfers an amount between two accounts of the
accountstable in anNpgsqlTransaction: if there are insufficient funds or the account does not exist, the transaction is rolled back with a message. - Create a Windows Forms application that fills a
DataTablefrom theemployeestable and shows it in aDataGridViewwith search by last name and the number of records in the status bar; connection errors are shown in aMessageBox.
Topic 8. Entity Framework Core
- Create a C# console program with EF Core and PostgreSQL with "Author" and "Book" entities (a 1:N relationship), create the tables with a migration, add three books by two authors, and print the authors with the number of their books.
- Create a C# console program with EF Core in which the "Product" model is configured through the Fluent API: a name of up to 100 characters with a unique index, a
numeric(10,2)price, and aCHECKconstraint on non-negative stock; the program adds a product and handles constraint violations with a message. - Create a C# console program with EF Core that, for the "Category" and "Product" entities, asks for a category name and prints its products loaded through
Include, sorted by price; a missing category is reported. - Create a C# console program with EF Core in which students and courses are related N:M; the program asks for a student and a course, enrolls the student in the course (a repeated enrollment is rejected), and prints the student's courses.
- Create a C# console program with EF Core that asks for a minimum and a maximum price (the minimum is not greater than the maximum) and prints the products in this range with a projection to a
(Name, Category, Price)record sorted by name. - Create a C# console program with EF Core that prints, for each category, the number of products and the average and maximum price, calculated in the database through
GroupBy, sorted by the number of products. - Create a C# console program with EF Core that asks for a page number and a page size (from 1 to 50) and prints the corresponding page of the list of customers sorted by last name, and the total number of pages.
- Create a C# console program with EF Core with a menu for the "Note" entity: add, change the text, delete by number, and print all notes; changes are saved with
SaveChangesAsync, and a nonexistent number is reported. - Create a C# console program with EF Core that asks for a category and a discount percentage (from 1 to 90) and changes the prices of all products of the category with a single
ExecuteUpdateAsynccall, printing the number of changed products. - Create a C# console program with EF Core that transfers an amount between two accounts in an explicit transaction (an insufficient balance cancels the transfer), and a conflict from a concurrent change of an account is detected with the
xmintoken and handled with a message.
Topic 9. Networking and sockets
- Create a TCP server and a TCP client as console programs: the client sends lines entered by the user, and the server returns each line with its characters reversed together with its length; an empty line ends the session, and after the client disconnects the server waits for the next one.
- Create a TCP server that serves several clients at the same time, keeps a counter of messages received from all clients, and replies to each message with its number, and a console client; the server prints client connections and disconnections to the console.
- Create a TCP announcement server that broadcasts every message received from a client to all connected clients with the sender's name, and a console client with a separate task for receiving messages.
- Create a TCP server with a protocol of the commands
SUM numbers,MAX numbers, andQUITthat replies with the codes200,400(invalid arguments), and404(unknown command), and a console client that prints the server's responses. - Create console programs that transfer an array of integers over TCP: the client sends the count of numbers and the numbers themselves in network byte order (
BinaryPrimitives), and the server reads them with theReadExactlyAsyncmethod and returns the sum and the average. - Create a TCP server and client that exchange JSON messages (one object per line): the client sends a student's data (name, group, grades), and the server returns an object with the average score and the verdict "passed" if the average is at least 60.
- Create a UDP sender that sends datagrams with lines entered by the user to
127.0.0.1:6200, and a UDP receiver that prints each datagram with the sender's address and the total number of datagrams received. - Create a UDP server that replies to a
WHObroadcast request with its name and TCP port, and a client that sends the request to the broadcast address, collects replies for 3 s, and prints the list of servers found. - Create a TCP client that connects to a server with a 3 s timeout, waits no longer than 5 s for a response, and prints clear messages for a refused connection, a timeout, and a broken connection, and a server that replies to a request with a random delay of 0–8 s.
- Create a Windows Forms application that connects to a TCP server at the address and port from text fields, sends a line from an input field, and shows the server's responses in a
ListBoxwithout blocking the interface, as well as a console echo server for testing.
Topic 10. REST web services
- Create an ASP.NET Core Minimal API "Product catalog" web service with in-memory data and
GET,POST,PUT,DELETEendpoints for the/api/productsresource that return the codes 200, 201 with aLocationheader, 204, and 404. - Create a Minimal API "Class timetable" web service in which the route
GET /api/lessons/{day:int:range(1,7)}returns the classes of a day of the week, and a request with a day number out of range gets 404. - Create a Minimal API "Library" web service whose
GET /api/booksendpoint supports the query string parametersauthor,year,page, andpageSize(1–20) and returns a page of books with the total number found. - Create a Minimal API "Course registration" web service in which the handlers have the return types
Results<Created<T>, Conflict>andResults<Ok<T>, NotFound>, and a repeated registration of the same email for a course returns 409. - Create a Minimal API "Questionnaires" web service that, with
AddValidationand the[Required],[Range],[EmailAddress]attributes, validates a questionnaire (name, age 16–100, email) and returns errors in theProblemDetailsformat; unhandled exceptions are also returned asProblemDetailswith code 500. - Create a Minimal API "Cinema" web service with a route group
/api/hallsand a nested group/api/halls/{hallId}/seats, shared OpenAPI tags, and an endpoint filter that logs the method, the address, and the execution time of every request. - Create a Minimal API "Student records" web service that stores data in a database through EF Core (
AddDbContext), implements CRUD operations asynchronously, and returns the list of a group's students sorted by last name. - Create a Minimal API "Notes" web service with an OpenAPI document (
AddOpenApi,MapOpenApi) and endpoint descriptions, as well as an.httpfile with an address variable, requests to all endpoints, and invalid requests (400, 404). - Create a console program that gets exchange rates in JSON format from the web service
GET /api/rateswithHttpClient, asks the user for an amount and currency codes, prints the conversion result, and reports service unavailability or a timeout. - Create a console program with an
IHttpClientFactorytyped client for a task web service (GET/POST /api/tasks) that adds a task entered by the user, prints the list as a table, and shows validation errors from theProblemDetailsbody.
Topic 11. Real time with SignalR
- Create an ASP.NET Core SignalR server with a
NotesHubhub whose method accepts an author name and a note text and broadcasts them to all clients, and a console client that asks for a name, sends the lines you type, and prints the received notes with the time they were received. - Create a SignalR server with a
Rollhub method that generates a random number from 1 to 6: the caller (Clients.Caller) receives the result, and the other clients (Clients.Others) receive the message "name rolled the die: N"; the console client sends a roll on therollcommand. - Create a SignalR server with room groups in which a client joins a room with the
join namecommand and leaves it with theleavecommand, and only the members of their room receive messages; an attempt to write outside a room is rejected with aHubException. - Create a strongly typed hub
Hub<IWeatherClient>with aWeatherUpdated(city, temperature)client method and a console client in which the user enters a city and a temperature (from −60 to 60), and all clients print the updates; invalid data is rejected by the server. - Create a SignalR server that in
OnConnectedAsyncandOnDisconnectedAsynckeeps a list of connected users (the name is passed in the query string) in a singleton service and sends everyone the updated list, and a console client that prints the list after every change. - Create a SignalR server with a chat hub (the
SendMessagemethod broadcasts a name and a text to everyone) and aHubConnectionconsole client that receives the hub address and the name as command-line arguments, validates them, handles server unavailability at startup with a message to the error stream and exit code 1, sends the lines you type, and prints the received messages. - Create a SignalR server with a chat hub that broadcasts a message name and text to all clients, and a Windows Forms client with name and message fields, a send button, and a message list to which messages are added from the
Onhandler in a way that is safe for the UI thread; while there is no connection, the send button is unavailable. - Create a SignalR server with a hub that has methods for joining a group and sending a message to a group, and a console client with automatic reconnection that prints with timestamps the
Reconnecting,Reconnected(a new connection ID), andClosedevents and, after a reconnect, rejoins the group given as a command-line argument. - Create a SignalR server with a
BackgroundServicethat every 2 s sends the current server time to all clients throughIHubContext<THub>, and aPOST /api/messageendpoint that sends an entered text to everyone; the console client prints both types of messages. - Create a SignalR server with a streaming hub method that returns an
IAsyncEnumerable<int>of primes up to N with a 200 ms pause, and a console client that asks for N (from 2 to 10,000), prints the numbers as they arrive, and cancels the stream when Enter is pressed.
Topic 12. WPF fundamentals
- Create a WPF application with a registration form (login, a
PasswordBoxpassword, a password confirmation, a date of birth) laid out with aGridpanel withAutoand*columns. The Register button (IsDefault) validates the fields and shows errors in aTextBlock, and the Cancel button (IsCancel) closes the window. - Create a WPF application whose main window is laid out with a
DockPanel: a menu at the top, a status bar at the bottom, a list of cities on the left, and a card of the selected city (name, population, description) on the right with aGridSplitter. - Create a WPF application with a panel of twelve color buttons on a
UniformGrid, where one handler of the bubblingClickevent attached to the panel changes the color of a preview rectangle and shows the color name, ande.Handledstops the event. - Create a WPF application with a field for entering a phone number in which the tunneling
PreviewTextInputevent lets through only digits, spaces, and a leading+, and thePreviewKeyDownevent forbids pasting text with Ctrl+V with a message in the status bar. - Create a WPF application with a
ListBoxlist of tasks, an input field, and Add, Remove, and Clear buttons. Empty tasks and duplicates are not added, Remove is available only for a selected task, and a label shows the number of tasks. - Create a WPF
RatingControluser control with aValuedependency property (0–10, with coercion) and a callback method that updates the display, and a window in which aSlideris bound to the element'sValuewithElementName. - Create a WPF application in which clicking a
Canvasadds a circle at the click point (theCanvas.LeftandCanvas.Topattached properties are set in code), the right mouse button deletes the circle under the cursor, and a label shows the number of circles. - Create a WPF application with a list of products and a modal window for adding a product (name, price, quantity) with OK and Cancel buttons. The window closes with
DialogResult = trueonly when the data is valid, and the main window adds the product and shows the total cost. - Create a WPF "Notepad" application with a File menu (Open, Save, Exit), a toolbar, and a text field, where the menu items and buttons use the built-in
ApplicationCommands.OpenandSavecommands withExecutedandCanExecutehandlers, and the Ctrl+O and Ctrl+S keys work without extra code. - Create a WPF application that chooses a folder with an
OpenFolderDialog, shows the list of the folder's text files in aListBox, and after a file is selected shows its content in aTextBoxand its size in the status bar; read errors are shown in aMessageBox.
Topic 13. Data binding and MVVM
- Create a WPF application in which the first and last name fields are bound to a ViewModel with
INotifyPropertyChanged, a label with the full name is updated while typing, and the label's font size is bound to aSliderthroughElementName. - Create a WPF application following the MVVM pattern with a list of students (
ObservableCollection<T>) shown in aListBoxthrough aDataTemplate, fields for adding a student, and an Add command that is unavailable when the name is empty. - Create a WPF application that shows a list of products with a price and, with a custom
IValueConverter, displays the price as the words "cheap", "moderate", or "expensive" depending on bounds passed as the converter parameter. - Create a WPF application with a registration form (login, email, age) in which the ViewModel implements
INotifyDataErrorInfo, errors are shown with a border and a tooltip, and the save button is unavailable while there are errors. - Create a WPF application with a button style in the window resources that changes the font under the mouse cursor through a
Trigger, and a style based on the first one (BasedOn) for the delete button. - Create a WPF application with a round button whose look is set by a custom
ControlTemplatewithTemplateBindingandIsMouseOverandIsPressedtriggers, and a light and dark theme switch throughDynamicResource. - Create a WPF application following the MVVM pattern with a list of cities (name, region, population), search while typing, and sorting by population through
ICollectionView. - Create a WPF application in which a counter is incremented and decremented by commands based on a custom
RelayCommand : ICommandclass, and the decrement command is unavailable when the value is zero. - Create a WPF "Shopping list" application on CommunityToolkit.Mvvm with the
[ObservableProperty]and[RelayCommand]attributes, add and delete commands, and a label with the number of items. - Create a class library with a discount calculator ViewModel on CommunityToolkit.Mvvm, a WPF application that uses it, and xUnit.net unit tests that check the calculation and the command's unavailability for invalid data.
Topic 14. WPF animation and multimedia
- Create a WPF application in which a logo made of shapes (
Ellipse,Path) with a gradient brush rotates by 360° in 2 s after a click on it; the center of rotation is the center of the logo, and a repeated click during the rotation is ignored. - Create a WPF application in which buttons under the cursor smoothly grow by 10 % and return to their normal size when the cursor leaves them (a style with an
IsMouseOvertrigger,EnterActions, andExitActions). - Create a WPF application in which a rectangle, after a button is clicked, moves across the canvas to the right in 1 s, changes its background color with a
ColorAnimation, and returns back (AutoReverse) twice; a slider sets the duration of 0.5–5 s. - Create a WPF application with an animated loading bar described by a storyboard in the resources and Start, Pause, Resume, Stop buttons; after completion the status bar shows "Done", and after a pause the current storyboard time.
- Create a WPF application in which a notification appears from above with a bounce (a
ThicknessAnimationwithBounceEase), stays for 3 s, and disappears with an opacity animation; a button shows the notification with an entered text, and an empty text is not accepted. - Create a WPF application in which a ball travels a path through four keyframes (linear, discrete, spline, and eased), and a list lets you choose the easing function of the last frame (
BounceEase,ElasticEase,CubicEase). - Create a WPF application in which a ball thrown with a mouse click in the direction of the cursor moves under gravity and bounces off the walls and the floor with a loss of speed; the motion is calculated in
CompositionTarget.Renderingfrom the frame time. - Create a WPF application with a field in which a click creates a circle that expands and disappears in 1 s (an animation from code with
BeginAnimation); after the animation finishes, the circle is removed from the canvas. - Create a WPF video player application on
MediaElementwith Play/Pause and Stop buttons, a position slider that is updated by a timer and allows seeking, a time display, and a message if the file fails to open. - Create a WPF application with three sound buttons that play WAV files from the program folder with the
MediaPlayerclass, have a shared volume slider, and show in the status bar the sound duration or a message about a missing file.
Topic 15. Cross-platform .NET MAUI
- Create a .NET MAUI application with one page on which a
Gridlays out fields for entering weight and height, a Calculate button, and a label with the body mass index. The buttons have an explicit style withx:Key, and the text colors are set throughAppThemeBindingfor the light and dark themes. - Create a .NET MAUI application that shows a list of students (last name, group, average score) in a
CollectionViewwith an item template, anEmptyViewfor an empty list, and an Add button that adds a student from input fields after validating the data. - Create a .NET MAUI application with a settings page on which a
Switchtoggles the dark theme (UserAppTheme), aSlidersets the font size of a sample text, and the chosen values are stored inPreferencesand restored after a restart. - Create a .NET MAUI "Counter" application with a ViewModel on CommunityToolkit.Mvvm (
[ObservableProperty],[RelayCommand]), +1, −1, and Reset buttons, and compiledx:DataTypebindings; the −1 button is unavailable when the value is zero. - Create a .NET MAUI application with two Shell pages: a list of cities and a city details page. The details page route is registered in
AppShell, the city name is passed as a string query parameter, and the details page receives it throughIQueryAttributable. - Create a .NET MAUI "Notes" application in which the note text is stored in a file in
FileSystem.AppDataDirectory, loaded when the page appears, and the Save and Delete buttons save and delete the file with aDisplayAlertAsyncmessage. - Create a .NET MAUI application that, after a button is clicked, checks and requests the
Permissions.LocationWhenInUsepermission, gets the device coordinates throughGeolocation, and shows them with the distance to London; a denied permission and disabled location services are explained to the user. - Create a .NET MAUI application in which the Pick photo button opens
MediaPicker, the selected photo is shown in anImageand copied to the application data folder, and the Take photo button is available only whenIsCaptureSupportedistrue. - Create a simple ASP.NET Core Minimal API web service
GET /api/products(name, price) and a .NET MAUI application that gets the list of products in JSON format throughHttpClient, shows it in aCollectionViewinside aRefreshView, and reports an error if the service is unavailable. - Create a .NET MAUI application in which a task list page and its ViewModel are registered in
MauiProgramtogether with anITaskStorestorage service, the ViewModel receives the service through its constructor, and tasks are added, marked as done, and stored in a JSON file.
Topic 16. AI in .NET
- Create a console chat program that, through
IChatClientwith a "bookstore consultant" system instruction, answers the user's questions in English, and for empty input or an unavailable model prints an error message. - Create a console chat program that keeps the conversation history in a
List<ChatMessage>, trims it to the last 10 messages (the system one remains), and after each response prints the number of input and output tokens. - Create a console program that prints the model's response as a stream (
GetStreamingResponseAsync) and lets you interrupt generation by pressing Esc through aCancellationToken, after which it prints "Cancelled". - Create a console program that sends the same request with temperature 0 and 1 three times each (
ChatOptions), limits the response to 100 tokens, and prints the responses and theFinishReasonas a table. - Create a console program that extracts a
record EventInfo(name, date, city, price ornull) from an entered event announcement text throughGetResponseAsync<T>, checks the date and price in code, and reports an invalid model response. - Create a console program in which, to answer about exchange rates, the model calls the C# function
GetRate(string currency)with in-memory rates; the function checks the three-letter currency code and returns a message about an unknown currency. - Create a console program that builds a
ChatClientBuilderpipeline withUseLogging(theDebuglevel) and a custom middleware client that measures and prints the time of each request to the model. - Create a console program that creates embeddings of ten sentences from a file and, for an entered sentence, prints the three nearest ones with the cosine similarity calculated by
TensorPrimitives.CosineSimilarity. - Create a console program that answers questions from a text file of rules: it finds the three nearest items by embeddings, passes them to the model with the instruction to answer only from them, and prints the answer with the item numbers.
- Create a class library with a
TicketClassifierservice that usesIChatClientto determine the category of a request, and xUnit unit tests with a fakeIChatClientthat check a valid response, invalid JSON, and model unavailability.