WF 4.0 ile Tasarım Kısmına Daha Derin Bir Bakış

Bir önceki yazımda gördüğünüz üzere, bu kadar basit bir workflow’da bile tüm diagramı görmek ne kadar zor durumlar alabiliyor. İyi ki, tasarım kısmı büyük workflow’larda çalışabilmemiz için bize bir çok özellik sağlıyor. Örneğin; tasarım kısmının sağ üst köşesindeki “Expand All” ve “Collapse All” seçenekleri ile bize görünüm anlamında çok büyük avantajlar sağlar. Collapse All seçeneği ile tüm ana aktiviteleri görmemize olanak verir. Expand All seçeneği ile de tüm aktiviteleri genişletir fakat bu durumda tüm diagramın bir kısmını görebiliriz.

Sağ alt köşedeki “Overview” seçeneğine tıklarsak, tüm diagramı küçük bir pencerede görebiliriz. Bu pencerenin içindeki sarı kutu, bize o anda diagramın içerisinde gösterilmek istenen alanı verir. Bu sarı kutuyu, hangi kısmı görmek istiyorsak o kısma sürükleyebiliriz.

WF-Designer

Şimdi Overview seçeneğini kapatıp hemen yanındaki “Fit to screen” özelliğine bakalım. Bu özellik bize tüm diagramı mümkün olduğunda küçültüp tasarım penceresine sığdırır. Monitör büyüklüğünüze bağlı olarak bu şekilde aktiviteleri okumak zorlaşabilir. Eğer zoom özelliğinin yanındaki büyüteç işaretine tıklarsak bu durumda diagram %100 haline gelip eski haline bu şekilde döndürebiliriz.

Şimdi biraz daha derinlere bakalım;

Solution Explorer kısmından “Workflow1.xaml” dosyamıza sağ tıklayıp “View Code” seçeneğine tıklayalım. Bu adımda bu dosyanın hala açık olduğunu, kapatmak isteyip istemediğinizi soran bir uyarı mesajı alacaksınız. Bu uyarıyı evet diyerek geçelim. Aşağıdaki şekilde .xaml doyamızın kod kısmını göreceğiz;


<Activity mc:Ignorable="sap" x:Class="WF_Temel_Elemanları_Eklemek.Workflow1" sap:VirtualizedContainerService.HintSize="526,1297" mva:VisualBasic.Settings="Assembly references and imported namespaces for internal implementation" xmlns="<a href="http://schemas.microsoft.com/netfx/2009/xaml/activities&quot;">http://schemas.microsoft.com/netfx/2009/xaml/activities"</a> xmlns:mc="<a href="http://schemas.openxmlformats.org/markup-compatibility/2006&quot;">http://schemas.openxmlformats.org/markup-compatibility/2006"</a> xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:s4="clr-namespace:System;assembly=System.ServiceModel" xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="<a href="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation&quot;">http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"</a> xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="<a href="http://schemas.microsoft.com/winfx/2006/xaml&quot;">http://schemas.microsoft.com/winfx/2006/xaml"</a>>
<Sequence sad:XamlDebuggerXmlReader.FileName="c:\users\soner\documents\visual studio 2010\Projects\WF-Temel Elemanları Eklemek\WF-Temel Elemanları Eklemek\Workflow1.xaml" sap:VirtualizedContainerService.HintSize="486,1257">
<Sequence.Variables>
<strong><Variable x:TypeArguments="x:Int32" Name="Counter" />
</strong>      <strong><Variable x:TypeArguments="x:Int32" Default="[DateAndTime.Now.Hour]" Name="NumberOfBells" /></strong>
</Sequence.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<WriteLine DisplayName="Merhaba" sap:VirtualizedContainerService.HintSize="464,59" />
<strong><If Condition="[NumberOfBells &gt; 12]" DisplayName="PM için ayarla" sap:VirtualizedContainerService.HintSize="464,201">
</strong>      <sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
<x:Boolean x:Key="IsPinned">False</x:Boolean>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<If.Then>
<Assign sap:VirtualizedContainerService.HintSize="291,100">
<Assign.To>
<OutArgument x:TypeArguments="x:Int32">[NumberOfBells]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Int32">[NumberOfBells - 12]</InArgument>
</Assign.Value>
</Assign>
</If.Then>
</If>
<strong><While DisplayName="Zil Çalınma Sayısı" sap:VirtualizedContainerService.HintSize="464,453">
</strong>      <sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
<x:Boolean x:Key="IsPinned">False</x:Boolean>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<strong><While.Condition>[Counter &lt;= NumberOfBells]</While.Condition>
</strong>      <strong><Sequence DisplayName="Zil Çalınma Sayısı" sap:VirtualizedContainerService.HintSize="438,342">
</strong>        <sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
<x:Boolean x:Key="IsPinned">False</x:Boolean>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<strong><WriteLine sap:VirtualizedContainerService.HintSize="242,59" Text="[Counter.ToString()]" /></strong>
<Assign sap:VirtualizedContainerService.HintSize="242,57">
<strong><Assign.To>
<OutArgument x:TypeArguments="x:Int32">[Counter]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Int32">[Counter + 1]</InArgument>
</Assign.Value>
</strong>        </Assign>
<strong><Delay Duration="[TimeSpan.FromSeconds(1)]" sap:VirtualizedContainerService.HintSize="242,22" />
</strong>      </Sequence>
</While>
<strong><WriteLine DisplayName="Zaman:" sap:VirtualizedContainerService.HintSize="464,59" Text="[&quot;Şu anki zaman: &quot; + DateTime.Now.ToString()]" /></strong>
<strong><If Condition="[DateTime.Now.Hour &gt;= 18]" DisplayName="Selamlama" sap:VirtualizedContainerService.HintSize="464,201">
</strong>      <If.Then>
<strong><WriteLine sap:VirtualizedContainerService.HintSize="219,100" Text="İyi Akşamlar" />
</strong>      </If.Then>
<If.Else>
<strong><WriteLine sap:VirtualizedContainerService.HintSize="220,100" Text="İyi Günler" /></strong>
</If.Else>
</If>
</Sequence>
</Activity>

Burada gördüğünüz üzere aktiviteleri bold olarak işaretledim. Ayrıca burdaki koda baktığımızda hiç çalıştırılabilir bir kod göremeyiz. Bu .xaml dosyası içerisinde sadece iç içe yuvarlanmış özellikler görüyoruz. Normalde Counter değişkeni için Counter = Counter + 1 şeklinde bir kod satırı görmeliydik. Bunun yerine elimizde bir Assign sınıfı ve bu sınıf içerisinde Counter ve Counter + 1 ifadeleri mevcut. Burada aslında Assign sınıfı içerisinde bu ifadeler çalıştırılır. Workflow tanımında herhangi bir ifade belirtmezler.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.