|
|
@@ -28,35 +28,11 @@ namespace Modules.Robot
|
|
|
private Visibility dockPanelVisiable = Visibility.Hidden;
|
|
|
private readonly BossClient.BossClient bossClient = new BossClient.BossClient();
|
|
|
private readonly ObservableCollection<ServerViewModel> serverInfos =
|
|
|
- new ObservableCollection<ServerViewModel>();
|
|
|
-
|
|
|
- private DataCenterEntities entities = new DataCenterEntities();
|
|
|
-
|
|
|
- private IMessageChannel iMessageChannel;
|
|
|
-
|
|
|
- public DataCenterEntities Entities
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return this.entities;
|
|
|
- }
|
|
|
- set
|
|
|
- {
|
|
|
- this.entities = value;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public IMessageChannel IMessageChannel
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return this.iMessageChannel;
|
|
|
- }
|
|
|
- set
|
|
|
- {
|
|
|
- this.iMessageChannel = value;
|
|
|
- }
|
|
|
- }
|
|
|
+ new ObservableCollection<ServerViewModel>();
|
|
|
+
|
|
|
+ public DataCenterEntities Entities { get; set; }
|
|
|
+
|
|
|
+ public IMessageChannel IMessageChannel { get; set; }
|
|
|
|
|
|
public int FindTypeIndex
|
|
|
{
|
|
|
@@ -203,8 +179,9 @@ namespace Modules.Robot
|
|
|
}
|
|
|
|
|
|
[ImportingConstructor]
|
|
|
- public RobotViewModel(IEventAggregator eventAggregator)
|
|
|
- {
|
|
|
+ public RobotViewModel(IEventAggregator eventAggregator)
|
|
|
+ {
|
|
|
+ this.Entities = new DataCenterEntities();
|
|
|
eventAggregator.GetEvent<LoginOKEvent>().Subscribe(this.OnLoginOK);
|
|
|
}
|
|
|
|
|
|
@@ -221,7 +198,7 @@ namespace Modules.Robot
|
|
|
|
|
|
private void Disposing(bool disposing)
|
|
|
{
|
|
|
- this.entities.Dispose();
|
|
|
+ this.Entities.Dispose();
|
|
|
this.bossClient.Dispose();
|
|
|
}
|
|
|
|
|
|
@@ -229,9 +206,9 @@ namespace Modules.Robot
|
|
|
{
|
|
|
this.DockPanelVisiable = Visibility.Visible;
|
|
|
this.IMessageChannel = messageChannel;
|
|
|
- }
|
|
|
-
|
|
|
- public async void Servers()
|
|
|
+ }
|
|
|
+
|
|
|
+ public async Task Servers()
|
|
|
{
|
|
|
ABossCommand bossCommand = new BCServerInfo(this.IMessageChannel, this.Entities);
|
|
|
var result = await bossCommand.DoAsync();
|
|
|
@@ -249,14 +226,14 @@ namespace Modules.Robot
|
|
|
this.ServerInfos.Add(new ServerViewModel { Name = nm });
|
|
|
}
|
|
|
this.ErrorInfo = "查询服务器成功!";
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
public void Reload()
|
|
|
{
|
|
|
ABossCommand bossCommand = new BCReloadWorld(this.IMessageChannel, this.Entities);
|
|
|
bossCommand.Do();
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
public void FindPlayer()
|
|
|
{
|
|
|
ABossCommand bossCommand = new BCFindPlayer(this.IMessageChannel, this.Entities)
|
|
|
@@ -279,7 +256,7 @@ namespace Modules.Robot
|
|
|
this.ErrorInfo = "查询成功";
|
|
|
}
|
|
|
|
|
|
- public async void ForbiddenBuy()
|
|
|
+ public async Task ForbiddenBuy()
|
|
|
{
|
|
|
if (this.Guid == "")
|
|
|
{
|
|
|
@@ -301,9 +278,9 @@ namespace Modules.Robot
|
|
|
return;
|
|
|
}
|
|
|
this.ErrorInfo = string.Format("禁止交易失败, error code: {0}", errorCode);
|
|
|
- }
|
|
|
-
|
|
|
- public async void AllowBuy()
|
|
|
+ }
|
|
|
+
|
|
|
+ public async Task AllowBuy()
|
|
|
{
|
|
|
if (this.Guid == "")
|
|
|
{
|