このアプリケーションは、個人情報を収集したり公開しません。
This application does not collect or publish any personal information.
using System; | |
using System.Data.Common; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration; | |
using Microsoft.Practices.EnterpriseLibrary.Data; | |
using Microsoft.Practices.EnterpriseLibrary.Validation; | |
using System.ComponentModel; | |
using Microsoft.Practices.Unity.InterceptionExtension; | |
using System.Collections.Generic; |
namespace Okazuki.WinRT.Common | |
{ | |
using System.Collections.Generic; | |
using System.Linq; | |
using Windows.Foundation.Collections; | |
class ObservableVector<T> : IObservableVector<T> | |
{ | |
private List<T> inner; |
using System; | |
using System.Collections.Generic; | |
using System.Windows.Input; | |
namespace Application3.Common | |
{ | |
class DelegateCommand : ICommand | |
{ | |
private static readonly Action EmptyExecute = () => { }; | |
private static readonly Func<bool> EmptyCanExecute = () => true; |
*[WinRT][MEF]WinRTのMEFでServiceLocator実装してみた | |
WinRTのMEFってCompositionContainerクラスがいなくなってCompositionServiceクラスでSatisfyImportsOnceメソッド使って対象クラスに何かをImportするということしかできないっぽいです。なのでMVVM Light 4のDIコンテナにMEF使ってやろうと思ったらいきなり挫折してしまいましたorz | |
それじゃぁ悔しいので、無理やりCompositionServiceクラスを使った状態でIServiceLocatorインターフェースを実装してみました。ちなみにMVVM Light 4に添付されてるMicrosoft.Practices.ServiceLocation.dllを使います。 | |
**実装 | |
ということでさくっと実装してみました。SatisfyImportsOnceメソッドにRegistrationBuilderのインスタンスを渡せば実行時にImportの挙動とかをいじれるみたいなので、それを使ってごにょごにょっとしてます。 | |
>|cs| | |
namespace SampleImplementation | |
{ |
void Main() | |
{ | |
var catalog = new AssemblyCatalog(typeof(A<>).Assembly); | |
var container = new CompositionContainer(catalog); | |
var a = container.GetExportedValue<A<string>>(); | |
a.Dump(); | |
container.ComposeParts(this); | |
var export = this.AProperty.CreateExport(); | |
var value = export.Value; |
using System.ServiceModel.DomainServices.Client; | |
using System.Windows; | |
using System.Windows.Controls; | |
using SilverlightApplication1.Web; | |
namespace SilverlightApplication1 | |
{ | |
/// <summary> | |
/// Button2つとDataGridを1つ適当に置いた画面のコードビハインド | |
/// </summary> |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reactive; | |
using System.Reactive.Linq; | |
using System.Reactive.Subjects; | |
using System.ServiceModel.DomainServices.Client; | |
using System.Windows; | |
using System.Windows.Controls; | |
using SilverlightApplication1.Web; |
<Window x:Class="WpfApplication2.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Title="MainWindow" Height="350" Width="525"> | |
<Grid> | |
<ItemsControl ItemsSource="{Binding Items}"> | |
<ItemsControl.ItemTemplate> | |
<DataTemplate> | |
<StackPanel Orientation="Horizontal"> | |
<TextBox Text="{Binding Text}" /> |
template<typename TProgress> | |
class BackgroundWorker | |
{ | |
private: | |
TProgress progress_; | |
bool reportChanged_; | |
public: | |
BackgroundWorker(bool reportChanged = false) : | |
progress_(TProgress()), | |
reportChanged_(reportChanged) |