/InstantImageUploader/Infrastructures/Behaviors/Actions/CaptureAction.cs
C# | 51 lines | 41 code | 8 blank | 2 comment | 2 complexity | 0aa86a91b4a762a7275b0562e7393762 MD5 | raw file
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
-
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
-
- using System.Windows.Interactivity;
-
- using Livet.Messaging;
- using Livet.Behaviors.Messaging;
- using InstantImageUploader.Infrastructures.Messages;
- using System.Windows.Forms;
- using InstantImageUploader.Views;
-
-
- namespace InstantImageUploader.Infrastructures.Behaviors.Actions
- {
- public class CaptureAction : InteractionMessageAction<Window>
- {
- protected override void InvokeAction(Livet.Messaging.InteractionMessage m)
- {
- //このアクションが対応するメッセージに変換します。
- var captureMessage = m as CaptureRequestMessage;
-
- if (captureMessage != null)
- {
- //最大化されたキャプチャ用Window(コントロール扱いですよ!)を各ディスプレイに最大化して表示したいだけ。
- foreach (var screen in Screen.AllScreens)
- {
- var captureControl = new CaptureControl();
- captureControl.Left = screen.Bounds.Left + 100;//このプラス100がないと微妙に狂うのかなー。
- captureControl.Top = screen.Bounds.Top + 100;
-
- captureControl.Owner = AssociatedObject;
- captureControl.Show();
-
- captureControl.WindowState = System.Windows.WindowState.Maximized;//これはShowの後じゃないとダメなのは確認。
- }
- }
- }
- }
- }