{"id":487,"date":"2019-09-13T16:52:09","date_gmt":"2019-09-13T07:52:09","guid":{"rendered":"http:\/\/marius.main.jp\/software\/blog\/?p=487"},"modified":"2020-03-25T17:57:18","modified_gmt":"2020-03-25T08:57:18","slug":"post-487","status":"publish","type":"post","link":"https:\/\/todosoft.net\/blog\/?p=487","title":{"rendered":"[Livet]\u975e\u30a2\u30af\u30c6\u30a3\u30d6\u6642\u306b\u304a\u3051\u308bWindowInteractionMessageAction\u306e\u6ce8\u610f\u70b9"},"content":{"rendered":"\n<p>Livet\u3092\u7528\u3044\u3066ViewModel\u304b\u3089View\u3092\u64cd\u4f5c\u3059\u308b\u70ba\u306b<br>WindowInteractionMessageAction\u3092\u7528\u3044\u308b\u969b\u3001<br>\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u307e\u307e\u3060\u3068Window\u304c\u975e\u30a2\u30af\u30c6\u30a3\u30d6\u306e\u72b6\u614b\u3067\u306f<br>\u6b63\u3057\u304f\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u9001\u4fe1\u3055\u308c\u306a\u3044\uff08\u5b9f\u884c\u3055\u308c\u306a\u3044\uff09\u3002<\/p>\n\n\n\n<p>\u4f8b\u3068\u3057\u3066\u3001<br>OnContentRendered\u2192\u6700\u5c0f\u5316\uff08\u975e\u30a2\u30af\u30c6\u30a3\u30d6\u5316\uff09\u21923\u79d2\u5f85\u3064\u2192\u6700\u5927\u5316 \u3092\u884c\u3046\u5834\u5408\u306f\u3001<br>\u4e0b\u8a18\u306e\u3088\u3046\u306b InvokeActionOnlyWhenWindowIsActive=&#8221;False&#8221; \u3092\u6307\u5b9a\u3059\u308b\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-csharp\"><code class=\"language-csharp\">&lt;!-- View.xaml -->\n&lt;Window x:Class=\"WpfApp11.View\"\n        xmlns=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\"\n        xmlns:x=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\"\n        xmlns:d=\"http:\/\/schemas.microsoft.com\/expression\/blend\/2008\"\n        xmlns:mc=\"http:\/\/schemas.openxmlformats.org\/markup-compatibility\/2006\"\n        xmlns:local=\"clr-namespace:WpfApp11\"\n        mc:Ignorable=\"d\"\n        xmlns:i=\"http:\/\/schemas.microsoft.com\/expression\/2010\/interactivity\"\n        xmlns:l=\"http:\/\/schemas.livet-mvvm.net\/2011\/wpf\"\n        Title=\"View\" Height=\"450\" Width=\"800\">\n\n    &lt;Window.DataContext>\n        &lt;local:ViewModel\/>\n    &lt;\/Window.DataContext>\n\n    &lt;i:Interaction.Triggers>\n        &lt;i:EventTrigger EventName =\"ContentRendered\">\n            &lt;l:LivetCallMethodAction MethodTarget=\"{Binding}\" MethodName=\"OnContentRendered\" \/>\n        &lt;\/i:EventTrigger>\n\n        &lt;l:InteractionMessageTrigger MessageKey=\"WindowAction\" Messenger=\"{Binding Messenger}\">\n            &lt;l:WindowInteractionMessageAction InvokeActionOnlyWhenWindowIsActive=\"False\" \/>\n        &lt;\/l:InteractionMessageTrigger>\n    &lt;\/i:Interaction.Triggers>\n\n    &lt;Grid>\n        \n    &lt;\/Grid>\n&lt;\/Window>\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-csharp\"><code class=\"language-csharp\">\/\/ ViewMode.cs\nusing Livet.Messaging.Windows;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace WpfApp11\n{\n    public class ViewModel : Livet.ViewModel\n    {\n\n        public void OnContentRendered()\n        {\n            Messenger.Raise(new WindowActionMessage(WindowAction.Minimize, \"WindowAction\"));\n\n            System.Threading.Thread.Sleep(3000);\n\n            Messenger.Raise(new WindowActionMessage(WindowAction.Normal, \"WindowAction\"));\n        }\n    }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Livet\u3092\u7528\u3044\u3066ViewModel\u304b\u3089View\u3092\u64cd\u4f5c\u3059\u308b\u70ba\u306bWindowInteractionMessageAction\u3092\u7528\u3044\u308b\u969b\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u307e\u307e\u3060\u3068Window\u304c\u975e\u30a2\u30af\u30c6\u30a3\u30d6\u306e\u72b6\u614b\u3067\u306f\u6b63\u3057\u304f\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u9001\u4fe1\u3055\u308c\u306a\u3044 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,20],"tags":[24,25,23],"class_list":["post-487","post","type-post","status-publish","format-standard","hentry","category-c","category-wpf","tag-livet","tag-windowinteractionmessageaction","tag-wpf"],"_links":{"self":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=487"}],"version-history":[{"count":4,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/487\/revisions"}],"predecessor-version":[{"id":713,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/487\/revisions\/713"}],"wp:attachment":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}