首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> .NET 網頁程式設計 >> ASP.NET 基礎 >> 關於ASP.NET

使用 Silverlight 建構工作流設計器(二):類別設計與活動/規則關聯規則

     編輯:關於ASP.NET

Silverlight 類別對應策略

使用 UserControl(.xaml + .xaml.cs)代表具視覺介面的領域物件:Activity、Rule、Container。定位採用 Canvas.Left/Top 相對容器座標。

關聯規則

  • 一條規則關聯兩個不同活動:始端活動與終端活動。
  • 規則的始端與終端活動不可相同。
  • 任兩條規則的始端與終端活動組合不可完全相同(防重複連線)。

活動類別 XAML 定義

<UserControl x:Class="Shareidea.Web.UI.Control.Workflow.Designer.Activity"
 xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
 MouseLeftButtonDown="UserControl_MouseLeftButtonDown"
 MouseLeftButtonUp="UserControl_MouseLeftButtonUp"
 MouseMove="UserControl_MouseMove"
 MouseEnter="UserControl_MouseEnter"
 MouseLeave="UserControl_MouseLeave"
 Width="100" Height="60">
 <Canvas Name="container">
   <Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Fill="Green" />
   <Border CornerRadius="10" Background="Green" Opacity="0.9" Width="100" Height="60">
     <TextBox Name="Title" Text="新建活動" BorderBrush="Green" FontSize="12" Background="Green" Height="30" Width="60" MouseEnter="TextBox_MouseEnter" />
   </Border>
   <HyperlinkButton Name="btnDelete" Content="刪除活動" Foreground="Red" Background="Yellow" Width="65" Height="25" Canvas.Top="50" Canvas.Left="100" Click="HyperlinkButton_Click" />
 </Canvas>
</UserControl>
活動視覺外觀

後續將實作

  • 活動拖曳移動與邊界限制
  • 規則類別設計(直線/曲線、端點關聯邏輯)
  • 容器類別管理子元素與 Z-Index
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved