SlideShare a Scribd company logo
1 of 12
紙芝居的な何かをアレで作るよ!
          Ahf(小尾 智之)
自己紹介
VB と SQL Server を主軸にする何でも屋
インディー団体を含むプロレス全般と
 クマ(クマー含む)好き
  とりあえず DDT 見ればいいと思うよ!
Workflow Foundation ソムリエが目標
@IT エンジニアライフで色々書いてます
事の発端
以前 Twitter 上で Workflow Foundation について
話しているとこんなレスが




        この人にこう言われてはやるしかないだろJK
WF をベースとしたアプリ
実際試してみると WF だからという理由で
 困る事はほとんどない
 むしろ紙芝居的なものであれば非常に楽
 某ツクール関係のように一般人が作るには
  適しているかも
困るのは WPF の部分
 WPF に明るくないのが一番の問題(!)
 キー入力とか画面制御とか音楽制御とか
 XAML で楽に書けるものをコードでやる辛さ
 アニメーションとかやろうとすると…
割り切った
細かい事をやろうとせずに大雑把な制御を
 WF で行う事にする
画像の表示
 フェードインとフェードアウト
文字の表示
 一文字ずつ表示させてそれっぽく
音楽
 鳴らすのと止めるだけ
アクティビティからの制御
極論するとウインドゥ等の
 FrameworkElement なインスタンスが
 あればどうにか操作可能
ただし WPF はコードから全てを制御する
 のが不可能なので「ある程度」で割り切る
  .NET 4.5 でもうすこし領域が増えるらしい
問題となるのはインスタンスの制御
  ワークフローが終了しても
   強制的にはインスタンス解放をしない
  インスタンスを終了させるアクティビティや
   仕組みが必須
ウインドゥの制御
Public Class WPFWindowActivity
  Inherits CodeActivity

  Public Property Window As InArgument(Of Window)
  Public Property SetTopMost As InArgument(Of Boolean) = True
  Public Property SetFullScreen As InArgument(Of Boolean) = False

  Protected Overrides Sub Execute(context As CodeActivityContext)

     Dim target = context.GetValue(Me.Window)
     target.Topmost = context.GetValue(Me.SetTopMost)
     If context.GetValue(Me.SetFullScreen) Then
         target.WindowStyle = WindowStyle.None
         target.WindowState = WindowState.Maximized
     End If
     target.Show()
                                              あらかじめ
  End Sub
End Class
                                        「用意されたウインドゥを表示」する


                          単に表示するだけならこの程度なので非常に簡単
テキスト表示
Dim displayObject As TextBlock = Nothing
If target.Dispatcher.CheckAccess Then
    displayObject = TryCast(target.FindName(contentName), TextBlock)
Else
    Dim result = target.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Input,
                                Function() target.FindName(contentName))
    If result IsNot Nothing Then displayObject = TryCast(result, TextBlock)
End If
If displayObject Is Nothing Then Return
‘1文字ずつ表示
Dim dispText As New Text.StringBuilder
For Each mesChar In message.ToCharArray
    If displayObject.Dispatcher.CheckAccess Then
        displayObject.Inlines.InsertAfter(displayObject.Inlines.FirstInline,
                                          New Run() With {.Text = mesChar})
    Else
        Dim result = displayObject.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background,
                                   New Action(Sub() displayObject.Text = dispText.ToString))
    End If
    DispatcherHelper.DoEvents()
    System.Threading.Thread.Sleep(delayTime)
    dispText.Append(mesChar)
Next
                                                          意外に多くのロジックが必要
'最後の文字を表示
If displayObject.Dispatcher.CheckAccess Then
   displayObject.Text = dispText.ToString
Else
   Dim result = displayObject.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background,
                             New Action(Sub() displayObject.Text = dispText.ToString))
End If
DispathcerHelper.DoEvents()
フェードインなどのエフェクト
Public Property DelayTime As InArgument(Of Integer) = 5
Public Property StartValue As InArgument(Of Double) = 0
Public Property EndValue As InArgument(Of Double) = 1
-------------------------------------------(省略)-----------------------------------------------------
Dim fadeinAnime As New DoubleAnimation With {
   .From = sValue, .To = eValue,
   .Duration = New Duration(TimeSpan.FromSeconds(delay))
}

Dim fadeinStoryboard As New Storyboard
fadeinStoryboard.Children.Add(fadeinAnime)
Storyboard.SetTargetName(fadeinAnime, contentName)
Storyboard.SetTargetProperty(fadeinAnime, New PropertyPath(UIElement.OpacityProperty))
AddHandler fadeinStoryboard.Completed, AddressOf StateInvalidated
fadeinStoryboard.Begin(displayObject)

Do Until _commitAnime                                   エフェクトを行おうとすると
   DispatcherHelper.DoEvents()                          多くのロジックが必要になる
Loop
-------------------------------------------(省略)-----------------------------------------------------
Private _commitAnime As Boolean = False
Private Sub StateInvalidated(ByVal sender As Object, ByVal e As EventArgs)
   _commitAnime = True
End Sub
フェードインを XAML で書くと…
  <EventTrigger >
   <BeginStoryboard>
    <Storyboard >
      <DoubleAnimation
       Storyboard.TargetName="imageview“
       Storyboard.TargetProperty="Opacity"
       FillBehavior="HoldEnd“
       From="0" To="1"
       Duration="0:0:5" />
    </Storyboard>
   </BeginStoryboard>
  </EventTrigger>




        XAML で書くとこれぐらいスッキリ記述ができる…
        ただし XAML 上では特定のイベントなどにあらかじめ
        関連付けておく必要がある
ワークフローに設定
アクティビティを用意できれば
 後はワークフロー上で実装するだけ




                ここまで来ると
                やることは簡単
やってみての感想
紙芝居的なものを WF で表現するのは
 見た目に分かりやすく非常に作りやすい
 アクティビティさえ用意できれば!
リアルタイム性を求めるのは全く向かない
 不可能ではないと思う…
同じ思想でゲームだけではなく
 業務アプリも実装可能
 逆にそっちの方が向いているかも
 俗にいう「変更に強い」「保守性の高い」
  アプリと言える……かも知れない

More Related Content

What's hot

FxUG in Toyama - ASphalt2 container -
FxUG in Toyama - ASphalt2 container -FxUG in Toyama - ASphalt2 container -
FxUG in Toyama - ASphalt2 container -Akio Katayama
 
Perlで伝統芸能
Perlで伝統芸能Perlで伝統芸能
Perlで伝統芸能hitode909
 
for JSDeferred Code Reading
for JSDeferred Code Readingfor JSDeferred Code Reading
for JSDeferred Code ReadingKenichirou Oyama
 
JavaScript/CSS 2015 Autumn
JavaScript/CSS 2015 AutumnJavaScript/CSS 2015 Autumn
JavaScript/CSS 2015 AutumnKoji Ishimoto
 
Perl 非同期プログラミング
Perl 非同期プログラミングPerl 非同期プログラミング
Perl 非同期プログラミングlestrrat
 
Deep dive into oss written in swift
Deep dive into oss written in swiftDeep dive into oss written in swift
Deep dive into oss written in swiftYuki Asai
 
Elixirだ 第1回 - 基礎だ -
Elixirだ 第1回 - 基礎だ -Elixirだ 第1回 - 基礎だ -
Elixirだ 第1回 - 基礎だ -Joe_noh
 
SQLマッピングフレームワーク「Kobati」のはなし
SQLマッピングフレームワーク「Kobati」のはなしSQLマッピングフレームワーク「Kobati」のはなし
SQLマッピングフレームワーク「Kobati」のはなしKazuki Minamitani
 
Elixirだ 第2回
Elixirだ 第2回Elixirだ 第2回
Elixirだ 第2回Joe_noh
 
PHP5.5新機能「ジェネレータ」初心者入門
PHP5.5新機能「ジェネレータ」初心者入門PHP5.5新機能「ジェネレータ」初心者入門
PHP5.5新機能「ジェネレータ」初心者入門kwatch
 
詳説ぺちぺち
詳説ぺちぺち詳説ぺちぺち
詳説ぺちぺちdo_aki
 
Using SockJS(Websocket) with Sencha Ext JS
Using SockJS(Websocket) with Sencha Ext JSUsing SockJS(Websocket) with Sencha Ext JS
Using SockJS(Websocket) with Sencha Ext JSKazuhiro Kotsutsumi
 
日本 GNU AWK ユーザー会チラシ - OSC2012 Tokyo/Fall
日本 GNU AWK ユーザー会チラシ - OSC2012 Tokyo/Fall日本 GNU AWK ユーザー会チラシ - OSC2012 Tokyo/Fall
日本 GNU AWK ユーザー会チラシ - OSC2012 Tokyo/Fall博文 斉藤
 
PHPBLT#6 PHPの未来に入るかもしれない機能の紹介
PHPBLT#6 PHPの未来に入るかもしれない機能の紹介PHPBLT#6 PHPの未来に入るかもしれない機能の紹介
PHPBLT#6 PHPの未来に入るかもしれない機能の紹介sters
 
サーバレスモードRTMFP
サーバレスモードRTMFPサーバレスモードRTMFP
サーバレスモードRTMFPitoz itoz
 

What's hot (20)

NanoStrand
NanoStrandNanoStrand
NanoStrand
 
FxUG in Toyama - ASphalt2 container -
FxUG in Toyama - ASphalt2 container -FxUG in Toyama - ASphalt2 container -
FxUG in Toyama - ASphalt2 container -
 
Mock and patch
Mock and patchMock and patch
Mock and patch
 
Em synchrony について
Em synchrony についてEm synchrony について
Em synchrony について
 
Perl勉強会#2資料
Perl勉強会#2資料Perl勉強会#2資料
Perl勉強会#2資料
 
Perlで伝統芸能
Perlで伝統芸能Perlで伝統芸能
Perlで伝統芸能
 
for JSDeferred Code Reading
for JSDeferred Code Readingfor JSDeferred Code Reading
for JSDeferred Code Reading
 
JavaScript/CSS 2015 Autumn
JavaScript/CSS 2015 AutumnJavaScript/CSS 2015 Autumn
JavaScript/CSS 2015 Autumn
 
Perl 非同期プログラミング
Perl 非同期プログラミングPerl 非同期プログラミング
Perl 非同期プログラミング
 
Deep dive into oss written in swift
Deep dive into oss written in swiftDeep dive into oss written in swift
Deep dive into oss written in swift
 
Php s2
Php s2Php s2
Php s2
 
Elixirだ 第1回 - 基礎だ -
Elixirだ 第1回 - 基礎だ -Elixirだ 第1回 - 基礎だ -
Elixirだ 第1回 - 基礎だ -
 
SQLマッピングフレームワーク「Kobati」のはなし
SQLマッピングフレームワーク「Kobati」のはなしSQLマッピングフレームワーク「Kobati」のはなし
SQLマッピングフレームワーク「Kobati」のはなし
 
Elixirだ 第2回
Elixirだ 第2回Elixirだ 第2回
Elixirだ 第2回
 
PHP5.5新機能「ジェネレータ」初心者入門
PHP5.5新機能「ジェネレータ」初心者入門PHP5.5新機能「ジェネレータ」初心者入門
PHP5.5新機能「ジェネレータ」初心者入門
 
詳説ぺちぺち
詳説ぺちぺち詳説ぺちぺち
詳説ぺちぺち
 
Using SockJS(Websocket) with Sencha Ext JS
Using SockJS(Websocket) with Sencha Ext JSUsing SockJS(Websocket) with Sencha Ext JS
Using SockJS(Websocket) with Sencha Ext JS
 
日本 GNU AWK ユーザー会チラシ - OSC2012 Tokyo/Fall
日本 GNU AWK ユーザー会チラシ - OSC2012 Tokyo/Fall日本 GNU AWK ユーザー会チラシ - OSC2012 Tokyo/Fall
日本 GNU AWK ユーザー会チラシ - OSC2012 Tokyo/Fall
 
PHPBLT#6 PHPの未来に入るかもしれない機能の紹介
PHPBLT#6 PHPの未来に入るかもしれない機能の紹介PHPBLT#6 PHPの未来に入るかもしれない機能の紹介
PHPBLT#6 PHPの未来に入るかもしれない機能の紹介
 
サーバレスモードRTMFP
サーバレスモードRTMFPサーバレスモードRTMFP
サーバレスモードRTMFP
 

Similar to Lt 111119

GroovyなAndroidテスト #atest_hack
GroovyなAndroidテスト #atest_hackGroovyなAndroidテスト #atest_hack
GroovyなAndroidテスト #atest_hackTakahiro Yoshimura
 
node+socket.io+enchant.jsでチャットゲーを作る
node+socket.io+enchant.jsでチャットゲーを作るnode+socket.io+enchant.jsでチャットゲーを作る
node+socket.io+enchant.jsでチャットゲーを作るKiyoshi SATOH
 
goog.ui.Component のはぐれかた
goog.ui.Component のはぐれかたgoog.ui.Component のはぐれかた
goog.ui.Component のはぐれかたSoichi Takamura
 
TypeScript と Visual Studio Code
TypeScript と Visual Studio CodeTypeScript と Visual Studio Code
TypeScript と Visual Studio CodeAkira Inoue
 
Html5 Web Applications
Html5  Web ApplicationsHtml5  Web Applications
Html5 Web Applicationstotty jp
 
Javaセキュアコーディングセミナー東京第3回講義
Javaセキュアコーディングセミナー東京第3回講義Javaセキュアコーディングセミナー東京第3回講義
Javaセキュアコーディングセミナー東京第3回講義JPCERT Coordination Center
 
ASP.NETを利用したAJAX開発の応用
ASP.NETを利用したAJAX開発の応用ASP.NETを利用したAJAX開発の応用
ASP.NETを利用したAJAX開発の応用Sho Okada
 
Androidの通信周りのコーディングについて
Androidの通信周りのコーディングについてAndroidの通信周りのコーディングについて
Androidの通信周りのコーディングについてShoichi Takagi
 
ちょっと詳しくJavaScript 特別編【悪霊の神々】
ちょっと詳しくJavaScript 特別編【悪霊の神々】ちょっと詳しくJavaScript 特別編【悪霊の神々】
ちょっと詳しくJavaScript 特別編【悪霊の神々】株式会社ランチェスター
 
ぱっと見でわかるC++11
ぱっと見でわかるC++11ぱっと見でわかるC++11
ぱっと見でわかるC++11えぴ 福田
 
Xtend30分クッキング やきに駆動
Xtend30分クッキング   やきに駆動Xtend30分クッキング   やきに駆動
Xtend30分クッキング やきに駆動Shinichi Kozake
 
TypeScript 1.0 オーバービュー
TypeScript 1.0 オーバービューTypeScript 1.0 オーバービュー
TypeScript 1.0 オーバービューAkira Inoue
 
Effective BDD Testing 効果的なBDDテスト [iOS]
Effective BDD Testing 効果的なBDDテスト [iOS]Effective BDD Testing 効果的なBDDテスト [iOS]
Effective BDD Testing 効果的なBDDテスト [iOS]Derek Lee Boire
 
AWS SDK for Haskell開発
AWS SDK for Haskell開発AWS SDK for Haskell開発
AWS SDK for Haskell開発Nomura Yusuke
 
Knocked out in knockout js
Knocked out in knockout jsKnocked out in knockout js
Knocked out in knockout jsHiroyuki Tashima
 

Similar to Lt 111119 (20)

GroovyなAndroidテスト #atest_hack
GroovyなAndroidテスト #atest_hackGroovyなAndroidテスト #atest_hack
GroovyなAndroidテスト #atest_hack
 
Lt 111217
Lt 111217Lt 111217
Lt 111217
 
node+socket.io+enchant.jsでチャットゲーを作る
node+socket.io+enchant.jsでチャットゲーを作るnode+socket.io+enchant.jsでチャットゲーを作る
node+socket.io+enchant.jsでチャットゲーを作る
 
Pronama 0707 wf4
Pronama 0707 wf4Pronama 0707 wf4
Pronama 0707 wf4
 
goog.ui.Component のはぐれかた
goog.ui.Component のはぐれかたgoog.ui.Component のはぐれかた
goog.ui.Component のはぐれかた
 
TypeScript と Visual Studio Code
TypeScript と Visual Studio CodeTypeScript と Visual Studio Code
TypeScript と Visual Studio Code
 
Html5 Web Applications
Html5  Web ApplicationsHtml5  Web Applications
Html5 Web Applications
 
Javaセキュアコーディングセミナー東京第3回講義
Javaセキュアコーディングセミナー東京第3回講義Javaセキュアコーディングセミナー東京第3回講義
Javaセキュアコーディングセミナー東京第3回講義
 
ASP.NETを利用したAJAX開発の応用
ASP.NETを利用したAJAX開発の応用ASP.NETを利用したAJAX開発の応用
ASP.NETを利用したAJAX開発の応用
 
Androidの通信周りのコーディングについて
Androidの通信周りのコーディングについてAndroidの通信周りのコーディングについて
Androidの通信周りのコーディングについて
 
ちょっと詳しくJavaScript 特別編【悪霊の神々】
ちょっと詳しくJavaScript 特別編【悪霊の神々】ちょっと詳しくJavaScript 特別編【悪霊の神々】
ちょっと詳しくJavaScript 特別編【悪霊の神々】
 
OSC京都2011
OSC京都2011OSC京都2011
OSC京都2011
 
CLRH_120414_WFTDD
CLRH_120414_WFTDDCLRH_120414_WFTDD
CLRH_120414_WFTDD
 
ぱっと見でわかるC++11
ぱっと見でわかるC++11ぱっと見でわかるC++11
ぱっと見でわかるC++11
 
Xtend30分クッキング やきに駆動
Xtend30分クッキング   やきに駆動Xtend30分クッキング   やきに駆動
Xtend30分クッキング やきに駆動
 
TypeScript 1.0 オーバービュー
TypeScript 1.0 オーバービューTypeScript 1.0 オーバービュー
TypeScript 1.0 オーバービュー
 
Effective BDD Testing 効果的なBDDテスト [iOS]
Effective BDD Testing 効果的なBDDテスト [iOS]Effective BDD Testing 効果的なBDDテスト [iOS]
Effective BDD Testing 効果的なBDDテスト [iOS]
 
Ss upload
Ss uploadSs upload
Ss upload
 
AWS SDK for Haskell開発
AWS SDK for Haskell開発AWS SDK for Haskell開発
AWS SDK for Haskell開発
 
Knocked out in knockout js
Knocked out in knockout jsKnocked out in knockout js
Knocked out in knockout js
 

More from Tomoyuki Obi

それは本当にAutomate? 改めて考えるPower Automate
それは本当にAutomate? 改めて考えるPower Automateそれは本当にAutomate? 改めて考えるPower Automate
それは本当にAutomate? 改めて考えるPower AutomateTomoyuki Obi
 
Miniacs Power Automate
Miniacs Power AutomateMiniacs Power Automate
Miniacs Power AutomateTomoyuki Obi
 
Work Automate with Power Automate
Work Automate with Power AutomateWork Automate with Power Automate
Work Automate with Power AutomateTomoyuki Obi
 
JSON Value into Power Automate
JSON Value into Power AutomateJSON Value into Power Automate
JSON Value into Power AutomateTomoyuki Obi
 
CodelessDevelop using iPaas
CodelessDevelop using iPaasCodelessDevelop using iPaas
CodelessDevelop using iPaasTomoyuki Obi
 
20190727_DevelopUseiPaas
20190727_DevelopUseiPaas20190727_DevelopUseiPaas
20190727_DevelopUseiPaasTomoyuki Obi
 
Logic Apps/Flow Update Summary
Logic Apps/Flow Update SummaryLogic Apps/Flow Update Summary
Logic Apps/Flow Update SummaryTomoyuki Obi
 
decode2019_HandsOn_Flow_04
decode2019_HandsOn_Flow_04decode2019_HandsOn_Flow_04
decode2019_HandsOn_Flow_04Tomoyuki Obi
 
decode2019_HandsOn_Flow_03
decode2019_HandsOn_Flow_03decode2019_HandsOn_Flow_03
decode2019_HandsOn_Flow_03Tomoyuki Obi
 
decode2019_HandsOn_Flow_02
decode2019_HandsOn_Flow_02decode2019_HandsOn_Flow_02
decode2019_HandsOn_Flow_02Tomoyuki Obi
 
decode2019_HandsOn_Flow_01
decode2019_HandsOn_Flow_01decode2019_HandsOn_Flow_01
decode2019_HandsOn_Flow_01Tomoyuki Obi
 
20190427 global azurebootcamp
20190427 global azurebootcamp20190427 global azurebootcamp
20190427 global azurebootcampTomoyuki Obi
 
20181215 PowerApps + Flow Handson
20181215 PowerApps + Flow Handson20181215 PowerApps + Flow Handson
20181215 PowerApps + Flow HandsonTomoyuki Obi
 
20181120 HowtoFlow
20181120 HowtoFlow20181120 HowtoFlow
20181120 HowtoFlowTomoyuki Obi
 
20180929 lowcode developlogicflow
20180929 lowcode developlogicflow20180929 lowcode developlogicflow
20180929 lowcode developlogicflowTomoyuki Obi
 
20180721 First Challenge Logicflow
20180721 First Challenge Logicflow20180721 First Challenge Logicflow
20180721 First Challenge LogicflowTomoyuki Obi
 
20180630 data transformationusinglogicflow
20180630 data transformationusinglogicflow20180630 data transformationusinglogicflow
20180630 data transformationusinglogicflowTomoyuki Obi
 
Create Bot using LogicApps
Create Bot using LogicAppsCreate Bot using LogicApps
Create Bot using LogicAppsTomoyuki Obi
 

More from Tomoyuki Obi (20)

それは本当にAutomate? 改めて考えるPower Automate
それは本当にAutomate? 改めて考えるPower Automateそれは本当にAutomate? 改めて考えるPower Automate
それは本当にAutomate? 改めて考えるPower Automate
 
Only Logic Apps
Only Logic AppsOnly Logic Apps
Only Logic Apps
 
This is iPaas
This is iPaasThis is iPaas
This is iPaas
 
Miniacs Power Automate
Miniacs Power AutomateMiniacs Power Automate
Miniacs Power Automate
 
Work Automate with Power Automate
Work Automate with Power AutomateWork Automate with Power Automate
Work Automate with Power Automate
 
JSON Value into Power Automate
JSON Value into Power AutomateJSON Value into Power Automate
JSON Value into Power Automate
 
CodelessDevelop using iPaas
CodelessDevelop using iPaasCodelessDevelop using iPaas
CodelessDevelop using iPaas
 
20190727_DevelopUseiPaas
20190727_DevelopUseiPaas20190727_DevelopUseiPaas
20190727_DevelopUseiPaas
 
Logic Apps/Flow Update Summary
Logic Apps/Flow Update SummaryLogic Apps/Flow Update Summary
Logic Apps/Flow Update Summary
 
decode2019_HandsOn_Flow_04
decode2019_HandsOn_Flow_04decode2019_HandsOn_Flow_04
decode2019_HandsOn_Flow_04
 
decode2019_HandsOn_Flow_03
decode2019_HandsOn_Flow_03decode2019_HandsOn_Flow_03
decode2019_HandsOn_Flow_03
 
decode2019_HandsOn_Flow_02
decode2019_HandsOn_Flow_02decode2019_HandsOn_Flow_02
decode2019_HandsOn_Flow_02
 
decode2019_HandsOn_Flow_01
decode2019_HandsOn_Flow_01decode2019_HandsOn_Flow_01
decode2019_HandsOn_Flow_01
 
20190427 global azurebootcamp
20190427 global azurebootcamp20190427 global azurebootcamp
20190427 global azurebootcamp
 
20181215 PowerApps + Flow Handson
20181215 PowerApps + Flow Handson20181215 PowerApps + Flow Handson
20181215 PowerApps + Flow Handson
 
20181120 HowtoFlow
20181120 HowtoFlow20181120 HowtoFlow
20181120 HowtoFlow
 
20180929 lowcode developlogicflow
20180929 lowcode developlogicflow20180929 lowcode developlogicflow
20180929 lowcode developlogicflow
 
20180721 First Challenge Logicflow
20180721 First Challenge Logicflow20180721 First Challenge Logicflow
20180721 First Challenge Logicflow
 
20180630 data transformationusinglogicflow
20180630 data transformationusinglogicflow20180630 data transformationusinglogicflow
20180630 data transformationusinglogicflow
 
Create Bot using LogicApps
Create Bot using LogicAppsCreate Bot using LogicApps
Create Bot using LogicApps
 

Recently uploaded

論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Danieldanielhu54
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)Hiroki Ichikura
 

Recently uploaded (10)

論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
 

Lt 111119

  • 2. 自己紹介 VB と SQL Server を主軸にする何でも屋 インディー団体を含むプロレス全般と クマ(クマー含む)好き  とりあえず DDT 見ればいいと思うよ! Workflow Foundation ソムリエが目標 @IT エンジニアライフで色々書いてます
  • 3. 事の発端 以前 Twitter 上で Workflow Foundation について 話しているとこんなレスが この人にこう言われてはやるしかないだろJK
  • 4. WF をベースとしたアプリ 実際試してみると WF だからという理由で 困る事はほとんどない  むしろ紙芝居的なものであれば非常に楽  某ツクール関係のように一般人が作るには 適しているかも 困るのは WPF の部分  WPF に明るくないのが一番の問題(!)  キー入力とか画面制御とか音楽制御とか  XAML で楽に書けるものをコードでやる辛さ  アニメーションとかやろうとすると…
  • 5. 割り切った 細かい事をやろうとせずに大雑把な制御を WF で行う事にする 画像の表示  フェードインとフェードアウト 文字の表示  一文字ずつ表示させてそれっぽく 音楽  鳴らすのと止めるだけ
  • 6. アクティビティからの制御 極論するとウインドゥ等の FrameworkElement なインスタンスが あればどうにか操作可能 ただし WPF はコードから全てを制御する のが不可能なので「ある程度」で割り切る  .NET 4.5 でもうすこし領域が増えるらしい 問題となるのはインスタンスの制御  ワークフローが終了しても 強制的にはインスタンス解放をしない  インスタンスを終了させるアクティビティや 仕組みが必須
  • 7. ウインドゥの制御 Public Class WPFWindowActivity Inherits CodeActivity Public Property Window As InArgument(Of Window) Public Property SetTopMost As InArgument(Of Boolean) = True Public Property SetFullScreen As InArgument(Of Boolean) = False Protected Overrides Sub Execute(context As CodeActivityContext) Dim target = context.GetValue(Me.Window) target.Topmost = context.GetValue(Me.SetTopMost) If context.GetValue(Me.SetFullScreen) Then target.WindowStyle = WindowStyle.None target.WindowState = WindowState.Maximized End If target.Show() あらかじめ End Sub End Class 「用意されたウインドゥを表示」する 単に表示するだけならこの程度なので非常に簡単
  • 8. テキスト表示 Dim displayObject As TextBlock = Nothing If target.Dispatcher.CheckAccess Then displayObject = TryCast(target.FindName(contentName), TextBlock) Else Dim result = target.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Input, Function() target.FindName(contentName)) If result IsNot Nothing Then displayObject = TryCast(result, TextBlock) End If If displayObject Is Nothing Then Return ‘1文字ずつ表示 Dim dispText As New Text.StringBuilder For Each mesChar In message.ToCharArray If displayObject.Dispatcher.CheckAccess Then displayObject.Inlines.InsertAfter(displayObject.Inlines.FirstInline, New Run() With {.Text = mesChar}) Else Dim result = displayObject.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, New Action(Sub() displayObject.Text = dispText.ToString)) End If DispatcherHelper.DoEvents() System.Threading.Thread.Sleep(delayTime) dispText.Append(mesChar) Next 意外に多くのロジックが必要 '最後の文字を表示 If displayObject.Dispatcher.CheckAccess Then displayObject.Text = dispText.ToString Else Dim result = displayObject.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, New Action(Sub() displayObject.Text = dispText.ToString)) End If DispathcerHelper.DoEvents()
  • 9. フェードインなどのエフェクト Public Property DelayTime As InArgument(Of Integer) = 5 Public Property StartValue As InArgument(Of Double) = 0 Public Property EndValue As InArgument(Of Double) = 1 -------------------------------------------(省略)----------------------------------------------------- Dim fadeinAnime As New DoubleAnimation With { .From = sValue, .To = eValue, .Duration = New Duration(TimeSpan.FromSeconds(delay)) } Dim fadeinStoryboard As New Storyboard fadeinStoryboard.Children.Add(fadeinAnime) Storyboard.SetTargetName(fadeinAnime, contentName) Storyboard.SetTargetProperty(fadeinAnime, New PropertyPath(UIElement.OpacityProperty)) AddHandler fadeinStoryboard.Completed, AddressOf StateInvalidated fadeinStoryboard.Begin(displayObject) Do Until _commitAnime エフェクトを行おうとすると DispatcherHelper.DoEvents() 多くのロジックが必要になる Loop -------------------------------------------(省略)----------------------------------------------------- Private _commitAnime As Boolean = False Private Sub StateInvalidated(ByVal sender As Object, ByVal e As EventArgs) _commitAnime = True End Sub
  • 10. フェードインを XAML で書くと… <EventTrigger > <BeginStoryboard> <Storyboard > <DoubleAnimation Storyboard.TargetName="imageview“ Storyboard.TargetProperty="Opacity" FillBehavior="HoldEnd“ From="0" To="1" Duration="0:0:5" /> </Storyboard> </BeginStoryboard> </EventTrigger> XAML で書くとこれぐらいスッキリ記述ができる… ただし XAML 上では特定のイベントなどにあらかじめ 関連付けておく必要がある
  • 12. やってみての感想 紙芝居的なものを WF で表現するのは 見た目に分かりやすく非常に作りやすい  アクティビティさえ用意できれば! リアルタイム性を求めるのは全く向かない  不可能ではないと思う… 同じ思想でゲームだけではなく 業務アプリも実装可能  逆にそっちの方が向いているかも  俗にいう「変更に強い」「保守性の高い」 アプリと言える……かも知れない