diff --git a/Develop/DBDevelopService/GrpcDBService.cs b/Develop/DBDevelopService/GrpcDBService.cs index 4087882d9577a1b051075e8cf606b31fda41bc46..df972cbcbcc53b7c345799018d944b75f22b5aac 100644 --- a/Develop/DBDevelopService/GrpcDBService.cs +++ b/Develop/DBDevelopService/GrpcDBService.cs @@ -56,6 +56,7 @@ namespace DBDevelopService { try { + LoggerService.Service.Info("GrpcDBService", "Ready to start to GrpcDBService......"); StartAsync("0.0.0.0", port); } catch(Exception ex) diff --git a/Develop/DBDevelopService/Service.cs b/Develop/DBDevelopService/Service.cs index f512849431359620b0f7feb4d05c0726707c8ada..5b284890b48bd654f822c73944d921596ca20579 100644 --- a/Develop/DBDevelopService/Service.cs +++ b/Develop/DBDevelopService/Service.cs @@ -32,8 +32,9 @@ namespace DBDevelopService DBDevelopService.SecurityManager.Manager.Init(); //驱动初始化 Cdy.Tag.DriverManager.Manager.Init(); - //注册日志 - ServiceLocator.Locator.Registor(new ConsoleLogger()); + + ////注册日志 + //ServiceLocator.Locator.Registor(new ConsoleLogger()); } #endregion ...Constructor... @@ -49,12 +50,20 @@ namespace DBDevelopService /// public void Start(int grpcPort = 5001, int webSocketPort = 8000, bool isEnableGrpc = true, bool isEnableWebApi = true) { - DbManager.Instance.Load(); - if (isEnableGrpc) - grpcDBService.Start(grpcPort); - - if (isEnableWebApi) - webDBService.Start(webSocketPort); + try + { + LoggerService.Service.Info("Service", "Ready to start...."); + DbManager.Instance.Load(); + if (isEnableGrpc) + grpcDBService.Start(grpcPort); + + if (isEnableWebApi) + webDBService.Start(webSocketPort); + } + catch(Exception ex) + { + LoggerService.Service.Erro("Service","start "+ ex.Message); + } } /// diff --git a/Develop/DBDevelopService/WebAPIDBService.cs b/Develop/DBDevelopService/WebAPIDBService.cs index b78e32eadb4792b6994adc4915b54a806fa784a5..fc2409eda185fa26ad98156da95f5ce05064f35f 100644 --- a/Develop/DBDevelopService/WebAPIDBService.cs +++ b/Develop/DBDevelopService/WebAPIDBService.cs @@ -43,7 +43,15 @@ namespace DBDevelopService /// public void Start(int port) { - StartAsync("0.0.0.0", port); + try + { + LoggerService.Service.Info("WebAPIDBService", "Ready to start to WebAPI DBService....."); + StartAsync("0.0.0.0", port); + } + catch(Exception ex) + { + LoggerService.Service.Erro("WebAPIDBService", ex.Message); + } } /// diff --git a/Develop/DBStudio/Program.cs b/Develop/DBStudio/Program.cs index 4e46b084597ffb8fe7cc1decef9872636f9b1ae1..25602cdb8bd9f60034707ff7f191e292936fa127 100644 --- a/Develop/DBStudio/Program.cs +++ b/Develop/DBStudio/Program.cs @@ -63,7 +63,7 @@ namespace DBStudio /// /// /// - public bool IsGrpcEnable { get; set; } + public bool IsGrpcEnable { get; set; } = true; /// /// @@ -79,14 +79,24 @@ namespace DBStudio /// public void Load() { - string spath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(this.GetType().Assembly.FullName), "DbInStudioServer.cfg"); - if(System.IO.File.Exists(spath)) + try + { + string spath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(this.GetType().Assembly.Location), "DbInStudioServer.cfg"); + + LoggerService.Service.Info("Config", "Start to load config"); + + if (System.IO.File.Exists(spath)) + { + var xxx = XElement.Load(spath); + this.IsWebApiEnable = bool.Parse(xxx.Attribute("IsWebApiEnable")?.Value); + this.IsGrpcEnable = bool.Parse(xxx.Attribute("IsGrpcEnable")?.Value); + this.WebApiPort = int.Parse(xxx.Attribute("WebApiPort")?.Value); + this.GrpcPort = int.Parse(xxx.Attribute("GrpcPort")?.Value); + } + } + catch(Exception ex) { - var xxx = XElement.Load(spath); - this.IsWebApiEnable = bool.Parse(xxx.Attribute("IsWebApiEnable")?.Value); - this.IsGrpcEnable = bool.Parse(xxx.Attribute("IsGrpcEnable")?.Value); - this.WebApiPort = int.Parse(xxx.Attribute("WebApiPort")?.Value); - this.GrpcPort = int.Parse(xxx.Attribute("GrpcPort")?.Value); + LoggerService.Service.Erro("Config", ex.Message); } } @@ -100,6 +110,10 @@ namespace DBStudio static void Main(string[] args) { + LogoHelper.Print(); + + //注册日志 + ServiceLocator.Locator.Registor(new ConsoleLogger()); Program pg = new Program(); Config.Instance.Load(); @@ -123,7 +137,7 @@ namespace DBStudio AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; - LogoHelper.Print(); + DBDevelopService.Service.Instanse.Start(port, webPort,Config.Instance.IsGrpcEnable,Config.Instance.IsWebApiEnable); Thread.Sleep(100); diff --git a/Develop/DbManager.Desktop/Properties/Resources.Designer.cs b/Develop/DbManager.Desktop/Properties/Resources.Designer.cs index da4120647e4375dd8f722aa0f4a3dff7689d691f..505032581e97341ac4a5971bbfdfc8ff9425569d 100644 --- a/Develop/DbManager.Desktop/Properties/Resources.Designer.cs +++ b/Develop/DbManager.Desktop/Properties/Resources.Designer.cs @@ -384,6 +384,15 @@ namespace DBInStudio.Desktop.Properties { } } + /// + /// 查找类似 Manual 的本地化字符串。 + /// + internal static string Manual { + get { + return ResourceManager.GetString("Manual", resourceCulture); + } + } + /// /// 查找类似 Welcome to Mars realtime iot database 的本地化字符串。 /// diff --git a/Develop/DbManager.Desktop/Properties/Resources.resx b/Develop/DbManager.Desktop/Properties/Resources.resx index 0a428032474441183e6ff0691dcf6f605484bb7d..1a0450bdd2cdddeb5b5771bf15abdb8e6af63b7e 100644 --- a/Develop/DbManager.Desktop/Properties/Resources.resx +++ b/Develop/DbManager.Desktop/Properties/Resources.resx @@ -227,6 +227,9 @@ Mars database developer + + Manual + Welcome to Mars realtime iot database diff --git a/Develop/DbManager.Desktop/Properties/Resources.zh-CN.resx b/Develop/DbManager.Desktop/Properties/Resources.zh-CN.resx index 1e048a5d584244822239283af61fe71c26a41e76..feba99808177cd84ca6a59f6f095f93baa0d6d60 100644 --- a/Develop/DbManager.Desktop/Properties/Resources.zh-CN.resx +++ b/Develop/DbManager.Desktop/Properties/Resources.zh-CN.resx @@ -227,6 +227,9 @@ Mars数据库开发平台 + + 手动 + 欢迎来到Mars实时物联数据库 diff --git a/Develop/DbManager.Desktop/Properties/launchSettings.json b/Develop/DbManager.Desktop/Properties/launchSettings.json index 4cfb86df453b8beb606f8686db74eca036820204..e480c59bbe941fe4b786f9ca0a645caa5e7db11d 100644 --- a/Develop/DbManager.Desktop/Properties/launchSettings.json +++ b/Develop/DbManager.Desktop/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "DBInStudio.Desktop": { "commandName": "Executable", - "executablePath": "C:\\Users\\cdy81\\source\\repos\\mars\\Output\\DBInStudio.exe" + "executablePath": "C:\\Users\\chongdaoyang\\source\\repos\\mars\\Output\\DBInStudio.exe" } } } \ No newline at end of file diff --git a/Develop/DbManager.Desktop/ViewModel/LoginViewModel.cs b/Develop/DbManager.Desktop/ViewModel/LoginViewModel.cs index 0a603deb7fbc7e831eebc6c37d5279a62eb9758f..122bba43487b59e5eee7b52e00d2a011aad3dfb8 100644 --- a/Develop/DbManager.Desktop/ViewModel/LoginViewModel.cs +++ b/Develop/DbManager.Desktop/ViewModel/LoginViewModel.cs @@ -176,9 +176,18 @@ namespace DBInStudio.Desktop.ViewModel if(mServer=="127.0.0.1"||mServer=="localhost") { var pps = Process.GetProcessesByName("DBInStudioServer"); + if(pps==null||pps.Length==0) { - Process.Start("DBInStudioServer.exe").WaitForExit(5000); + try + { + var vfile = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(this.GetType().Assembly.Location), "DBInStudioServer.exe"); + Process.Start(vfile).WaitForExit(5000); + } + catch + { + + } } } } diff --git a/Example/Producter/SpiderDriverDemo/MainWindow.xaml b/Example/Producter/SpiderDriverDemo/MainWindow.xaml index b5f03b2b6e668c2c8fd5ef5a42a345bde91d5afa..b8f2655df1387becd77ab7d2cbdb171e05994ca5 100644 --- a/Example/Producter/SpiderDriverDemo/MainWindow.xaml +++ b/Example/Producter/SpiderDriverDemo/MainWindow.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:SpiderDriverDemo" mc:Ignorable="d" - Title="SpiderSim" Height="290" Width="634"> + Title="SpiderSim" Height="353" Width="634">