C#网络应用编程

这篇博客详细介绍了C#网络应用编程的课堂练习4,包括实验的效果展示和一系列源代码文件,如MainWindowd.xaml, MainWindowd.xaml.cs, App.xaml, 以及在Examples文件夹中的ActionAndFunc和LambdaExample的相关文件。" 106374327,9063753,web基础知识与服务器软件解析,"['servlet', 'javascript', 'html', 'web服务器', 'JavaEE']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

实验课堂练习4

实验效果:

 

 

 MainWindowd.xaml:

<Window x:Class="实验课堂练习4.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:实验课堂练习4"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid Margin="10">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Rectangle Grid.ColumnSpan="2" Fill="white" RadiusX="14" RadiusY="14" Stroke="Blue" StrokeDashArray="3" />
        <Rectangle Grid.Column="0" Margin="7" Fill="#FFF0F9D8" RadiusX="10" RadiusY="10" Stroke="Blue" StrokeDashArray="3" />
        <Rectangle Grid.Column="0" Margin="20" Fill="White" Stroke="Blue" />
        <ScrollViewer Grid.Column="0" Margin="22">
            <StackPanel>
                <StackPanel.Resources>
                    <Style TargetType="Button">
                        <Setter Property="Margin" Value="5 10 5 0" />
                        <Setter Property="Padding" Value="10 0 10 0"/>
                        <EventSetter Event="Click" Handler="button_Click" />
                    </Style>
                </StackPanel.Resources>
                <Button Content="例1" Tag="Examples/LambdaExample.xaml" />
                <Button Content="例2" Tag="Examples/ActionAndFunc.xaml" />
                <Button Content="例3" Tag="Examples/TaskRunExamplePage.xaml" />
                <Button Content="例4" Tag="Examples/async_awaitExamplePage.xaml" />
                <Button Content="例5" Tag="Examples/InvokeAsyncExamplePage.xaml" />
                <Button Content="例6" Tag="Examples/CancellationTokenPage.xaml" />
                <Button Content="例7" Tag="Examples/TaskStatusExamplePage.xaml" />
                <Button Content="例8" Tag="Examples/IProgressExamplePage.xaml" />
                <Button Content="例9" Tag="Examples/TimersPage.xaml" />
            </StackPanel>
        </ScrollViewer>
        <Frame Name="frame1" Grid.Column="1" Margin="10" BorderThickness="1" BorderBrush="Blue" NavigationUIVisibility="Hidden" />
    </Grid>
</Window>

MainWindowd.xaml.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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;

namespace 实验课堂练习4
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
      public partial class MainWindow : Window
      {
        private Button oldButton = new Button();
    
        public MainWindow()
        {

            InitializeComponent();
        }
        private void button_Click(object sender,RoutedEventArgs e)
        {
            Button btn = e.Source as Button;
            oldButton.Foreground = Brushes.Black;
            btn.Foreground = Brushes.Red;
            oldButton = btn;
            frame1.Source = new Uri(btn.Tag.ToString(), UriKind.Relative);
        }
    }
}

App.xaml:

<Application x:Class="实验课堂练习4.App"
             xmlns="http://schemas.m
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值