{"id":196960,"date":"2013-10-09T16:21:02","date_gmt":"2013-10-09T12:21:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=196960"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=196960","title":{"rendered":"<span class=\"post_title\">Commands in MVVM<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<ul>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 1 \u2013 \u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Command<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 2 \u2014 \u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Command \u0432 \u043f\u0430\u0440\u0435 \u0441 \u043b\u044f\u043c\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 3 \u2014 \u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Command \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 4 \u2013 \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 Command<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 5 \u2013 Command \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 6 \u2013 \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 Command<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 7 \u2014 \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 Command \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (UI)<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 8 \u2014 \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 Command \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043c\u0435\u043d\u044b<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 9 \u2013 \u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043a Command<\/li>\n<li> \u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2013 \u041a\u043b\u0430\u0441\u0441 Command<\/li>\n<li> \u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2013 \u041a\u043b\u0430\u0441\u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 Command<\/li>\n<li> \u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2013 \u041a\u043b\u0430\u0441\u0441 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0434\u044b\u043d\u043d\u044b\u0445 Command<\/li>\n<\/ul>\n<p>  <\/p>\n<h4>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d MVVM (Model View View-Model) \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 (Commands). <br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u043c\u043d\u043e\u044e \u0438\u043c\u0435\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b: WPF, SilverLight, Windows Phone. \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434 \u0432 \u043b\u044e\u0431\u043e\u043c MVVM \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043f\u043e\u0442\u043e\u043c \u0440\u0430\u0437\u0431\u043e\u0440 \u043f\u043e\u043b\u0435\u0442\u043e\u0432.<\/p>\n<p>  \u0412\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0447\u0430\u0441\u0442\u044c \u043c\u043e\u0435\u0439 MVVM \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Apex, \u043e\u0434\u043d\u0430\u043a\u043e \u0432\u0441\u0435 \u0447\u0430\u0441\u0442\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u043f\u043e\u043b\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043c\u0435, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0412\u0430\u043c \u043b\u0435\u0433\u043a\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0432 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0438\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 Apex \u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/35f\/a4d\/637\/35fa4d637b8b7e3dc88eef68f6140a7d.png\" alt=\"image\"\/>  <\/p>\n<h6>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 1: \u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 WPF<\/h6>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/a10\/496\/df7\/a10496df7f73acd8cbca405b90206e29.png\" alt=\"image\"\/>  <\/p>\n<h6>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 2: \u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 SilverLight<\/h6>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/6f5\/d56\/24f\/6f5d5624fb276ab08bdcf94d4e4d3073.png\" alt=\"image\"\/>  <\/p>\n<h6>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u04423: \u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 Windows Phone<\/h6>\n<p>  <\/p>\n<h5>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b?<\/h5>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. <\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e, \u0442\u043e \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:  <\/p>\n<ul>\n<li>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ICommand <\/li>\n<li>\u041e\u0431\u044b\u0447\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b \u0441 \u043a\u0430\u043a\u043e\u0439 \u043b\u0438\u0431\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <\/li>\n<li>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043a \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c \u2014 \u043a\u043e\u0434\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u2014 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f<\/li>\n<li>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0437\u043d\u0430\u044e\u0442, \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u043b\u0438 \u043e\u043d\u0438 \u0438\u043b\u0438 \u043d\u0435\u0442<\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u2013 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441 \u043d\u0435\u0439<\/li>\n<li>\u041d\u0430 \u0441\u043e\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u043b\u043e\u0433\u0438\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u0430 \u0441\/\u0431\u0435\u0437 \u043f\u043e\u043c\u043e\u0449\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u0434\u0440. <\/li>\n<\/ul>\n<p>  <\/p>\n<h5>\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/h5>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434. \u041a\u0430\u0436\u0434\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0434\u0430\u043b\u0435\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u043f\u0443\u043d\u043a\u0442\u0435.<\/p>\n<p>  <b>\u0412\u0430\u0436\u043d\u043e<\/b>: \u043a\u0430\u0436\u0434\u044b\u0439 View Model \u0432 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u044b\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 (observable collection) \u0441\u0442\u0440\u043e\u043a \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u00abMessages\u00bb \u2014 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. <\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0438\u0434\u0430 (View Model):<\/p>\n<pre><code class=\"cs\">public class MainViewModel : ViewModel {     public MainViewModel()     {     }      private ObservableCollection&lt;string&gt; messages = new ObservableCollection&lt;string&gt;();      public ObservableCollection&lt;string&gt; Messages     {       get { return messages; }     } } <\/code><\/pre>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0438\u0434\u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442 ViewModel&#8217;, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 INotifyPropertyChanged, \u043e\u0434\u043d\u0430\u043a\u043e \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0442\u0438\u043f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0438\u0434\u0430. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 1 \u2013 \u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Command<\/b><\/p>\n<div class=\"spoiler_text\"><b>\u0426\u0435\u043b\u044c<\/b>: \u0412\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0438\u0434\u0430 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. <\/p>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434. \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442 Command \u043a \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0438\u0434\u0430 \u2013 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:  <\/p>\n<pre><code class=\"cs\">public class MainViewModel : ViewModel {     public MainViewModel()     {       \/\/  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b - \u0432\u044b\u0437\u043e\u0432 DoSimpleCommand.       simpleCommand = new Command(DoSimpleCommand);     }      \/\/\/ &lt;summary&gt;     \/\/\/ The SimpleCommand function.     \/\/\/ &lt;\/summary&gt;     private void DoSimpleCommand()     {       \/\/  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435       Messages.Add(&quot;\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c 'DoSimpleCommand'.&quot;);     }      \/\/\/ &lt;summary&gt;     \/\/\/ \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b     \/\/\/ &lt;\/summary&gt;     private Command simpleCommand;      \/\/\/ &lt;summary&gt;     \/\/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b     \/\/\/ &lt;\/summary&gt;     public Command SimpleCommand     {       get { return simpleCommand; }     } } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u00abCommand&#8217;\u00bb \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0430(button).  <\/p>\n<pre><code class=\"xml\">&lt;Button Content=&quot;Simple Command&quot; Command=&quot;{Binding SimpleCommand}&quot; \/&gt; <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0435. \u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0434\u0435\u043b\u0430\u043d. \u041c\u044b \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 Command \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u041f\u0440\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430( \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u044f DoSimpleCommand).   <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 2 &#8212; \u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Command \u0432 \u043f\u0430\u0440\u0435 \u0441 \u043b\u044f\u043c\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438<\/b><\/p>\n<div class=\"spoiler_text\"><b>\u0426\u0435\u043b\u044c<\/b>: \u0412\u044b\u0437\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0438\u0434\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. <\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0443 \u043d\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u044f\u0432\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0438 \u0432\u0437\u0430\u043c\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043b\u044f\u043c\u0434\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0412\u043e \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u043d\u0443\u0430\u043b\u0430 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u0430\u043a \u0438 \u044f\u0432\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u0432 \u041f\u0440\u0438\u043c\u0435\u0440 1, \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044f\u043c\u0434\u044b, \u0447\u0442\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442 \u043a\u043e\u0434 \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u044b\u043c. \u0412\u044b\u0431\u043e\u0440 \u0437\u0430 \u0412\u0430\u043c\u0438.  <\/p>\n<pre><code class=\"cs\">public MainViewModel() {       \/\/  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u044f\u043c\u0434\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0430\u0434\u043e.       lambdaCommand = new Command(         () =&gt;         {           Messages.Add(&quot;\u0412\u044b\u0437\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u044f\u043c\u0434\u0430. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0430\u0434\u043e. &quot;);         }); }  \/\/\/ &lt;summary&gt; \/\/\/ The command object. \/\/\/ &lt;\/summary&gt; private Command lambdaCommand;  \/\/\/ &lt;summary&gt; \/\/\/ Gets the command. \/\/\/ &lt;\/summary&gt; public Command LambdaCommand {   get { return lambdaCommand; } } <\/code><\/pre>\n<p>  \u041e\u043f\u044f\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 Command \u043d\u0430\u0448\u0435\u0439 \u043a\u043d\u043e\u043f\u043a\u0438:  <\/p>\n<pre><code class=\"xml\">&lt;Button Content=&quot;Lambda Command&quot; Command=&quot;{Binding LambdaCommand}&quot; \/&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 3 &#8212; \u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Command \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438<\/b><\/p>\n<div class=\"spoiler_text\"><b>\u0426\u0435\u043b\u044c<\/b>: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u0435\u0439 \u043f\u0440\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 Command (\u0442\u0430\u043a \u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 AsynchronousCommand, \u0447\u0442\u043e \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0434\u043d\u0435\u0435). \u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0432 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.  <\/p>\n<pre><code class=\"cs\">public class MainViewModel : ViewModel {     public MainViewModel()     {       \/\/  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443       parameterizedCommand = new Command(DoParameterisedCommand);     }      \/\/\/ &lt;summary&gt;     \/\/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b     \/\/\/ &lt;\/summary&gt;     private void DoParameterisedCommand(object parameter)     {       Messages.Add(&quot;\u0412\u044b\u0437\u043e\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u2013 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440: '&quot; +                     parameter.ToString() + &quot;'.&quot;);     }      \/\/\/ &lt;summary&gt;     \/\/\/ The command object.     \/\/\/ &lt;\/summary&gt;     private Command parameterizedCommand;      \/\/\/ &lt;summary&gt;     \/\/\/ Gets the command.     \/\/\/ &lt;\/summary&gt;     public Command ParameterisedCommand     {       get { return parameterizedCommand; }     } } <\/code><\/pre>\n<p>  \u041f\u043e\u0432\u0442\u043e\u0440\u0438\u043c \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a \u043a\u043d\u043e\u043f\u043a\u0435 \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u043c\u0443 \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443. \u0422\u0430\u043a \u0436\u0435 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440:  <\/p>\n<pre><code class=\"xml\">&lt;Button Content=&quot;Parameterized Command&quot; Command=&quot;{Binding ParameterizedCommand}&quot; CommandParameter={Binding SomeObject} \/&gt; <\/code><\/pre>\n<p>  \u0412\u0435\u0437\u0434\u0435, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043d\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Action (\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432) \u0438\u043b\u0438 Action&lt;object&gt; (\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0442\u0438\u043f\u0430 object ). \u0422\u0430\u043a \u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044f\u043c\u0434\u044b:  <\/p>\n<pre><code class=\"cs\">\/\/  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043b\u044f\u043c\u0434\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 parameterizedCommand = new Command(   (parameter) =&gt;   {     Messages.Add(&quot;\u0412\u044b\u0437\u043e\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u2013 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440: '&quot; +                   parameter.ToString() + &quot;'.&quot;);   }); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 4 \u2013 \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 Command<\/b><\/p>\n<div class=\"spoiler_text\"><b>\u0426\u0435\u043b\u044c<\/b>: \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c\/\u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438\u0437 \u043a\u043e\u0434\u0430 \u0438\u043b\u0438 XAML<\/p>\n<p>  \u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e CanExecute, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0432 \u043d\u0435\u0433\u043e true \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0438 \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 false \u2014 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 \u043d\u0435\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438\u0441\u0447\u0435\u0437\u043d\u0435\u0442 \u0438 \u043a\u043d\u043e\u043f\u043a\u0430 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:  <\/p>\n<pre><code class=\"cs\">public class MainViewModel : ViewModel {     public MainViewModel()     {       \/\/  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u043e\u0439\/\u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b       enableDisableCommand = new Command(           () =&gt;           {             Messages.Add(&quot;\u0412\u043a\u043b\/\u041e\u0442\u043a\u043b \u043a\u043e\u043c\u0430\u043d\u0434\u044b.&quot;);           }, false);     }      private void DisableCommand()     {       \/\/  \u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b       EnableDisableCommand.CanExecute = false;     }      private void EnableCommand()     {       \/\/  \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b       EnableDisableCommand.CanExecute = true;     }          \/\/\/ &lt;summary&gt;     \/\/\/ The command object.     \/\/\/ &lt;\/summary&gt;     private Command enableDisableCommand;      \/\/\/ &lt;summary&gt;     \/\/\/ Gets the command.     \/\/\/ &lt;\/summary&gt;     public Command EnableDisableCommand     {       get { return enableDisableCommand; }     } } <\/code><\/pre>\n<p>  \u0414\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443 \u043a \u043a\u043d\u043e\u043f\u043a\u0435 (\u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443):  <\/p>\n<pre><code class=\"xml\">&lt;Button Content=&quot;Enable\/Disable Command&quot; Command=&quot;{Binding EnableDisableCommand}&quot; \/&gt; <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u044b CanExecute.<br \/>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 \u043a\u043e\u0434\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 CanExecute \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0410 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 (XAML) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 CheckBox:  <\/p>\n<pre><code class=\"xml\">&lt;CheckBox IsChecked=&quot;{Binding EnableDisableCommand.CanExecute, Mode=TwoWay}&quot; Content=&quot;Enabled&quot; \/&gt; <\/code><\/pre>\n<p>  \u0412\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e \u0433\u0434\u0435 \u0438 \u043a\u0430\u043a \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043a\u0430\u043a \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0431\u0443\u043b\u0435\u0432\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c CanExecute. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2013 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0432 false. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c true \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 5 \u2013 Command \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\"><b>\u0426\u0435\u043b\u044c<\/b>: \u0423\u0437\u043d\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0430\u0441\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u0438\u043b\u0438 \u043c\u043e\u043c\u0435\u043d\u0442 \u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0423 \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f: Executed \u2014 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430, \u0438 Executing \u2014 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0422\u0430\u043a \u0436\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 Executing \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<p>  <b>\u0412\u0430\u0436\u043d\u043e<\/b>: \u0411\u044b\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0412\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u043e\u043a\u043d\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c, \u0445\u043e\u0442\u0438\u0442\u0435 \u043b\u0438 \u0412\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u0418 \u0433\u0434\u0435 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434? \u0412 \u043a\u043e\u0434\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b? \u041f\u043b\u043e\u0445\u0430\u044f \u0438\u0434\u0435\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u0434 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430\u0441\u043e\u0440\u044f\u0435\u0442 \u043a\u043e\u0434, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u0443\u044e, \u0447\u0442\u043e \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0432\u0430\u0436\u043d\u0435\u0435 \u2014 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0435\u0433\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0434 \u0432 \u0412\u0438\u0434\u0435 (View). \u0418 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. <br \/>  \u0412\u0442\u043e\u0440\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u0438\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0444\u043e\u043a\u0443\u0441 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u0412\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0438\u0434\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430\u043c (\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f), \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0432\u0448\u0438\u0441\u044c \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0412\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445 \u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c.  <\/p>\n<pre><code class=\"cs\">public class MainViewModel : ViewModel {     public MainViewModel()     {       \/\/  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438       eventsCommand = new Command(           () =&gt;                  {                     Messages.Add(&quot;\u0412\u044b\u0437\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438.&quot;);                 });  <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0432\u044f\u0436\u0435\u043c \u043a \u043a\u043d\u043e\u043f\u043a\u0435:  <\/p>\n<pre><code class=\"xml\">&lt;Button Content=&quot;Events Command&quot; Command=&quot;{Binding EventsCommand}&quot; \/&gt; <\/code><\/pre>\n<p>  \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0442\u043b\u0438\u0447\u0438\u0439 \u043e\u0442 \u043a\u043e\u0434\u0430 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445. \u041f\u043e\u0434\u043f\u0438\u0448\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432\u043e View.<br \/>  \u0412\u0430\u0436\u043d\u043e: \u0432 \u043c\u043e\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438, DataContext \u0441 \u0438\u043c\u0435\u043d\u0435\u043c viewModel:  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ Interaction logic for MainWindow.xaml \/\/\/ &lt;\/summary&gt; public partial class MainWindow : Window {     public MainWindow()     {         InitializeComponent();          viewModel.EventsCommand.Executing +=            new Apex.MVVM.CancelCommandEventHandler(EventsCommand_Executing);         viewModel.EventsCommand.Executed +=            new Apex.MVVM.CommandEventHandler(EventsCommand_Executed);     }      void EventsCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)     {         viewModel.Messages.Add(&quot;\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430 \u0441\u0432\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u0413\u043e\u0432\u043e\u0440\u0438\u0442  View!&quot;);     }      void EventsCommand_Executing(object sender, Apex.MVVM.CancelCommandEventArgs args)     {         if (MessageBox.Show(&quot;\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443?&quot;,                   &quot;Cancel?&quot;,                   MessageBoxButton.YesNo) == MessageBoxResult.Yes)             args.Cancel = true;     } } <\/code><\/pre>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446 \u0442\u043e \u043c\u044b \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u043a \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u0432\u0441\u0435\u0439 \u043c\u043e\u0449\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434. \u0415\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f Executed \u0438 Executing \u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 (\u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c ViewModel, \u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0435), \u0430 \u0442\u0430\u043a \u0436\u0435 \u0437\u043d\u0430\u0435\u043c \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442. \u0421\u043e\u0431\u044b\u0442\u0438\u0435 Executing \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 CancelCommandEventArgs \u2014 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u00abCancel\u00bb. \u0415\u0441\u043b\u0438 \u0435\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 true \u2014 \u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f. \u041e\u0431\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 CommandEventArgs \u0438 CancelCommandEventArgs \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u2013 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440. \u042d\u0442\u043e \u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 Command(\u0435\u0441\u043b\u0438 \u043e\u043d \u0432\u043e\u043e\u0431\u0449\u0435 \u0435\u0441\u0442\u044c).  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 6 \u2013 \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 Command<\/b><\/p>\n<div class=\"spoiler_text\"><b>\u0426\u0435\u043b\u044c<\/b>: \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u043b\u0433\u043e, \u0442\u043e \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u0414\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0438\u0445 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e. <\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0444\u043e\u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0438 \u0442\u0430\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432:<br \/>   \u2014 \u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c ViewModel \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0435\u0439\u0441\u044f \u0432 \u043f\u043e\u0442\u043e\u043a\u0435? \u041c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u0435 \u043f\u0440\u0438\u0431\u0435\u0433\u0430\u044f \u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. <br \/>   \u2014 \u041a\u0430\u043a \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u0434\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0435 \u0432\u044b\u0437\u0432\u0430\u043b\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043f\u0440\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u0432\u043e\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441? <br \/>   \u2014 \u041a\u0430\u043a \u043d\u0435 \u0437\u0430\u043c\u0443\u0441\u043e\u0440\u0438\u0442\u044c View Model, \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043c\u0430\u043d\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445?<br \/>   \u2014 \u041a\u0430\u043a \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0441 WP \u0438 Silverlight, \u0435\u0441\u043b\u0438 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435?<\/p>\n<p>  \u041e\u0431\u044a\u0435\u043a\u0442 AsynchronousCommand \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u043d\u044e\u0430\u043d\u0441\u043e\u0432 \u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e. \u0417\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f:  <\/p>\n<pre><code class=\"cs\">public class MainViewModel : ViewModel {     public MainViewModel()     {       \/\/  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b       asyncCommand1 = new AsynchronousCommand(           () =&gt;           {             for (int i = 1; i &lt;= 10; i++)             {               \/\/  \u0414\u043e\u043a\u043b\u0430\u0434 \u043e \u0445\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u044b.               asyncCommand1.ReportProgress(() =&gt; { Messages.Add(i.ToString()); });                System.Threading.Thread.Sleep(200);             }           });     }          \/\/\/ &lt;summary&gt;     \/\/\/ The command object.     \/\/\/ &lt;\/summary&gt;     private AsynchronousCommand asyncCommand1;      \/\/\/ &lt;summary&gt;     \/\/\/ Gets the command.     \/\/\/ &lt;\/summary&gt;     public AsynchronousCommand AsyncCommand1     {       get { return asyncCommand1; }     } } <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 XAML:  <\/p>\n<pre><code class=\"xml\">&lt;Button Content=&quot;Asynchronous Command&quot; Command=&quot;{Binding AsyncCommand1}&quot; \/&gt; <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u044f\u043c\u0434\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u0438\u0437 \u043f\u0443\u043b\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 View Model (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430), \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 ReportProgress:  <\/p>\n<pre><code class=\"cs\">asyncCommand1.ReportProgress(() =&gt; { Messages.Add(i.ToString()); }); <\/code><\/pre>\n<p>  ReportProgress \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438.  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 7 &#8212; \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 Command \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (UI)<\/b><\/p>\n<div class=\"spoiler_text\"><b>\u0426\u0435\u043b\u044c<\/b>: \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0433\u043e. \u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0431\u0430\u0440. <\/p>\n<p>  \u0412 AsynchronousCommand \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u00abIsExecuting\u00bb. \u0415\u0441\u043b\u0438 \u043e\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0432 true \u2014 \u0437\u043d\u0430\u0447\u0438\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0422\u0430\u043a \u043a\u0430\u043a AsynchronousCommand \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 INotifyPropertyChanged, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c\u0441\u044f \u043a \u044d\u0442\u043e\u043c\u0443 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 \u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.   <\/p>\n<pre><code class=\"cs\">public class MainViewModel : ViewModel {     public MainViewModel()     {       \/\/  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b       asyncCommand2 = new AsynchronousCommand(           () =&gt;           {             for (char c = 'A'; c &lt;= 'Z'; c++)             {               \/\/  \u0421\u043e\u043e\u0431\u0449\u0430\u0442\u044c \u043e \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0435               asyncCommand2.ReportProgress(() =&gt; { Messages.Add(c.ToString()); });                System.Threading.Thread.Sleep(100);             }           });     }          \/\/\/ &lt;summary&gt;     \/\/\/ The command object.     \/\/\/ &lt;\/summary&gt;     private AsynchronousCommand asyncCommand2;      \/\/\/ &lt;summary&gt;     \/\/\/ Gets the command.     \/\/\/ &lt;\/summary&gt;     public AsynchronousCommand AsyncCommand2     {       get { return asyncCommand2; }     } } <\/code><\/pre>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0443 \u0441\u0432\u044f\u0436\u0435\u043c \u0441 \u043a\u043d\u043e\u043f\u043a\u043e\u0439. \u0410 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e IsExecuting \u043f\u0440\u0438\u0432\u044f\u0436\u0435\u043c \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, StackPanel, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e TextBlock \u0438 ProgressBar:  <\/p>\n<pre><code class=\"xml\">&lt;Button Content=&quot;Asynchronous Command&quot; Command=&quot;{Binding AsyncCommand2}&quot;          Visibility=&quot;{Binding AsyncCommand2.IsExecuting,            Converter={StaticResource BooleanToVisibilityConverter},            ConverterParameter=Invert}&quot; \/&gt;  &lt;StackPanel Visibility=&quot;{Binding AsyncCommand2.IsExecuting,           Converter={StaticResource BooleanToVisibilityConverter}}&quot;&gt;   &lt;TextBlock Text=&quot;The command is running!&quot; \/&gt;   &lt;ProgressBar Height=&quot;20&quot; Width=&quot;120&quot; IsIndeterminate=&quot;True&quot; \/&gt; &lt;\/StackPanel&gt; <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043a\u043d\u043e\u043f\u043a\u0430 \u0438\u0441\u0447\u0435\u0437\u0430\u0435\u0442, \u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u0434\u043f\u0438\u0441\u044c \u0438 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0431\u0430\u0440. \u0423\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u043c\u044b \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u043c \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443 \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 IsExecuting \u043a\u043e\u043c\u0430\u043d\u0434\u044b.  <\/p>\n<pre><code class=\"cs\">asyncCommand1.ReportProgress(() =&gt; { Messages.Add(i.ToString()); }); <\/code><\/pre>\n<p>  <b>\u041d\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0443<\/b>: \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 Invert \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 BooleanToVisilityConverter, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e BooleanToVisibilityConverter, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 Apex.Converters. \u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0448\u0442\u0443\u0447\u043a\u0430 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u0445.  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 8 &#8212; \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 Command \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u043c\u0435\u043d\u044b<\/b><\/p>\n<div class=\"spoiler_text\"><b>\u0426\u0435\u043b\u044c<\/b>: \u041f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0442\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/p>\n<p>  \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 AsynchronousCommand. \u041a\u0430\u0436\u0434\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 AsynchronousCommand \u0442\u0430\u043a \u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c CancelCommand. \u0418 \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u0430 \u043a UI \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u0432\u044b\u0437\u0432\u0430\u043d\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0434\u0430 \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e IsCancellationRequested \u043e\u0431\u044a\u0435\u043a\u0442\u0430 AsynchronousCommand \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 true (\u0443\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 INotifyPropertyChanged \u0438 \u0443 \u0412\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c\u0441\u044f \u043a \u043d\u0435\u043c\u0443). \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e CancelIfRequested, \u0438 \u0435\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u043e\u043d\u0430 \u0432\u0435\u0440\u043d\u0435\u0442 true, \u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f.  <\/p>\n<pre><code class=\"cs\">public class MainViewModel : ViewModel {     public MainViewModel()     {        \/\/  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438        cancellableAsyncCommand = new AsynchronousCommand(          () =&gt;             {              for(int i = 1; i &lt;= 100; i++)              {                \/\/  \u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c?                if(cancellableAsyncCommand.CancelIfRequested())                  return;                 \/\/  \u041f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0431\u0430\u0440.                cancellableAsyncCommand.ReportProgress( () =&gt; { Messages.Add(i.ToString()); } );                 System.Threading.Thread.Sleep(100);              }            });     }          \/\/\/ &lt;summary&gt;     \/\/\/ The command object.     \/\/\/ &lt;\/summary&gt;     private AsynchronousCommand cancellableAsyncCommand;      \/\/\/ &lt;summary&gt;     \/\/\/ Gets the command.     \/\/\/ &lt;\/summary&gt;     public AsynchronousCommand CancellableAsyncCommand     {       get { return cancellableAsyncCommand; }     } } <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0432\u044f\u0436\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043a \u043a\u043d\u043e\u043f\u043a\u0435, \u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e IsExecuting \u043a StackPanel:  <\/p>\n<pre><code class=\"xml\">&lt;Button Content=&quot;Cancellable Async Command&quot;      Command=&quot;{Binding CancellableAsyncCommand}&quot;      Visibility=&quot;{Binding CancellableAsyncCommand.IsExecuting,               Converter={StaticResource BooleanToVisibilityConverter},     ConverterParameter=Invert}&quot; \/&gt;  &lt;StackPanel Visibility=&quot;{Binding CancellableAsyncCommand.IsExecuting,        Converter={StaticResource BooleanToVisibilityConverter}}&quot;&gt;   &lt;TextBlock Margin=&quot;4&quot; Text=&quot;The command is running!&quot; \/&gt;   &lt;ProgressBar Margin=&quot;4&quot; Height=&quot;20&quot;       Width=&quot;120&quot; IsIndeterminate=&quot;True&quot; \/&gt;   &lt;Button Margin=&quot;4&quot; Content=&quot;Cancel&quot;        Command=&quot;{Binding CancellableAsyncCommand.CancelCommand}&quot; \/&gt; &lt;\/StackPanel&gt; <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 Cancel \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u042d\u0442\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c CancellableAsyncCommand.CancelCommand. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e CancelIfRequested, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. <\/p>\n<p>  <b>\u041d\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0443<\/b>: \u041f\u0440\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u0435 Executed \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0435 Cancelled, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u0435 \u0436\u0435 \u0441\u0430\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b.   <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 9 \u2013 \u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043a Command<\/b><\/p>\n<div class=\"spoiler_text\"><b>\u0426\u0435\u043b\u044c<\/b>: \u0412\u044b\u0437\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043f\u0440\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e Command, \u043d\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u044f EventBindings. \u041e\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 Apex.Commands. EventBindings \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 EventBindingCollection, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 EventBinding. \u041a\u0430\u0436\u0434\u044b\u0439 EventBinding \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: \u0438\u043c\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u0438\u043c\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c.   <\/p>\n<pre><code class=\"cs\">public class MainViewModel : ViewModel {     public MainViewModel()     {       \/\/  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e       EventBindingCommand = new Command(         () =&gt;         {           Messages.Add(&quot;\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u0437\u0432\u0430\u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c.&quot;);         });     }          \/\/\/ &lt;summary&gt;     \/\/\/ The command object.     \/\/\/ &lt;\/summary&gt;     private Command eventBindingCommand;      \/\/\/ &lt;summary&gt;     \/\/\/ Gets the command.     \/\/\/ &lt;\/summary&gt;     public Command EventBindingCommand     {       get { return eventBindingCommand; }     } } <\/code><\/pre>\n<p>  \u0421\u0432\u044f\u0437\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"xml\">&lt;Border Margin=&quot;20&quot; Background=&quot;Red&quot;&gt;    &lt;!\u2014\u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b  EventBindingCommand \u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044e  MouseLeftButtonDown. --&gt;   &lt;apexCommands:EventBindings.EventBindings&gt;      &lt;apexCommands:EventBindingCollection&gt;         &lt;apexCommands:EventBinding EventName=&quot;MouseLeftButtonDown&quot;              Command=&quot;{Binding EventBindingCommand}&quot; \/&gt;      &lt;\/apexCommands:EventBindingCollection&gt;   &lt;\/apexCommands:EventBindings.EventBindings&gt;      &lt;TextBlock VerticalAlignment=&quot;Center&quot;       HorizontalAlignment=&quot;Center&quot; Text=&quot;Left Click on Me&quot;       FontSize=&quot;16&quot; Foreground=&quot;White&quot; \/&gt;  &lt;\/Border&gt; <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 EventBindings \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u0435 \u043b\u044e\u0431\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u044e.  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2013 \u041a\u043b\u0430\u0441\u0441 Command<\/b><\/p>\n<div class=\"spoiler_text\">\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043b\u0430\u0441\u0441 Command, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 1-5.  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u041a\u043b\u0430\u0441\u0441 ViewModelCommand \u2013 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ICommand, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \/\/\/ &lt;\/summary&gt; public class Command : ICommand {     \/\/\/ &lt;summary&gt;     \/\/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 &lt;see cref=&quot;Command&quot;\/&gt;.     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;action&quot;&gt;\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435.&lt;\/param&gt;     \/\/\/ &lt;param name=&quot;canExecute&quot;&gt;\u0415\u0441\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0432&lt;c&gt;true&lt;\/c&gt; [can execute] (\u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e).&lt;\/param&gt;     public Command(Action action, bool canExecute = true)     {         \/\/  Set the action.         this.action = action;         this.canExecute = canExecute;     }      \/\/\/ &lt;summary&gt;     \/\/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 &lt;see cref=&quot;Command&quot;\/&gt; class.     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;parameterizedAction&quot;&gt;\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435.&lt;\/param&gt;     \/\/\/ &lt;param name=&quot;canExecute&quot;&gt; \u0415\u0441\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0432 &lt;c&gt;true&lt;\/c&gt; [can execute](\u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e).&lt;\/param&gt;     public Command(Action&lt;object&gt; parameterizedAction, bool canExecute = true)     {         \/\/  Set the action.         this.parameterizedAction = parameterizedAction;         this.canExecute = canExecute;     }  <\/code><\/pre>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0432\u0430 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432: Action, \u0438\u043b\u0438 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438: Action&lt;object&gt;, \u0433\u0434\u0435 object \u2014 \u0442\u0438\u043f.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u0434\u0430\u0435\u043c \u0444\u043b\u0430\u0433 canExecute, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u041f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0444\u043b\u0430\u0433\u0430 canExecute \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c canExecuteChanged.  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435(\u0438\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435) \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \/\/\/ &lt;\/summary&gt; protected Action action = null; protected Action&lt;object&gt; parameterizedAction = null;  \/\/\/ &lt;summary&gt; \/\/\/ \u0411\u0443\u0434\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0435 \u0437\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \/\/\/ &lt;\/summary&gt; private bool canExecute = false;  \/\/\/ &lt;summary&gt; \/\/\/ \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \/  \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u0437\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \/\/\/ &lt;\/summary&gt; \/\/\/ &lt;value&gt; \/\/\/     &lt;c&gt;true&lt;\/c&gt; \u0435\u0441\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e; \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u043e - &lt;c&gt;false&lt;\/c&gt;. \/\/\/ &lt;\/value&gt; public bool CanExecute {     get { return canExecute; }     set     {         if (canExecute != value)         {             canExecute = value;             EventHandler canExecuteChanged = CanExecuteChanged;             if (canExecuteChanged != null)                 canExecuteChanged(this, EventArgs.Empty);         }     } } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ICommand  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044e\u0449\u0438\u0439, \u0447\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \/\/\/ &lt;\/summary&gt; \/\/\/ &lt;param name=&quot;parameter&quot;&gt;\u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439. \/\/\/  \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \/\/\/  \u0442\u043e \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432  null.&lt;\/param&gt; \/\/\/ &lt;returns&gt; \/\/\/ &gt; \u0435\u0441\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e; \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u043e - false. \/\/\/ &lt;\/returns&gt; bool ICommand.CanExecute(object parameter) {     return canExecute; }  \/\/\/ &lt;summary&gt; \/\/\/ \u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u043f\u0440\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \/\/\/ &lt;\/summary&gt; \/\/\/ &lt;param name=&quot;parameter&quot;&gt; \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439. \/\/\/  \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \/\/\/  \u0442\u043e \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432  null.&lt;\/param&gt; void ICommand.Execute(object parameter) {     this.DoExecute(parameter);  } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044e DoExecute \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/  \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \/\/\/ &lt;\/summary&gt; public event EventHandler CanExecuteChanged;  \/\/\/ &lt;summary&gt; \/\/\/ \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \/\/\/ &lt;\/summary&gt; public event CancelCommandEventHandler Executing;  \/\/\/ &lt;summary&gt; \/\/\/ \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \/\/\/ &lt;\/summary&gt; public event CommandEventHandler Executed;  <\/code><\/pre>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e Invoke \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u0438\u0437 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432.  <\/p>\n<pre><code class=\"cs\">protected void InvokeAction(object param) {     Action theAction = action;     Action&lt;object&gt; theParameterizedAction = parameterizedAction;      if (theAction != null)         theAction();     else if (theParameterizedAction != null)         theParameterizedAction(param); }  protected void InvokeExecuted(CommandEventArgs args) {     CommandEventHandler executed = Executed;      \/\/  \u0412\u044b\u0437\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f     if (executed != null)         executed(this, args); }  protected void InvokeExecuting(CancelCommandEventArgs args) {     CancelCommandEventHandler executing = Executing;      \/\/  Call the executed event.     if (executing != null)         executing(this, args); }  <\/code><\/pre>\n<p>  <b>\u041d\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0443<\/b>: InvokeAction \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043b\u0438\u0431\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043b\u0438\u0431\u043e \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0441\u043c\u043e\u0442\u0440\u044f \u043a\u0430\u043a\u043e\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e.  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \/\/\/ &lt;\/summary&gt; \/\/\/ &lt;param name=&quot;param&quot;&gt;The param.&lt;\/param&gt; public virtual void DoExecute(object param) {     \/\/  \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u043c\u0435\u043d\u044b     CancelCommandEventArgs args =         new CancelCommandEventArgs() { Parameter = param, Cancel = false };     InvokeExecuting(args);      \/\/  \u0415\u0441\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0431\u044b\u043b\u043e \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u043e -  \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c.     if (args.Cancel)         return;      \/\/  \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \/ \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e. \u041a\u0430\u043a\u043e\u0435 \u0431\u044b\u043b\u043e \u0443\u0441\u0442\u0430\u043d\u0432\u043b\u0435\u043d\u043d\u043e.     InvokeAction(param);      \/\/  Call the executed function.     InvokeExecuted(new CommandEventArgs() { Parameter = param }); } <\/code><\/pre>\n<p>  DoExecute \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430. \u041f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0412\u044b\u0448\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ICommand \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0435\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439\u0441\u044f \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 1-5.  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2013 \u041a\u043b\u0430\u0441\u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 Command<\/b><\/p>\n<div class=\"spoiler_text\">\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 6-8 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441 AsynchronousCommand, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 Command, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435.<\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043a\u0430\u0441\u0441 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440:  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b -  \u044d\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u0438\u0445 \u043f\u0443\u043b\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432.. \/\/\/ &lt;\/summary&gt; public class AsynchronousCommand : Command, INotifyPropertyChanged {     \/\/\/ &lt;summary&gt;     \/\/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 &lt;see cref=&quot;AsynchronousCommand&quot;\/&gt;.     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;action&quot;&gt;\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435.&lt;\/param&gt;     \/\/\/ &lt;param name=&quot;canExecute&quot;&gt; \u0415\u0441\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0432      \/\/\/  &lt;c&gt;true&lt;\/c&gt; \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f.&lt;\/param&gt;     public AsynchronousCommand(Action action, bool canExecute = true)        : base(action, canExecute)     {        \/\/  \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b       Initialise();     }      \/\/\/ &lt;summary&gt;     \/\/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438&lt;see cref=&quot;AsynchronousCommand&quot;\/&gt;.     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;parameterizedAction&quot;&gt;\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435.&lt;\/param&gt;     \/\/\/ &lt;param name=&quot;canExecute&quot;&gt; \u0415\u0441\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0432 &lt;c&gt;true&lt;\/c&gt; [can execute] (\u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f).&lt;\/param&gt;     public AsynchronousCommand(Action&lt;object&gt; parameterizedAction, bool canExecute = true)       : base(parameterizedAction, canExecute)      {        \/\/  \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b       Initialise();      }  <\/code><\/pre>\n<p>  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 INotifyPropertyChanged \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 IsExecuting. \u0422\u0430\u043a \u043a\u0430\u043a \u043e\u0431\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u043c\u0435\u0442\u043e\u0434 Initialise, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e:  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u0442\u043c\u0435\u043d\u044b \/\/\/ &lt;\/summary&gt; private Command cancelCommand;  \/\/\/ &lt;summary&gt; \/\/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0442\u043c\u0435\u043d\u044b. \/\/\/ &lt;\/summary&gt; public Command CancelCommand {   get { return cancelCommand; } }  \/\/\/ &lt;summary&gt; \/\/\/ \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\/\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0435, \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b\u0430 \u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u0442\u043c\u0435\u043d\u044b \/\/\/ &lt;\/summary&gt; \/\/\/ &lt;value&gt; \/\/\/     &lt;c&gt;true&lt;\/c&gt; \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043e\u0442\u043c\u0435\u043d\u0443; \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435\u0442 -  &lt;c&gt;false&lt;\/c&gt;. \/\/\/ &lt;\/value&gt; public bool IsCancellationRequested {   get   {     return isCancellationRequested;   }   set   {     if (isCancellationRequested != value)     {       isCancellationRequested = value;       NotifyPropertyChanged(&quot;IsCancellationRequested&quot;);     }   } }  \/\/\/ &lt;summary&gt; \/\/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \/\/\/ &lt;\/summary&gt; private void Initialise() {   \/\/  \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0442\u043c\u0435\u043d\u044b   cancelCommand = new Command(     () =&gt;     {       \/\/  Set the Is Cancellation Requested flag.       IsCancellationRequested = true;     }, true); }  <\/code><\/pre>\n<p>  \u0412\u0441\u0435, \u0447\u0442\u043e \u0442\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043e\u0431\u0438\u043b\u0438\u0435 \u043a\u043e\u0434\u0430 \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0444\u043b\u0430\u0433\u0430 IsCancellationRequested \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 true. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u0434\u043e\u0441\u0442\u0443\u043f. \u0422\u0430\u043a \u0436\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e IsCancellationRequested, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u043e \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. <\/p>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u043d\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u0424\u043b\u0430\u0433, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439, \u0447\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \/\/\/ &lt;\/summary&gt; private bool isExecuting = false;  \/\/\/ &lt;summary&gt; \/\/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\/\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0444\u043b\u0430\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.. \/\/\/ &lt;\/summary&gt; \/\/\/ &lt;value&gt; \/\/\/     &lt;c&gt;true&lt;\/c&gt; \u0435\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f; \u0438\u043d\u0430\u0447\u0435 &lt;c&gt;false&lt;\/c&gt;. \/\/\/ &lt;\/value&gt; public bool IsExecuting {   get   {     return isExecuting;   }   set   {     if (isExecuting != value)     {       isExecuting = value;       NotifyPropertyChanged(&quot;IsExecuting&quot;);     }   } }  <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c. \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043c\u0435\u043d\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f Cancelled \u0438 PropertyChanged (\u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 INotifyPropertyChanged):  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ The property changed event. \/\/\/ &lt;\/summary&gt; public event PropertyChangedEventHandler PropertyChanged;  \/\/\/ &lt;summary&gt; \/\/\/ \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u0430. \/\/\/ &lt;\/summary&gt; public event CommandEventHandler Cancelled;  \u0422\u0430\u043a \u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u0438 \u043c\u0435\u0442\u043e\u0434 DoExecute.  \/\/\/ &lt;summary&gt; \/\/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \/\/\/ &lt;\/summary&gt; \/\/\/ &lt;param name=&quot;param&quot;&gt;\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440.&lt;\/param&gt; public override void DoExecute(object param) {   \/\/  \u0415\u0441\u043b\u0438 \u0443\u0436\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0442\u043e\u043d\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c.   if (IsExecuting)     return;    \/\/  \u0412\u044b\u0437\u043e\u0432 \u0432\u044b\u043f\u043e\u0434\u043d\u044f\u044e\u0449\u0435\u0439\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435.   CancelCommandEventArgs args =       new CancelCommandEventArgs() { Parameter = param, Cancel = false };   InvokeExecuting(args);    \/\/  \u0415\u0441\u043b\u0438 \u043e\u0442\u043c\u0435\u043d\u0430 -  \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u043c.   if (args.Cancel)     return;    \/\/  \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.   IsExecuting = true;  <\/code><\/pre>\n<p>  \u041c\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0443\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0435\u0435 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0444\u043b\u0430\u0433 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.  <\/p>\n<pre><code class=\"cs\">\/\/  \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440\u0430. #if !SILVERLIGHT       callingDispatcher = Dispatcher.CurrentDispatcher; #else       callingDispatcher = System.Windows.Application.Current.RootVisual.Dispatcher; #endif  <\/code><\/pre>\n<p>  \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0441\u0441\u044b\u043b\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440.<\/p>\n<p>  \u041d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430 Silverlight \u0438 WPF.  <\/p>\n<pre><code class=\"cs\">\/\/ Run the action on a new thread from the thread pool \/\/ (this will therefore work in SL and WP7 as well). ThreadPool.QueueUserWorkItem(     (state) =&gt;     {       \/\/   \u0412\u044b\u0437\u043e\u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.       InvokeAction(param);        \/\/  Fire the executed event and set the executing state.       ReportProgress(         () =&gt;         {           \/\/  \u0411\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.           IsExecuting = false;            \/\/  \u0435\u0441\u043b\u0438 \u043e\u0442\u043c\u0435\u043d\u0438\u043b\u0438,           \/\/  \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043e\u0442\u043c\u0435\u043d\u044b - , \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2013 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435.           if(IsCancellationRequested)             InvokeCancelled(new CommandEventArgs() { Parameter = param });           else             InvokeExecuted(new CommandEventArgs() { Parameter = param });            \/\/  \u042e\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u043e\u0442\u043c\u0435\u043d\u0443.           IsCancellationRequested = false;         }       );     }   ); } <\/code><\/pre>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e \u043f\u043e\u0442\u043e\u043a\u0438. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0443\u043b \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e InvokeAction \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435. \u0422\u0430\u043a \u0436\u0435 \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e ReportProgress \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440\u0430, \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0443\u0442 \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c Executed. \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440\u0430 (\u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f), \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0444\u043b\u0430\u0433 IsExecuting, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u043e \u0438\u0437 \u0441\u043e\u0431\u044b\u0442\u0438\u0439: Cancelled \u0438\u043b\u0438 Executed. \u0418 \u0442\u0430\u043a, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e ReportProgress:  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ Reports progress on the thread which invoked the command. \/\/\/ &lt;\/summary&gt; \/\/\/ &lt;param name=&quot;action&quot;&gt;The action.&lt;\/param&gt; public void ReportProgress(Action action) {   if (IsExecuting)   {     if (callingDispatcher.CheckAccess())       action();     else       callingDispatcher.BeginInvoke(((Action)(() =&gt; { action(); })));   } }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2013 \u041a\u043b\u0430\u0441\u0441 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0434\u044b\u043d\u043d\u044b\u0445 Command<\/b><\/p>\n<div class=\"spoiler_text\">\u041a\u043e\u0434 EventBindings \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0438\u0437-\u0437\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439 \u0432 WPF \u0438 Silverlight. \u0412 WPF EventBindingsCollection \u044d\u0442\u043e FreezableCollection, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u0442\u0430\u043a\u0436\u0435 \u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 Silverlight \u043d\u0435\u0442 FreezableCollection, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0440\u0443\u0447\u043d\u0443\u044e.  <\/p>\n<pre><code class=\"cs\">public static class EventBindings {   \/\/\/ &lt;summary&gt;   \/\/\/ \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e Event Bindings.   \/\/\/ &lt;\/summary&gt;     private static readonly DependencyProperty EventBindingsProperty =       DependencyProperty.RegisterAttached(&quot;EventBindings&quot;,        typeof(EventBindingCollection), typeof(EventBindings),       new PropertyMetadata(null, new PropertyChangedCallback(OnEventBindingsChanged)));      \/\/\/ &lt;summary&gt;     \/\/\/ Gets the event bindings.     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;o&quot;&gt;The o.&lt;\/param&gt;     \/\/\/ &lt;returns&gt;&lt;\/returns&gt;     public static EventBindingCollection GetEventBindings(DependencyObject o)     {         return (EventBindingCollection)o.GetValue(EventBindingsProperty);     }      \/\/\/ &lt;summary&gt;     \/\/\/ Sets the event bindings.     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;o&quot;&gt;The o.&lt;\/param&gt;     \/\/\/ &lt;param name=&quot;value&quot;&gt;The value.&lt;\/param&gt;     public static void SetEventBindings(DependencyObject o,                         EventBindingCollection value)     {         o.SetValue(EventBindingsProperty, value);     }      \/\/\/ &lt;summary&gt;     \/\/\/ Called when event bindings changed.     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;o&quot;&gt;The o.&lt;\/param&gt;     \/\/\/ &lt;param name=&quot;args&quot;&gt;The &lt;see     \/\/\/ cref=&quot;System.Windows.DependencyPropertyChangedEventArgs&quot;\/&gt;     \/\/\/ instance containing the event data.&lt;\/param&gt;     public static void OnEventBindingsChanged(DependencyObject o,             DependencyPropertyChangedEventArgs args)     {         \/\/  Cast the data.         EventBindingCollection oldEventBindings =            args.OldValue as EventBindingCollection;         EventBindingCollection newEventBindings =            args.NewValue as EventBindingCollection;          \/\/  If we have new set of event bindings, bind each one.         if (newEventBindings != null)         {             foreach (EventBinding binding in newEventBindings)             {                 binding.Bind(o); #if SILVERLIGHT                 \/\/  If we're in Silverlight we don't inherit the                 \/\/  data context so we must set this helper variable.                 binding.ParentElement = o as FrameworkElement; #endif             }         }     } }  <\/code><\/pre>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c EventBinding.Bind:  <\/p>\n<pre><code class=\"cs\">public void Bind(object o) {     try     {         \/\/  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0438 \u043f\u043e \u0435\u0433\u043e \u0438\u043c\u0435\u043d\u0438         EventInfo eventInfo = o.GetType().GetEvent(EventName);          \/\/  Get the method info for the event proxy.         MethodInfo methodInfo = GetType().GetMethod(&quot;EventProxy&quot;,                     BindingFlags.NonPublic | BindingFlags.Instance);          \/\/  Create a delegate for the event to the event proxy.         Delegate del = Delegate.CreateDelegate(eventInfo.EventHandlerType, this, methodInfo);          \/\/  Add the event handler. (Removing it first if it already exists!)         eventInfo.RemoveEventHandler(o, del);         eventInfo.AddEventHandler(o, del);     }     catch (Exception e)     {         string s = e.ToString();     } } \/\/\/ &lt;summary&gt; \/\/\/ Proxy to actually fire the event. \/\/\/ &lt;\/summary&gt; \/\/\/ &lt;param name=&quot;o&quot;&gt;The object.&lt;\/param&gt; \/\/\/ &lt;param name=&quot;e&quot;&gt;The &lt;see \/\/\/    cref=&quot;System.EventArgs&quot;\/&gt; instance \/\/\/    containing the event data.&lt;\/param&gt; private void EventProxy(object o, EventArgs e) {    #if SILVERLIGHT      \/\/  If we're in Silverlight, we have NOT inherited the data context     \/\/  because the EventBindingCollection is not a framework element and     \/\/  therefore out of the logical tree. However, we can set it here      \/\/  and update the bindings - and it will all work.     DataContext = ParentElement != null ? ParentElement.DataContext : null;     var bindingExpression = GetBindingExpression(EventBinding.CommandProperty);     if(bindingExpression != null)         bindingExpression.UpdateSource();     bindingExpression = GetBindingExpression(EventBinding.CommandParameterProperty);     if (bindingExpression != null)         bindingExpression.UpdateSource();  #endif      if (Command != null)         Command.Execute(CommandParameter); }  <\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/196960\/\"> http:\/\/habrahabr.ru\/post\/196960\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<ul>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 1 \u2013 \u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Command<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 2 \u2014 \u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Command \u0432 \u043f\u0430\u0440\u0435 \u0441 \u043b\u044f\u043c\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 3 \u2014 \u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Command \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 4 \u2013 \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 Command<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 5 \u2013 Command \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 6 \u2013 \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 Command<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 7 \u2014 \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 Command \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (UI)<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 8 \u2014 \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 Command \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043c\u0435\u043d\u044b<\/li>\n<li> \u041f\u0440\u0438\u043c\u0435\u0440 9 \u2013 \u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043a Command<\/li>\n<li> \u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2013 \u041a\u043b\u0430\u0441\u0441 Command<\/li>\n<li> \u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2013 \u041a\u043b\u0430\u0441\u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 Command<\/li>\n<li> \u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2013 \u041a\u043b\u0430\u0441\u0441 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0434\u044b\u043d\u043d\u044b\u0445 Command<\/li>\n<\/ul>\n<p>  <\/p>\n<h4>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d MVVM (Model View View-Model) \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 (Commands).   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-196960","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/196960","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=196960"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/196960\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=196960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=196960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=196960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}