Develop #10
@@ -10,7 +10,7 @@ using Util;
|
|||||||
namespace ClientApp.Utils
|
namespace ClientApp.Utils
|
||||||
{
|
{
|
||||||
public delegate void EngineCallback();
|
public delegate void EngineCallback();
|
||||||
public class Client : IDataReceiver
|
public class Client : IDataReceiver, IDisposable
|
||||||
{
|
{
|
||||||
public EngineCallback engineConnectFailed;
|
public EngineCallback engineConnectFailed;
|
||||||
public EngineCallback engineConnectSuccess;
|
public EngineCallback engineConnectSuccess;
|
||||||
@@ -87,6 +87,10 @@ namespace ClientApp.Utils
|
|||||||
/// <param name="ar">the result of the async read</param>
|
/// <param name="ar">the result of the async read</param>
|
||||||
private void OnRead(IAsyncResult ar)
|
private void OnRead(IAsyncResult ar)
|
||||||
{
|
{
|
||||||
|
if (ar == null || (!ar.IsCompleted))
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
int receivedBytes = this.stream.EndRead(ar);
|
int receivedBytes = this.stream.EndRead(ar);
|
||||||
|
|
||||||
if (totalBufferReceived + receivedBytes > 1024)
|
if (totalBufferReceived + receivedBytes > 1024)
|
||||||
@@ -288,5 +292,13 @@ namespace ClientApp.Utils
|
|||||||
{
|
{
|
||||||
this.LoginViewModel = loginViewModel;
|
this.LoginViewModel = loginViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Debug.WriteLine("client dispose called");
|
||||||
|
this.stream.Dispose();
|
||||||
|
this.client.Dispose();
|
||||||
|
this.handler.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,8 @@ namespace ClientApp.ViewModels
|
|||||||
this.MenuCommand = new RelayCommand(() => SystemCommands.ShowSystemMenu(this.mWindow, GetMousePosition()));
|
this.MenuCommand = new RelayCommand(() => SystemCommands.ShowSystemMenu(this.mWindow, GetMousePosition()));
|
||||||
|
|
||||||
var resizer = new WindowResizer(this.mWindow);
|
var resizer = new WindowResizer(this.mWindow);
|
||||||
|
|
||||||
|
this.mWindow.Closed += (sender, e) => this.client.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,4 +13,26 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Hasher.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Hasher.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ObservableObject.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ObservableObject.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)Styles\Buttons.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)Styles\Colors.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)Styles\Fonts.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)Styles\Texts.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)Styles\Windows.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -34,6 +34,8 @@ namespace Server
|
|||||||
|
|
||||||
private void OnRead(IAsyncResult ar)
|
private void OnRead(IAsyncResult ar)
|
||||||
{
|
{
|
||||||
|
if (ar == null || (!ar.IsCompleted))
|
||||||
|
return;
|
||||||
|
|
||||||
int receivedBytes = this.stream.EndRead(ar);
|
int receivedBytes = this.stream.EndRead(ar);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user