0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

プロデル、調査 その10

Posted at

概要

プロデルが、CLRらしいので、調べて見た。
練習問題やってみた。

練習問題

mp3を再生せよ。

写真

image.png

サンプルコード

※コンソール

"System.Windows.Application,PresentationFramework"のネット型を作ってappとする
"System.Windows.Window,PresentationFramework"のネット型を作ってメイン画面とする
"System.Windows.Controls.Canvas,PresentationFramework"のネット型を作ってcanvasとする
	メイン画面のTitleは、「プロデルでWPFを使ったメディアプレーヤー」
	メイン画面のWidth=500
	メイン画面のHeight=500
	メイン画面のContentは、canvas
	メイン画面のClosed時の手順は、メイン画面を閉じた
"System.Windows.Controls.Button,PresentationFramework"のネット型を作って再生ボタンとする
	再生ボタンのContent=「再生」
	再生ボタンのWidth=150
	再生ボタンのHeight=50
	再生ボタンのClick時の手順は、再生ボタンをクリックした
	canvasのChildren:Add(再生ボタン)
"System.Windows.Controls.Button,PresentationFramework"のネット型を作って停止ボタンとする
	停止ボタンのContent=「一時停止」
	停止ボタンのWidth=150
	停止ボタンのHeight=50
	canvas:SetLeft(停止ボタン, 200)
	停止ボタンのClick時の手順は、停止ボタンをクリックした
	canvasのChildren:Add(停止ボタン)
"System.Windows.Controls.Slider,PresentationFramework"のネット型を作ってポジションスライダとする
	ポジションスライダのWidth=350
	ポジションスライダのHeight=100
	canvas:SetLeft(ポジションスライダ, 0)
	canvas:SetTop(ポジションスライダ, 50)
	ポジションスライダのValueChanged時の手順は、スライドした
	canvasのChildren:Add(ポジションスライダ)
	メディア要素という"System.Windows.Controls.MediaElement,PresentationFramework"のネット型を作る
	メディア要素のLoadedBehavior=「Manual」
	メディア要素のWidth=400
	メディア要素のHeight=400
	メディア要素のMediaOpened時の手順は、読み込んだ
	canvas:SetLeft(メディア要素, 0)
	canvas:SetTop(メディア要素, 100)
	canvasのChildren:Add(メディア要素)
	URLという"System.Uri,System"のネット型(「C:\Users\User\rdr\morita1.mp3」)を作る
	メイン画面:Show()
	app:Run(メイン画面)
	読み込んだ手順
		合計秒数は、メディア要素のNaturalDurationのTimeSpanの合計秒数
		ポジションスライダのMaximumは、合計秒数
	終わり
	再生ボタンをクリックした手順
		メディア要素のSource=URL
		メディア要素:Play()
	終わり
	停止ボタンをクリックした手順
		メディア要素:Pause()
	終わり
	スライドした手順
		値という日時期間形式(「0:00」)を作る
		値へ(この時のNewValue)秒足す
		メディア要素のPositionは、値
	終わり
	メイン画面を閉じた手順
		メディア要素:Stop()
		終了する
	終わり





以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?