MVVM 라이트 패턴을 사용하여 WPF 프런트 엔드를 만듭니다. 이 프런트 엔드는 웹 서버를 호출하여 응용 프로그램 서버에서 데이터를 검색합니다. 응용 프로그램 서버는 .dll을 통해 웹 메서드를 제공하는 독점 공급 업체 응용 프로그램 서버입니다.MVVM Light를 공급 업체의 Webservice와 함께 사용
서버에서 결과를 얻으려면 서버에서 클라이언트 세션을 가져와야합니다. 문제는 그 I는 서버에 연결이 내 모델을 호출 할 때, 나는 다음과 같은 오류 얻을 : 나는 시스템은 계속하고 생산
cashaccount.getConnection();
줄을 촬영하면
'The invocation of the constructor on type [APP].ViewModel.ViewModelLocator' that matches the specified binding constraints threw an exception.' Line number '12' and line position '10'.
을 WPF Toolkit의 Data Grid가있는 WPF 창
MainWindow.xaml
<Window x:Class="CreditSuisse.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit"
mc:Ignorable="d"
Height="301"
Width="520"
Title="MVVM Light Application"
DataContext="{Binding Main, Source={StaticResource Locator}}">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Skins/MainSkin.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<dg:DataGrid ItemsSource="{Binding Path=CashAccount}"
Margin="5" AutoGenerateColumns="False">
<dg:DataGrid.Columns>
<dg:DataGridTextColumn Binding="{Binding AcctCd}" Header="Account Code" />
<dg:DataGridTextColumn Binding="{Binding AcctCd}" Header="Security Name" />
<dg:DataGridTextColumn Binding="{Binding QtySod}" Header="Quantity Start of Day" />
<dg:DataGridTextColumn Binding="{Binding QtySod}" Header="Cash Delta (Price Delta)" />
<dg:DataGridTextColumn Binding="{Binding QtySod}" Header="Action" />
</dg:DataGrid.Columns>
</dg:DataGrid>
</Window>
ViewModel.cs
public MainViewModel()
{
if (IsInDesignMode)
{
// Code runs in Blend --> create design time data.
}
else
{
logger.Info("----- Start -----");
cashaccount.getConnection();
}
}
나는 간결하게하기 위해 생략했습니다.
는 여기가 서비스 에이전트가 더 나은 방법이 될 것입니다 있는지 확인하기 위해 찾고
CashAccount.cs
public class CashAccount : xx.xx.Position
{
private bool cashChanged=false;
private string secName = null;
private xxx.Wsi.ClientSession privateSession;
private static Logger logger = LogManager.GetCurrentClassLogger();
public bool didCashChange
{
get
{
return cashChanged;
}
set
{
this.cashChanged = value;
}
}
public void getConnection()
{
try
{
app.Helper.Session session = new Session();
privateSession = session.getSession();
}
catch (TransportException e)
{
Console.WriteLine("Error communicating with server: " + e.Message);
logger.Info("Couldn't log into xxx...");
logger.Error(e.Message);
}
{
}
}
}
}
모델에게 있습니다. 누구든지 아이디어가 있다면 그것을 고맙게 생각할 것입니다.