From cf17b5b48738b155e9d377b60551ec18a32a3643 Mon Sep 17 00:00:00 2001 From: tanghai Date: Thu, 22 Jan 2015 16:16:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=8C=E4=B8=BA=E6=A0=91=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E6=8C=89=E5=AD=97=E6=AF=8D=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BehaviorTreeModule/ListToStringConverter.cs | 4 ++-- .../Modules/BehaviorTreeModule/NodeDataEditor.xaml.cs | 10 +++++++--- CSharp/Platform/Network/IService.cs | 2 -- CSharp/Platform/TNet/TService.cs | 7 ------- CSharp/Platform/UNet/UService.cs | 7 ------- 5 files changed, 9 insertions(+), 21 deletions(-) diff --git a/CSharp/App/Modules/BehaviorTreeModule/ListToStringConverter.cs b/CSharp/App/Modules/BehaviorTreeModule/ListToStringConverter.cs index 74e62a31..f1e7261e 100644 --- a/CSharp/App/Modules/BehaviorTreeModule/ListToStringConverter.cs +++ b/CSharp/App/Modules/BehaviorTreeModule/ListToStringConverter.cs @@ -15,7 +15,7 @@ namespace Modules.BehaviorTreeModule { return ""; } - var list = (List) value; + var list = ((List) value); return String.Join(",", list); } @@ -25,7 +25,7 @@ namespace Modules.BehaviorTreeModule { return new List(); } - var s = (string) value; + string s = (string) value; s = s.Trim(); if (s == "") { diff --git a/CSharp/App/Modules/BehaviorTreeModule/NodeDataEditor.xaml.cs b/CSharp/App/Modules/BehaviorTreeModule/NodeDataEditor.xaml.cs index b0b1181a..06fe5f94 100644 --- a/CSharp/App/Modules/BehaviorTreeModule/NodeDataEditor.xaml.cs +++ b/CSharp/App/Modules/BehaviorTreeModule/NodeDataEditor.xaml.cs @@ -1,7 +1,6 @@ using System; using System.Windows; using System.Windows.Controls; -using Common.Helper; namespace Modules.BehaviorTreeModule { @@ -10,11 +9,14 @@ namespace Modules.BehaviorTreeModule /// public partial class NodeDataEditor { + private readonly string[] nodeTypes; + public NodeDataEditor() { this.InitializeComponent(); - string[] nodeTypes = Enum.GetNames(typeof (NodeType)); + nodeTypes = Enum.GetNames(typeof (NodeType)); + Array.Sort(nodeTypes); this.cbType.ItemsSource = nodeTypes; } @@ -38,7 +40,9 @@ namespace Modules.BehaviorTreeModule { return; } - this.cbType.SelectedIndex = EnumHelper.EnumIndex(this.TreeNodeViewModel.Type); + string typeStr = ((NodeType) this.TreeNodeViewModel.Type).ToString(); + int selectIndex = Array.IndexOf(nodeTypes, typeStr); + this.cbType.SelectedIndex = selectIndex; } private void CbType_OnSelectionChanged(object sender, SelectionChangedEventArgs e) diff --git a/CSharp/Platform/Network/IService.cs b/CSharp/Platform/Network/IService.cs index 385f3d20..311004c2 100644 --- a/CSharp/Platform/Network/IService.cs +++ b/CSharp/Platform/Network/IService.cs @@ -19,8 +19,6 @@ namespace Network Task GetChannel(string host, int port); - Task GetChannel(string address); - Task GetChannel(); void Remove(IChannel channel); diff --git a/CSharp/Platform/TNet/TService.cs b/CSharp/Platform/TNet/TService.cs index 8704ad42..1f3f2767 100644 --- a/CSharp/Platform/TNet/TService.cs +++ b/CSharp/Platform/TNet/TService.cs @@ -108,13 +108,6 @@ namespace TNet return await ConnectAsync(host, port); } - public async Task GetChannel(string address) - { - string[] ss = address.Split(':'); - int port = Convert.ToInt32(ss[1]); - return await GetChannel(ss[0], port); - } - public void RunOnce(int timeout) { poller.Run(timeout); diff --git a/CSharp/Platform/UNet/UService.cs b/CSharp/Platform/UNet/UService.cs index 22889b2b..c37db18d 100644 --- a/CSharp/Platform/UNet/UService.cs +++ b/CSharp/Platform/UNet/UService.cs @@ -67,13 +67,6 @@ namespace UNet return channel; } - public async Task GetChannel(string address) - { - string[] ss = address.Split(':'); - int port = Convert.ToInt32(ss[1]); - return await GetChannel(ss[0], port); - } - public async Task GetChannel(string host, int port) { UChannel channel = null; -- GitLab