I've tried to read article WPF/Silverlight: Step By Step Guide to MVVM but I can not understand it completely.
However I've noticied such guideline:
That is your View.xaml.cs that is supposed to have almost no code.
How should I fix my code below? Should I extract my WCF code to some another place? Thanks.
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
ChannelFactory<IManagementConsole> pipeFactory =
new ChannelFactory<IManagementConsole>(
new NetNamedPipeBinding(),
new EndpointAddress(
"net.pipe://localhost/PipeManagementConsole"));
IManagementConsole pipeProxy =
pipeFactory.CreateChannel();
List<ConsoleData> datas = new List<ConsoleData>();
foreach (StrategyDescriptor sd in pipeProxy.GetStrategies())
{
datas.Add(pipeProxy.GetData(sd.Id));
}
dataGrid1.ItemsSource = datas;
}
}