Tailspin Spyworks指南第三讲:布局和类别菜单

Part 3: Layout and Category Menu
第三部分:布局和类别菜单

By  Joe Stagner |July 21, 2010
Translated By   litdwg  |March 12,2014

Tailspin Spyworks demonstrates how extraordinarily simple it is to create powerful, scalable applications for the .NET platform. It shows off how to use the great new features in ASP.NET 4 to build an online store, including shopping, checkout, and administration.

通过Tailspin Spyworks 演示在.NET平台创建功能强大,结构良好的应用程序有多么简单。演示如何使用ASP.NET 4的新特性创建一个包含购物、结算和管理功能的在线网店。

This tutorial series details all of the steps taken to build the Tailspin Spyworks sample application.  Part 3 covers adding layout and a category menu.

本系列指南对构建案例程序的每一步做了详细的解释。第三部分讲述添加布局和类别菜单。  

添加布局和类别菜单

 

In our site master page we'll add a div for the left side column that will contain our product category menu.

在Master页面,添加一个div,此div将显示在左侧,用来显示商品类别的菜单。

<div id="content">
  <div id="rightColumn"></div>
  <div id="mainContent">
    <div id="centerColumn">
       <asp:ContentPlaceHolder ID="MainContent" runat="server"></asp:ContentPlaceHolder>
    </div>
  </div>
  <div id="leftColumn">
<!-- Our menu will go here -->       
  </div>
  <div class="clear"></div>
</div>

Note that the desired aligning and other formatting will be provided by the CSS class that we added to our Style.css file.

请注意:此div的显示效果是由之前添加的Sytle.css中的CSS类设定的。

#leftColumn
{
position: relative;
	float: left;
	width: 14em;
	padding: 2em 1.5em 2em;
	background: #fff url('images/a1.gif') repeat-y right top;
    	top: 1px;
    	left: 0px;
    	height: 100%;
}

The product category menu will be dynamically created at runtime by querying the Commerce database for existing product categories and creating the menu items and corresponding links.

商品类别的菜单是动态创建的,在运行时从数据库中读取,创建菜单项和相应的链接。

To accomplish this we will use two of ASP.NET's powerful data controls. The "Entity Data Source" control and the "ListView" control.

我们是由强大的数据控件"Entity Data Source" 和"ListView" 实现此功能。

Let's switch to "Design View" and use the helpers to configure our controls.

切换到”设计视图“使用设计前配置这些控件。

Let's set the EntityDataSource ID property to EDS_Category_Menu and click on "Configure Data Source".

设置EntityDataSource的ID属性为EDS_Category_Menu,然后点击”配置数据源“。

Select the CommerceEntities Connection that was created for us when we created the Entity Data Source Model for our Commerce Database and click "Next".

选择之前创建的数据库链接,并点击”下一步“。

Select the "Categories" Entity set name and leave the rest of the options as default. Click "Finish".

在实体集名称处选择”类别“,其它保持默认设置,点击”完成“。

Now let's set the ID property of the ListView control instance that we placed on our page to ListView_ProductsMenu and activate its helper.

将ListView控件的ID属性设置为ListView_ProductsMenu,打开它的设计器。

Though we could use control options to format the data item display and formatting, our menu creation will only require simple markup so we will enter the code in the source view.

我们可以使用控件选项累定义数据项的显示格式,但我们只需要一些简单的标记即可,因此直接在代码视图输入这些代码。

<asp:ListView ID="ListView_ProductsMenu" runat="server" DataKeyNames="CategoryID" 
		DataSourceID="EDS_Category_Menu">
   <EmptyDataTemplate>No Menu Items.</EmptyDataTemplate>
   <ItemSeparatorTemplate></ItemSeparatorTemplate>
   <ItemTemplate>
      <li>
         <a href='<%# VirtualPathUtility.ToAbsolute("~/ProductsList.aspx?CategoryId=" + 
                                Eval("CategoryID")) %>'><%# Eval("CategoryName") %></a>
      </li>
   </ItemTemplate>               
   <LayoutTemplate>
      <ul ID="itemPlaceholderContainer" runat="server">
         <li runat="server" id="itemPlaceholder" />
      </ul>
      <div>
      </div>
   </LayoutTemplate>

Please note the "Eval" statement : <%# Eval("CategoryName") %>

请注意”Eval“语句:<%# Eval("CategoryName") %>

The ASP.NET syntax <%# %> is a shorthand convention that instructs the runtime to execute whatever is contained within and output the results "in Line".

<%# %> 语法表明其中的内容需要在运行时执行并将运行结果输出到此位置。

The statement Eval("CategoryName") instructs that, for the current entry in the bound collection of data items, fetch the value of the Entity Model item names "CatagoryName". This is concise syntax for a very powerful feature.

 Eval("CategoryName")语句意思是在数据项集合中的当前项(当前记录)中和“CatagoryName”匹配的值。

Lets run the application now.

运行程序,结果如下图。

Note that our product category menu is now displayed and when we hover over one of the category menu items we can see the menu item link points to a page we have yet to implement named ProductsList.aspx and that we have built a dynamic query string argument that contains the category id.

注意产品类别菜单已经创建,当鼠标指向某类别,将看到相应的链接,该链接包含一个值为此类别ID值得参数,指向ProductsList.aspx页面(此页面随后将实现)。

在当今计算机视觉领域,深度学习模型在图像分割任务中发挥着关键作用,其中 UNet 是一种在医学影像分析、遥感图像处理等领域广泛应用的经典架构。然而,面对复杂结构多尺度特征的图像,UNet 的性能存在局限性。因此,Nested UNet(也称 UNet++)应运而生,它通过改进 UNet 的结构,增强了特征融合能力,提升了复杂图像的分割效果。 UNet 是 Ronneberger 等人在 2015 年提出的一种卷积神经网络,主要用于生物医学图像分割。它采用对称的编码器 - 解码器结构,编码器负责提取图像特征,解码器则将特征映射回原始空间,生成像素级预测结果。其跳跃连接设计能够有效传递低层次的细节信息,从而提高分割精度。 尽管 UNet 在许多场景中表现出色,但在处理复杂结构多尺度特征的图像时,性能会有所下降。Nested UNet 通过引入更深层次的特征融合来解决这一问题。它在不同尺度上建立了密集的连接路径,增强了特征的传递与融合。这种“嵌套”结构不仅保持了较高分辨率,还增加了特征学习的深度,使模型能够更好地捕获不同层次的特征,从而显著提升了复杂结构的分割效果。 模型结构:在 PyTorch 中,可以使用 nn.Module 构建 Nested UNet 的网络结构。编码器部分包含多个卷积层池化层,并通过跳跃连接传递信息;解码器部分则包含上采样层卷积层,并与编码器的跳跃连接融合。每个阶段的连接路径需要精心设计,以确保不同尺度信息的有效融合。 编码器 - 解码器连接:Nested UNet 的核心在于多层次的连接。通过在解码器中引入“skip connection blocks”,将编码器的输出与解码器的输入相结合,形成一个密集的连接网络,从而实现特征的深度融合。 训练与优化:训练 Nested UNet 时,需要选择合适的损失函数优化器。对于图像分割任务,常用的损失
内容概要:本文详细介绍了威纶通标准程序集锦,涵盖了多个常用功能模块,如XY曲线绘制、配方管理、权限设置、报警记录查询与操作、操作记录查询等。每个功能模块不仅提供了完整的代码示例,还附带了详细的解释优化建议。例如,XY曲线功能展示了如何进行坐标系转换并保持画面流畅;配方管理部分则强调了合理的寄存器规划数据保存方法;权限管理模块引入了MD5加密全局权限变量传递,确保系统的安全性灵活性;报警记录处理采用了类SQL查询方式,能够高效处理大量报警数据。此外,操作记录模块采用三层架构设计,便于审计项目验收文档生成。这套程序不仅功能全面,界面简洁,而且各个模块之间通过全局变量耦合,实现了松耦合结构,方便移植扩展。 适合人群:初学者、在校学生以及有一定经验的工程师。 使用场景及目标:① 初学者可以通过这套程序快速掌握威纶通触摸屏编程的基本技能;② 工程师可以在实际项目中直接引用或修改这些功能模块,提高开发效率;③ 学习权限管理数据处理的最佳实践,提升系统安全性。 阅读建议:建议读者仔细研读每个功能模块的代码实现及其背后的原理,尤其是权限管理报警记录处理部分,这对于理解设计复杂系统非常重要。同时,可以根据具体需求对代码进行适当调整优化。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值