Просмотр исходного кода

1.ItemsControl换成ContentControl
2.每个类带自己的log成员

tanghai 14 лет назад
Родитель
Сommit
18b45822fc

+ 3 - 1
CSharp/Editor/Shell.xaml

@@ -5,6 +5,8 @@
 	xmlns:prism="http://www.codeplex.com/prism"
 	Title="Editor" Height="600" Width="800" WindowStartupLocation="CenterScreen">
 	<Grid>
-		<ItemsControl Name="mainRegion" prism:RegionManager.RegionName="MainRegion" />
+		<StackPanel>
+			<ContentControl Name="mainRegion" prism:RegionManager.RegionName="MainRegion" />
+		</StackPanel>
 	</Grid>
 </Window>

+ 11 - 9
CSharp/Infrastructure/AutoPopulateExportedViewsBehavior.cs

@@ -36,18 +36,20 @@ namespace Infrastructure
 
 		private void AddRegisteredViews()
 		{
-			if (this.Region != null)
+			if (this.Region == null)
 			{
-				foreach (var viewEntry in this.RegisteredViews)
+				return;
+			}
+			
+			foreach (var viewEntry in this.RegisteredViews)
+			{
+				if (viewEntry.Metadata.RegionName == this.Region.Name)
 				{
-					if (viewEntry.Metadata.RegionName == this.Region.Name)
-					{
-						var view = viewEntry.Value;
+					var view = viewEntry.Value;
 
-						if (!this.Region.Views.Contains(view))
-						{
-							this.Region.Add(view);
-						}
+					if (!this.Region.Views.Contains(view))
+					{
+						this.Region.Add(view);
 					}
 				}
 			}

+ 1 - 5
CSharp/Modules/LoginModule/LoginModule.cs

@@ -1,9 +1,5 @@
-using System;
-using System.ComponentModel.Composition;
-using Microsoft.Practices.Prism.Logging;
-using Microsoft.Practices.Prism.MefExtensions.Modularity;
+using Microsoft.Practices.Prism.MefExtensions.Modularity;
 using Microsoft.Practices.Prism.Modularity;
-using Microsoft.Practices.Prism.Regions;
 
 namespace Module.Login
 {

+ 1 - 1
CSharp/Modules/LoginModule/LoginViewModel.cs

@@ -27,6 +27,7 @@ namespace Module.Login
 		private string username = "";
 		private string password = "";
 		private string logInfo = "";
+		private Logger logger = LogManager.GetCurrentClassLogger();
 
 		public LoginViewModel()
 		{
@@ -117,7 +118,6 @@ namespace Module.Login
 			await stream.WriteAsync(passMD5Buffer, 0, passMD5Buffer.Length);
 
 			LogInfo += "username: " + username.Trim() + " password md5: " + passMD5 + Environment.NewLine;
-			Logger logger = LogManager.GetCurrentClassLogger();
 			logger.Debug("11111111111");
 		}
 	}