PageRenderTime 72ms CodeModel.GetById 37ms RepoModel.GetById 8ms app.codeStats 0ms

/InstantImageUploader/Infrastructures/Behaviors/Actions/CaptureAction.cs

https://bitbucket.org/ugaya40/instant-image-uploader
C# | 51 lines | 41 code | 8 blank | 2 comment | 2 complexity | 0aa86a91b4a762a7275b0562e7393762 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Navigation;
  13. using System.Windows.Shapes;
  14. using System.Windows.Interactivity;
  15. using Livet.Messaging;
  16. using Livet.Behaviors.Messaging;
  17. using InstantImageUploader.Infrastructures.Messages;
  18. using System.Windows.Forms;
  19. using InstantImageUploader.Views;
  20. namespace InstantImageUploader.Infrastructures.Behaviors.Actions
  21. {
  22. public class CaptureAction : InteractionMessageAction<Window>
  23. {
  24. protected override void InvokeAction(Livet.Messaging.InteractionMessage m)
  25. {
  26. //このアクションが対応するメッセージに変換します。
  27. var captureMessage = m as CaptureRequestMessage;
  28. if (captureMessage != null)
  29. {
  30. //最大化されたキャプチャ用Window(コントロール扱いですよ!)を各ディスプレイに最大化して表示したいだけ。
  31. foreach (var screen in Screen.AllScreens)
  32. {
  33. var captureControl = new CaptureControl();
  34. captureControl.Left = screen.Bounds.Left + 100;//このプラス100がないと微妙に狂うのかなー。
  35. captureControl.Top = screen.Bounds.Top + 100;
  36. captureControl.Owner = AssociatedObject;
  37. captureControl.Show();
  38. captureControl.WindowState = System.Windows.WindowState.Maximized;//これはShowの後じゃないとダメなのは確認。
  39. }
  40. }
  41. }
  42. }
  43. }