diff --git a/SiMay.Core/MessageHead.cs b/SiMay.Core/MessageHead.cs
index 29945016252b4d9e07d5dc8d4b9bf6df337af483..f16f879d4b634a4ebc97eced18e41f03377d0b5a 100644
--- a/SiMay.Core/MessageHead.cs
+++ b/SiMay.Core/MessageHead.cs
@@ -116,12 +116,21 @@ namespace SiMay.Core
S_SYSTEM_GET_OCCUPY, //获取系统占用率信息
S_SYSTEM_ENUMSESSIONS, //获取所有会话信息
S_SYSTEM_CREATE_USER_PROCESS, //创建用户进程
+ S_SYSTEM_SERVICE_LIST, //服务列表
+ S_SYSTEM_SERVICE_STOP, //停止服务
+ S_SYSTEM_SERVICE_START, //启动服务
+ S_SYSTEM_SERVICE_RESTART, //重启服务
+ S_SYSTEM_SERVICE_STARTTYPE_SET, //设置服务启动方式
+ S_SYSTEM_UNINSTALL_LIST, //安装程序列表
+ S_SYSTEM_UNINSTALL_UN, //卸载程序
//接收指令
C_SYSTEM_PROCESS_LIST = 2000, //进程列表
C_SYSTEM_SYSTEMINFO, //系统信息
C_SYSTEM_OCCUPY_INFO, //系统占用率信息
C_SYSTEM_SESSIONS, //会话信息
+ C_SYSTEM_SERVICE_LIST, //服务列表
+ C_SYSTEM_UNINSTALL_LIST, //安装程序列表
//键盘记录---------------------------------------------------------------
S_KEYBOARD_ONOPEN = 1000, //窗口打开
diff --git a/SiMay.Core/Packets/SysManager/ProcessInfo.cs b/SiMay.Core/Packets/SysManager/ProcessInfo.cs
index 5d93b756fc051aa06b72e4b7cf2c7c4451a91a42..57a97c7e29100d90d6a3a35e25789857fa730b58 100644
--- a/SiMay.Core/Packets/SysManager/ProcessInfo.cs
+++ b/SiMay.Core/Packets/SysManager/ProcessInfo.cs
@@ -23,4 +23,15 @@ namespace SiMay.Core.Packets
public string User { get; set; }
public string FilePath { get; set; }
}
+
+ public class ServiceItem : EntitySerializerBase
+ {
+ public string ServiceName { get; set; }
+ public string DisplayName { get; set; }
+ public string Description { get; set; }
+ public string Status { get; set; }
+ public string UserName { get; set; }
+ public string StartType { get; set; }
+ public string FilePath { get; set; }
+ }
}
diff --git a/SiMay.Core/Packets/SysManager/SystemInfoPack.cs b/SiMay.Core/Packets/SysManager/SystemInfoPack.cs
index 40285535c9057de14e281276d971e5fa05c18333..338c94e2965f26af6c066568ac813227895b61fd 100644
--- a/SiMay.Core/Packets/SysManager/SystemInfoPack.cs
+++ b/SiMay.Core/Packets/SysManager/SystemInfoPack.cs
@@ -26,4 +26,13 @@ namespace SiMay.Core.Packets
public string ItemName { get; set; }
public string Value { get; set; }
}
+ public class ServiceInfoPack : EntitySerializerBase
+ {
+ public ServiceItem[] ServiceList { get; set; }
+ }
+
+ public class UninstallInfoPack : EntitySerializerBase
+ {
+ public UninstallInfo[] UninstallList { get; set; }
+ }
}
diff --git a/SiMay.Core/Packets/SysManager/UninstallInfo.cs b/SiMay.Core/Packets/SysManager/UninstallInfo.cs
new file mode 100644
index 0000000000000000000000000000000000000000..4d466cda0b89f810e3f03729503f108c00aa8e57
--- /dev/null
+++ b/SiMay.Core/Packets/SysManager/UninstallInfo.cs
@@ -0,0 +1,15 @@
+namespace SiMay.Core.Packets
+{
+ public class UninstallInfo : ReflectCache.EntitySerializerBase
+ {
+ public string DisplayName { get; set; }
+ public string InstallLocation { get; set; }
+ public string UninstallString { get; set; }
+ public string ReleaseType { get; set; }
+ public string DisplayVersion { get; set; }
+ public string Publisher { get; set; }
+ public string InstallSource { get; set; }
+ public string Size { get; set; }
+ public string InstallDate { get; set; }
+ }
+}
diff --git a/SiMay.Core/Packets/UserFolder.cs b/SiMay.Core/Packets/UserFolder.cs
new file mode 100644
index 0000000000000000000000000000000000000000..66fbc958ad0fd39ff5c6b50a094e862500d5d41d
--- /dev/null
+++ b/SiMay.Core/Packets/UserFolder.cs
@@ -0,0 +1,17 @@
+using SiMay.ReflectCache;
+
+namespace SiMay.Core.Packets
+{
+ public class UserFolder : EntitySerializerBase
+ {
+ public string UserName { get; set; }
+ public string USID { get; set; }
+ public UserShellFolders[] UserShellFolders { get; set; }
+ }
+
+ public class UserShellFolders : EntitySerializerBase
+ {
+ public string Name { get; set; }
+ public string Path { get; set; }
+ }
+}
diff --git a/SiMay.Core/SiMay.Core.csproj b/SiMay.Core/SiMay.Core.csproj
index 42a241c142c1ebff4e26992b32353c2bf22ee3a3..2c2f470cd0745eace6b406d5b2ad7732da66db17 100644
--- a/SiMay.Core/SiMay.Core.csproj
+++ b/SiMay.Core/SiMay.Core.csproj
@@ -149,8 +149,10 @@
+
+
diff --git a/SiMay.RemoteClient.NewCore/ApplicationService/FileService.cs b/SiMay.RemoteClient.NewCore/ApplicationService/FileService.cs
index 6f0e1c7a281c3c6f7a6bf6c1d5f4cfd3c82817a2..5afb6501064e584f17614d298f8ad26592acd751 100644
--- a/SiMay.RemoteClient.NewCore/ApplicationService/FileService.cs
+++ b/SiMay.RemoteClient.NewCore/ApplicationService/FileService.cs
@@ -1,4 +1,5 @@
-using SiMay.Basic;
+using Microsoft.Win32;
+using SiMay.Basic;
using SiMay.Core;
using SiMay.Core.Common;
using SiMay.Core.Enums;
@@ -481,6 +482,25 @@ namespace SiMay.ServiceCore
public void RedirtionHandler(TcpSocketSaeaSession session)
{
var pack = GetMessageEntity(session);
+ try
+ {
+ var userShellFolderPath = GetUserFolderPath()
+ .Where(c => c.UserName == UserTrunkContext.UserTrunkContextInstance.GetSessionItems()
+ .Select(c => new Core.Packets.SysManager.SessionItem()
+ {
+ UserName = c.UserName,
+ HasUserProcess = c.HasUserProcess
+ })
+ .Where(c => c.HasUserProcess == true && c.UserName.ToLower() != "system")
+ .ToArray()[0].UserName)
+ .ToArray()[0].UserShellFolders
+ .Where(s => s.Name == FolderName(pack.SpecialFolder))
+ .ToArray()[0].Path;
+
+ this.GetFileListHandler(userShellFolderPath);
+ return;
+ }
+ catch (Exception ex) { LogHelper.WriteErrorByCurrentMethod(ex); }
this.GetFileListHandler(Environment.GetFolderPath(pack.SpecialFolder));
}
@@ -660,5 +680,94 @@ namespace SiMay.ServiceCore
return fileLst;
}
+ public static string FolderName(Environment.SpecialFolder specialFolder)
+ {
+ return specialFolder switch
+ {
+ Environment.SpecialFolder.ApplicationData => "AppData",
+ Environment.SpecialFolder.CommonApplicationData => "",
+ Environment.SpecialFolder.LocalApplicationData => "Local AppData",
+ Environment.SpecialFolder.Cookies => "Cookies",
+ Environment.SpecialFolder.Desktop => "Desktop",
+ Environment.SpecialFolder.Favorites => "Favorites",
+ Environment.SpecialFolder.History => "History",
+ Environment.SpecialFolder.InternetCache => "Cache",
+ Environment.SpecialFolder.Programs => "",
+ Environment.SpecialFolder.MyComputer => "",
+ Environment.SpecialFolder.MyMusic => "My Music",
+ Environment.SpecialFolder.MyPictures => "My Pictures",
+ Environment.SpecialFolder.MyVideos => "My Video",
+ Environment.SpecialFolder.Recent => "Recent",
+ Environment.SpecialFolder.SendTo => "SendTo",
+ Environment.SpecialFolder.StartMenu => "Start Menu",
+ Environment.SpecialFolder.Startup => "Startup",
+ Environment.SpecialFolder.System => "",
+ Environment.SpecialFolder.Templates => "Templates",
+ Environment.SpecialFolder.DesktopDirectory => "Desktop",
+ Environment.SpecialFolder.MyDocuments => "Personal",
+ Environment.SpecialFolder.ProgramFiles => "",
+ Environment.SpecialFolder.CommonProgramFiles => "",
+ Environment.SpecialFolder.AdminTools => "",
+ Environment.SpecialFolder.CDBurning => "",
+ Environment.SpecialFolder.CommonAdminTools => "",
+ Environment.SpecialFolder.CommonDocuments => "",
+ Environment.SpecialFolder.CommonMusic => "",
+ Environment.SpecialFolder.CommonOemLinks => "",
+ Environment.SpecialFolder.CommonPictures => "",
+ Environment.SpecialFolder.CommonStartMenu => "",
+ Environment.SpecialFolder.CommonPrograms => "",
+ Environment.SpecialFolder.CommonStartup => "",
+ Environment.SpecialFolder.CommonDesktopDirectory => "",
+ Environment.SpecialFolder.CommonTemplates => "",
+ Environment.SpecialFolder.CommonVideos => "",
+ Environment.SpecialFolder.Fonts => "",
+ Environment.SpecialFolder.NetworkShortcuts => "",
+ Environment.SpecialFolder.PrinterShortcuts => "",
+ Environment.SpecialFolder.UserProfile => "",
+ Environment.SpecialFolder.CommonProgramFilesX86 => "",
+ Environment.SpecialFolder.ProgramFilesX86 => "",
+ Environment.SpecialFolder.Resources => "",
+ Environment.SpecialFolder.LocalizedResources => "",
+ Environment.SpecialFolder.SystemX86 => "",
+ Environment.SpecialFolder.Windows => "",
+ _ => "",
+ };
+ }
+ public static List GetUserFolderPath()
+ {
+ var userFolder = new List();
+ using (RegistryKey regBaseKey = RegistryKey.OpenBaseKey(RegistryHive.Users, RegistryView.Registry32))
+ {
+ foreach (string strUserKey in regBaseKey.GetSubKeyNames())
+ {
+ if (strUserKey.ToLower().StartsWith("s-1-5-21") && !strUserKey.ToLower().Contains("classes"))
+ {
+ RegistryKey regUserKey = regBaseKey.OpenSubKey(strUserKey);
+ RegistryKey regEnvironment = regUserKey.OpenSubKey("Volatile Environment");
+ string strUserName = (string)regEnvironment.GetValue("USERNAME", string.Empty);
+ if (strUserName != string.Empty)
+ {
+ RegistryKey regShellFolders = regUserKey.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders");
+ var userShellFolders = new List();
+ foreach (string strKeyName in regShellFolders.GetValueNames())
+ {
+ userShellFolders.Add(new UserShellFolders()
+ {
+ Name = strKeyName,
+ Path = (string)regShellFolders.GetValue(strKeyName, string.Empty)
+ });
+ }
+ userFolder.Add(new UserFolder()
+ {
+ UserName = strUserName,
+ USID = strUserKey,
+ UserShellFolders = userShellFolders.ToArray()
+ });
+ }
+ }
+ }
+ }
+ return userFolder;
+ }
}
}
\ No newline at end of file
diff --git a/SiMay.RemoteClient.NewCore/ApplicationService/SystemService.cs b/SiMay.RemoteClient.NewCore/ApplicationService/SystemService.cs
index 4f32ae21d3ee7c6b1a2fba5425ddbb46634a68c9..cd969e8c5833c0537c2465d6913d7f5e952e54d8 100644
--- a/SiMay.RemoteClient.NewCore/ApplicationService/SystemService.cs
+++ b/SiMay.RemoteClient.NewCore/ApplicationService/SystemService.cs
@@ -1,4 +1,5 @@
using Microsoft.VisualBasic.Devices;
+using Microsoft.Win32;
using SiMay.Basic;
using SiMay.Core;
using SiMay.Core.Common;
@@ -280,5 +281,234 @@ namespace SiMay.ServiceCore
MemoryUsage = (_memoryInfo.TotalPhysicalMemory / 1024 / 1024).ToString() + "MB/" + ((_memoryInfo.TotalPhysicalMemory - _memoryInfo.AvailablePhysicalMemory) / 1024 / 1024).ToString() + "MB"
});
}
+
+
+ [PacketHandler(MessageHead.S_SYSTEM_SERVICE_LIST)]
+ public void GetServiceList(TcpSocketSaeaSession session) => this.SendServiceList();
+
+ [PacketHandler(MessageHead.S_SYSTEM_SERVICE_START)]
+ public void Service_Start(TcpSocketSaeaSession session)
+ {
+ var serviceItem = GetMessageEntity(session);
+ try
+ {
+ using (var sc = new System.ServiceProcess.ServiceController(serviceItem.ServiceName))
+ {
+ if (sc.Status.Equals(System.ServiceProcess.ServiceControllerStatus.Stopped))
+ {
+ sc.Start();
+ }
+ }
+ }
+ catch { }
+
+ SendServiceList();
+
+ }
+
+ [PacketHandler(MessageHead.S_SYSTEM_SERVICE_STOP)]
+ public void Service_Stop(TcpSocketSaeaSession session)
+ {
+ var serviceItem = GetMessageEntity(session);
+ try
+ {
+ using (var sc = new System.ServiceProcess.ServiceController(serviceItem.ServiceName))
+ {
+ if (sc.Status.Equals(System.ServiceProcess.ServiceControllerStatus.Running))
+ {
+ sc.Stop();
+ }
+ }
+ }
+ catch { }
+
+ SendServiceList();
+
+ }
+
+ [PacketHandler(MessageHead.S_SYSTEM_SERVICE_RESTART)]
+ public void Service_ReStart(TcpSocketSaeaSession session)
+ {
+ var serviceItem = GetMessageEntity(session);
+ try
+ {
+ using (var sc = new System.ServiceProcess.ServiceController(serviceItem.ServiceName))
+ {
+ if (sc.Status.Equals(System.ServiceProcess.ServiceControllerStatus.Stopped))
+ {
+ sc.Start();
+ }
+ if (sc.Status.Equals(System.ServiceProcess.ServiceControllerStatus.Running))
+ {
+ sc.Stop();
+ while (true)
+ {
+ System.Threading.Thread.Sleep(1000);
+ if (sc.Status.Equals(System.ServiceProcess.ServiceControllerStatus.Stopped))
+ {
+ sc.Start();
+ break;
+ }
+ }
+ }
+ }
+ }
+ catch { }
+
+ SendServiceList();
+
+ }
+
+ [PacketHandler(MessageHead.S_SYSTEM_SERVICE_STARTTYPE_SET)]
+ public void Service_StartType(TcpSocketSaeaSession session)
+ {
+ var serviceItem = GetMessageEntity(session);
+ try
+ {
+ Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + serviceItem.ServiceName, true)?.SetValue("Start", serviceItem.StartType, RegistryValueKind.DWord);
+ }
+ catch { }
+ SendServiceList();
+
+ }
+
+ private void SendServiceList()
+ {
+ var serviceList = System.ServiceProcess.ServiceController.GetServices()
+ .OrderBy(s => s.ServiceName)
+ .Select(c => new ServiceItem()
+ {
+ ServiceName = c.ServiceName,
+ DisplayName = c.DisplayName,
+ Description = GetDescription(c.ServiceName),
+ Status = c.Status.ToString(),
+ StartType = c.StartType.ToString(),
+ UserName = GetLoginUserName(c.ServiceName),
+ FilePath = GetImagePath(c.ServiceName)
+ }).ToArray();
+
+ SendTo(CurrentSession, MessageHead.C_SYSTEM_SERVICE_LIST,
+ new ServiceInfoPack()
+ {
+ ServiceList = serviceList
+ });
+ }
+
+ private string GetDescription(string serviceName)
+ {
+ string ReturnValue = string.Empty;
+ using (var management = new System.Management.ManagementObject(new System.Management.ManagementPath(string.Format("Win32_Service.Name='{0}'", serviceName))))
+ {
+ try
+ {
+ ReturnValue = management["Description"].ToString();
+ }
+ catch
+ {
+ ReturnValue = (string)Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + serviceName)?.GetValue("Description") ?? string.Empty;
+ }
+
+ }
+ return ReturnValue;
+ }
+ private string GetLoginUserName(string serviceName)
+ {
+ return (string)Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + serviceName)?.GetValue("ObjectName") ?? string.Empty;
+ }
+ private string GetImagePath(string serviceName)
+ {
+ return (string)Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + serviceName)?.GetValue("ImagePath") ?? string.Empty;
+ }
+
+ private void SendUninstallList()
+ {
+ SendTo(CurrentSession, MessageHead.C_SYSTEM_UNINSTALL_LIST, GetUninstallInfo());
+ }
+
+ [PacketHandler(MessageHead.S_SYSTEM_UNINSTALL_LIST)]
+ public void GetUninstallList(TcpSocketSaeaSession session) => this.SendUninstallList();
+
+ [PacketHandler(MessageHead.S_SYSTEM_UNINSTALL_UN)]
+ public void Uninstall_UN(TcpSocketSaeaSession session)
+ {
+ var uninstallItem = GetMessageEntity(session);
+ try
+ {
+ Process.Start(GetUninstallInfo(uninstallItem.DisplayName).UninstallList[0].UninstallString);
+ }
+ catch { }
+ SendUninstallList();
+
+ }
+
+ private UninstallInfoPack GetUninstallInfo(string displayName = "")
+ {
+ var strRegPath = new string[] {
+ @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
+ @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
+ };
+ var pack = new UninstallInfoPack();
+ pack.UninstallList = new UninstallInfo[] { };
+ foreach (var item in strRegPath)
+ {
+ RegistryKey regMainKey = Registry.LocalMachine.OpenSubKey(item);
+ foreach (string strMainKey in regMainKey.GetSubKeyNames())
+ {
+ RegistryKey regCurrentKey = regMainKey.OpenSubKey(strMainKey);
+ object objDisplayName = regCurrentKey.GetValue("DisplayName"),
+ objInstallSource = regCurrentKey.GetValue("InstallSource"),
+ objUninstallString = regCurrentKey.GetValue("UninstallString"),
+ objInstallLocation = regCurrentKey.GetValue("InstallLocation"),
+ objPublisher = regCurrentKey.GetValue("Publisher"),
+ objDisplayVersion = regCurrentKey.GetValue("DisplayVersion"),
+ objReleaseType = regCurrentKey.GetValue("ReleaseType"),
+ objSize = regCurrentKey.GetValue("Size"),
+ objInstallDate = regCurrentKey.GetValue("InstallDate");
+ if (objDisplayName != null && objUninstallString != null)
+ {
+ if (displayName == string.Empty)
+ {
+ var info = new UninstallInfo()
+ {
+ DisplayName = objDisplayName.ToString(),
+ InstallSource = objInstallSource == null ? string.Empty : objInstallSource.ToString(),
+ UninstallString = objUninstallString == null ? string.Empty : objUninstallString.ToString(),
+ InstallLocation = objInstallLocation == null ? string.Empty : objInstallLocation.ToString(),
+ Publisher = objPublisher == null ? string.Empty : objPublisher.ToString(),
+ DisplayVersion = objDisplayVersion == null ? string.Empty : objDisplayVersion.ToString(),
+ ReleaseType = objReleaseType == null ? string.Empty : objReleaseType.ToString(),
+ Size = objSize == null ? string.Empty : objSize.ToString(),
+ InstallDate = objInstallDate == null ? string.Empty : objInstallDate.ToString()
+ };
+ List list = pack.UninstallList.ToList();
+ list.Add(info);
+ pack.UninstallList = list.ToArray();
+ }
+ else if (objDisplayName.ToString() == displayName)
+ {
+ var info = new UninstallInfo()
+ {
+ DisplayName = objDisplayName.ToString(),
+ InstallSource = objInstallSource == null ? string.Empty : objInstallSource.ToString(),
+ UninstallString = objUninstallString == null ? string.Empty : objUninstallString.ToString(),
+ InstallLocation = objInstallLocation == null ? string.Empty : objInstallLocation.ToString(),
+ Publisher = objPublisher == null ? string.Empty : objPublisher.ToString(),
+ DisplayVersion = objDisplayVersion == null ? string.Empty : objDisplayVersion.ToString(),
+ ReleaseType = objReleaseType == null ? string.Empty : objReleaseType.ToString(),
+ Size = objSize == null ? string.Empty : objSize.ToString(),
+ InstallDate = objInstallDate == null ? string.Empty : objInstallDate.ToString()
+ };
+ List list = pack.UninstallList.ToList();
+ list.Add(info);
+ pack.UninstallList = list.ToArray();
+ return pack;
+ }
+
+ }
+
+ }
+ }
+ return pack;
+ }
}
}
\ No newline at end of file
diff --git a/SiMay.RemoteControlsCore/ApplicationAdapterHandlers/SystemAdapterHandler.cs b/SiMay.RemoteControlsCore/ApplicationAdapterHandlers/SystemAdapterHandler.cs
index 60c51fad9cd835baef51c1f21d5601feef34bad6..14aaf59e0faf0185b57d80b7e128d70c6efa7f1e 100644
--- a/SiMay.RemoteControlsCore/ApplicationAdapterHandlers/SystemAdapterHandler.cs
+++ b/SiMay.RemoteControlsCore/ApplicationAdapterHandlers/SystemAdapterHandler.cs
@@ -22,6 +22,9 @@ namespace SiMay.RemoteControlsCore.HandlerAdapters
public event Action OnOccupyHandlerEvent;
+ public event Action> OnUninstallListEventHandler;
+
+
[PacketHandler(MessageHead.C_SYSTEM_SYSTEMINFO)]
private void HandlerProcessList(SessionProviderContext session)
{
@@ -107,5 +110,49 @@ namespace SiMay.RemoteControlsCore.HandlerAdapters
});
}
+ public event Action> OnServicesListEventHandler;
+
+ [PacketHandler(MessageHead.C_SYSTEM_SERVICE_LIST)]
+ private void ServiceItemHandler(SessionProviderContext session)
+ {
+ var serviceList = GetMessageEntity(session).ServiceList;
+ OnServicesListEventHandler?.Invoke(this, serviceList);
+ }
+
+ public void Service_GetList()
+ {
+ SendTo(CurrentSession, MessageHead.S_SYSTEM_SERVICE_LIST);
+ }
+ public void Service_Stop(ServiceItem serviceItems)
+ {
+ SendTo(CurrentSession, MessageHead.S_SYSTEM_SERVICE_STOP, serviceItems);
+ }
+ public void Service_Strat(ServiceItem serviceItems)
+ {
+ SendTo(CurrentSession, MessageHead.S_SYSTEM_SERVICE_START, serviceItems);
+ }
+ public void Service_ReStrat(ServiceItem serviceItems)
+ {
+ SendTo(CurrentSession, MessageHead.S_SYSTEM_SERVICE_RESTART, serviceItems);
+ }
+ public void Service_StartType_Set(ServiceItem serviceItems)
+ {
+ SendTo(CurrentSession, MessageHead.S_SYSTEM_SERVICE_STARTTYPE_SET, serviceItems);
+ }
+
+ [PacketHandler(MessageHead.C_SYSTEM_UNINSTALL_LIST)]
+ private void UninstallInfoHandler(SessionProviderContext session)
+ {
+ var uninstallList = GetMessageEntity(session).UninstallList;
+ OnUninstallListEventHandler?.Invoke(this, uninstallList);
+ }
+ public void Uninstall_GetList()
+ {
+ SendTo(CurrentSession, MessageHead.S_SYSTEM_UNINSTALL_LIST);
+ }
+ public void Uninstall_Un(UninstallInfo uninstallInfo)
+ {
+ SendTo(CurrentSession, MessageHead.S_SYSTEM_UNINSTALL_UN, uninstallInfo);
+ }
}
}
diff --git a/SiMay.RemoteMonitor/Application/SystemApplication.Designer.cs b/SiMay.RemoteMonitor/Application/SystemApplication.Designer.cs
index 35b0143e1564ffc6be52f3530cb2914a10b88556..1c65f30d31adfeef3df458ae684e0cf5fab3c26f 100644
--- a/SiMay.RemoteMonitor/Application/SystemApplication.Designer.cs
+++ b/SiMay.RemoteMonitor/Application/SystemApplication.Designer.cs
@@ -36,9 +36,35 @@ namespace SiMay.RemoteMonitor.Application
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
+ this.processList = new SiMay.RemoteMonitor.UserControls.UListView();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.button1 = new System.Windows.Forms.Button();
+ this.sessionsListView = new SiMay.RemoteMonitor.UserControls.UListView();
+ this.userName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.sessionId = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.state = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.windowsStationName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.userProcessCreated = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tabPage2 = new System.Windows.Forms.TabPage();
+ this.systemInfoList = new SiMay.RemoteMonitor.UserControls.UListView();
+ this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.tabPage4 = new System.Windows.Forms.TabPage();
+ this.serviceList = new SiMay.RemoteMonitor.UserControls.UListView();
+ this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.munServiceList = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.tmunStart = new System.Windows.Forms.ToolStripMenuItem();
+ this.tmunStop = new System.Windows.Forms.ToolStripMenuItem();
+ this.tmunReStart = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.tmunAutomatic = new System.Windows.Forms.ToolStripMenuItem();
+ this.tmunManual = new System.Windows.Forms.ToolStripMenuItem();
+ this.tmunDisable = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.文件ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.关闭窗口ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -56,22 +82,20 @@ namespace SiMay.RemoteMonitor.Application
this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
this.moryUse = new System.Windows.Forms.ToolStripStatusLabel();
this.refreshTimer = new System.Windows.Forms.Timer(this.components);
- this.processList = new SiMay.RemoteMonitor.UserControls.UListView();
- this.sessionsListView = new SiMay.RemoteMonitor.UserControls.UListView();
- this.userName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.sessionId = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.state = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.windowsStationName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.userProcessCreated = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.systemInfoList = new SiMay.RemoteMonitor.UserControls.UListView();
- this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.tabPage5 = new System.Windows.Forms.TabPage();
+ this.UninstallList = new SiMay.RemoteMonitor.UserControls.UListView();
+ this.cmunUninstall = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.tmunUninstall = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabPage2.SuspendLayout();
+ this.tabPage4.SuspendLayout();
+ this.munServiceList.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
+ this.tabPage5.SuspendLayout();
+ this.cmunUninstall.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
@@ -82,11 +106,13 @@ namespace SiMay.RemoteMonitor.Application
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage2);
- this.tabControl1.Location = new System.Drawing.Point(9, 36);
- this.tabControl1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tabControl1.Controls.Add(this.tabPage4);
+ this.tabControl1.Controls.Add(this.tabPage5);
+ this.tabControl1.Location = new System.Drawing.Point(5, 23);
+ this.tabControl1.Margin = new System.Windows.Forms.Padding(2);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(821, 538);
+ this.tabControl1.Size = new System.Drawing.Size(624, 435);
this.tabControl1.TabIndex = 0;
//
// tabPage1
@@ -96,21 +122,21 @@ namespace SiMay.RemoteMonitor.Application
this.tabPage1.Controls.Add(this.button3);
this.tabPage1.Controls.Add(this.button2);
this.tabPage1.Controls.Add(this.processList);
- this.tabPage1.Location = new System.Drawing.Point(4, 25);
- this.tabPage1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tabPage1.Location = new System.Drawing.Point(4, 22);
+ this.tabPage1.Margin = new System.Windows.Forms.Padding(2);
this.tabPage1.Name = "tabPage1";
- this.tabPage1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.tabPage1.Size = new System.Drawing.Size(813, 509);
+ this.tabPage1.Padding = new System.Windows.Forms.Padding(2);
+ this.tabPage1.Size = new System.Drawing.Size(616, 409);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "进程管理";
//
// button4
//
this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.button4.Location = new System.Drawing.Point(425, 462);
- this.button4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.button4.Location = new System.Drawing.Point(401, 387);
+ this.button4.Margin = new System.Windows.Forms.Padding(2);
this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(117, 30);
+ this.button4.Size = new System.Drawing.Size(66, 19);
this.button4.TabIndex = 14;
this.button4.Text = "最小化";
this.button4.UseVisualStyleBackColor = true;
@@ -119,10 +145,10 @@ namespace SiMay.RemoteMonitor.Application
// button3
//
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.button3.Location = new System.Drawing.Point(551, 462);
- this.button3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.button3.Location = new System.Drawing.Point(472, 387);
+ this.button3.Margin = new System.Windows.Forms.Padding(2);
this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(117, 30);
+ this.button3.Size = new System.Drawing.Size(66, 19);
this.button3.TabIndex = 13;
this.button3.Text = "最大化";
this.button3.UseVisualStyleBackColor = true;
@@ -131,24 +157,42 @@ namespace SiMay.RemoteMonitor.Application
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.button2.Location = new System.Drawing.Point(676, 462);
- this.button2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.button2.Location = new System.Drawing.Point(542, 387);
+ this.button2.Margin = new System.Windows.Forms.Padding(2);
this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(117, 30);
+ this.button2.Size = new System.Drawing.Size(66, 19);
this.button2.TabIndex = 12;
this.button2.Text = "结束进程";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
+ // processList
+ //
+ this.processList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.processList.BackColor = System.Drawing.SystemColors.ControlLightLight;
+ this.processList.CheckBoxes = true;
+ this.processList.FullRowSelect = true;
+ this.processList.HideSelection = false;
+ this.processList.Location = new System.Drawing.Point(10, 11);
+ this.processList.Margin = new System.Windows.Forms.Padding(2);
+ this.processList.Name = "processList";
+ this.processList.Size = new System.Drawing.Size(600, 373);
+ this.processList.TabIndex = 11;
+ this.processList.UseCompatibleStateImageBehavior = false;
+ this.processList.UseWindowsThemStyle = true;
+ this.processList.View = System.Windows.Forms.View.Details;
+ //
// tabPage3
//
this.tabPage3.Controls.Add(this.button1);
this.tabPage3.Controls.Add(this.sessionsListView);
- this.tabPage3.Location = new System.Drawing.Point(4, 25);
- this.tabPage3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tabPage3.Location = new System.Drawing.Point(4, 22);
+ this.tabPage3.Margin = new System.Windows.Forms.Padding(2);
this.tabPage3.Name = "tabPage3";
- this.tabPage3.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.tabPage3.Size = new System.Drawing.Size(813, 509);
+ this.tabPage3.Padding = new System.Windows.Forms.Padding(2);
+ this.tabPage3.Size = new System.Drawing.Size(616, 409);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "会话管理";
this.tabPage3.UseVisualStyleBackColor = true;
@@ -156,27 +200,232 @@ namespace SiMay.RemoteMonitor.Application
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.button1.Location = new System.Drawing.Point(676, 461);
- this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.button1.Location = new System.Drawing.Point(542, 386);
+ this.button1.Margin = new System.Windows.Forms.Padding(2);
this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(117, 30);
+ this.button1.Size = new System.Drawing.Size(66, 19);
this.button1.TabIndex = 13;
this.button1.Text = "创建用户进程";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
+ // sessionsListView
+ //
+ this.sessionsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.sessionsListView.BackColor = System.Drawing.SystemColors.ControlLightLight;
+ this.sessionsListView.CheckBoxes = true;
+ this.sessionsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.userName,
+ this.sessionId,
+ this.state,
+ this.windowsStationName,
+ this.userProcessCreated});
+ this.sessionsListView.FullRowSelect = true;
+ this.sessionsListView.HideSelection = false;
+ this.sessionsListView.Location = new System.Drawing.Point(10, 11);
+ this.sessionsListView.Margin = new System.Windows.Forms.Padding(2);
+ this.sessionsListView.Name = "sessionsListView";
+ this.sessionsListView.Size = new System.Drawing.Size(600, 371);
+ this.sessionsListView.TabIndex = 12;
+ this.sessionsListView.UseCompatibleStateImageBehavior = false;
+ this.sessionsListView.UseWindowsThemStyle = true;
+ this.sessionsListView.View = System.Windows.Forms.View.Details;
+ //
+ // userName
+ //
+ this.userName.Text = "用户名";
+ this.userName.Width = 100;
+ //
+ // sessionId
+ //
+ this.sessionId.Text = "会话标识";
+ this.sessionId.Width = 100;
+ //
+ // state
+ //
+ this.state.Text = "会话状态";
+ this.state.Width = 100;
+ //
+ // windowsStationName
+ //
+ this.windowsStationName.Text = "窗口站";
+ this.windowsStationName.Width = 100;
+ //
+ // userProcessCreated
+ //
+ this.userProcessCreated.Text = "被控用户进程";
+ this.userProcessCreated.Width = 100;
+ //
// tabPage2
//
this.tabPage2.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.tabPage2.Controls.Add(this.systemInfoList);
- this.tabPage2.Location = new System.Drawing.Point(4, 25);
- this.tabPage2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tabPage2.Location = new System.Drawing.Point(4, 22);
+ this.tabPage2.Margin = new System.Windows.Forms.Padding(2);
this.tabPage2.Name = "tabPage2";
- this.tabPage2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.tabPage2.Size = new System.Drawing.Size(813, 509);
+ this.tabPage2.Padding = new System.Windows.Forms.Padding(2);
+ this.tabPage2.Size = new System.Drawing.Size(616, 409);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "系统信息";
//
+ // systemInfoList
+ //
+ this.systemInfoList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.systemInfoList.BackColor = System.Drawing.SystemColors.ButtonHighlight;
+ this.systemInfoList.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.systemInfoList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnHeader1,
+ this.columnHeader2});
+ this.systemInfoList.FullRowSelect = true;
+ this.systemInfoList.HideSelection = false;
+ this.systemInfoList.Location = new System.Drawing.Point(4, 5);
+ this.systemInfoList.Margin = new System.Windows.Forms.Padding(2);
+ this.systemInfoList.Name = "systemInfoList";
+ this.systemInfoList.Size = new System.Drawing.Size(609, 407);
+ this.systemInfoList.TabIndex = 12;
+ this.systemInfoList.UseCompatibleStateImageBehavior = false;
+ this.systemInfoList.UseWindowsThemStyle = true;
+ this.systemInfoList.View = System.Windows.Forms.View.Details;
+ //
+ // columnHeader1
+ //
+ this.columnHeader1.Text = "信息项";
+ this.columnHeader1.Width = 150;
+ //
+ // columnHeader2
+ //
+ this.columnHeader2.Text = "值";
+ this.columnHeader2.Width = 300;
+ //
+ // tabPage4
+ //
+ this.tabPage4.Controls.Add(this.serviceList);
+ this.tabPage4.Location = new System.Drawing.Point(4, 22);
+ this.tabPage4.Margin = new System.Windows.Forms.Padding(2);
+ this.tabPage4.Name = "tabPage4";
+ this.tabPage4.Padding = new System.Windows.Forms.Padding(2);
+ this.tabPage4.Size = new System.Drawing.Size(616, 409);
+ this.tabPage4.TabIndex = 3;
+ this.tabPage4.Text = "服务信息";
+ this.tabPage4.UseVisualStyleBackColor = true;
+ //
+ // serviceList
+ //
+ this.serviceList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnHeader3,
+ this.columnHeader4,
+ this.columnHeader5,
+ this.columnHeader6,
+ this.columnHeader7,
+ this.columnHeader8});
+ this.serviceList.ContextMenuStrip = this.munServiceList;
+ this.serviceList.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.serviceList.FullRowSelect = true;
+ this.serviceList.HideSelection = false;
+ this.serviceList.Location = new System.Drawing.Point(2, 2);
+ this.serviceList.Margin = new System.Windows.Forms.Padding(2);
+ this.serviceList.Name = "serviceList";
+ this.serviceList.Size = new System.Drawing.Size(612, 405);
+ this.serviceList.TabIndex = 0;
+ this.serviceList.UseCompatibleStateImageBehavior = false;
+ this.serviceList.UseWindowsThemStyle = true;
+ this.serviceList.View = System.Windows.Forms.View.Details;
+ //
+ // columnHeader3
+ //
+ this.columnHeader3.Text = "服务名称";
+ this.columnHeader3.Width = 87;
+ //
+ // columnHeader4
+ //
+ this.columnHeader4.Text = "服务显示名称";
+ this.columnHeader4.Width = 149;
+ //
+ // columnHeader5
+ //
+ this.columnHeader5.Text = "描述";
+ this.columnHeader5.Width = 100;
+ //
+ // columnHeader6
+ //
+ this.columnHeader6.Text = "状态";
+ this.columnHeader6.Width = 81;
+ //
+ // columnHeader7
+ //
+ this.columnHeader7.Text = "启动类型";
+ this.columnHeader7.Width = 82;
+ //
+ // columnHeader8
+ //
+ this.columnHeader8.Text = "登陆为";
+ this.columnHeader8.Width = 99;
+ //
+ // munServiceList
+ //
+ this.munServiceList.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.munServiceList.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.tmunStart,
+ this.tmunStop,
+ this.tmunReStart,
+ this.toolStripSeparator1,
+ this.tmunAutomatic,
+ this.tmunManual,
+ this.tmunDisable});
+ this.munServiceList.Name = "munServiceList";
+ this.munServiceList.Size = new System.Drawing.Size(101, 142);
+ //
+ // tmunStart
+ //
+ this.tmunStart.Name = "tmunStart";
+ this.tmunStart.Size = new System.Drawing.Size(100, 22);
+ this.tmunStart.Text = "启动";
+ this.tmunStart.Click += new System.EventHandler(this.tmunStart_Click);
+ //
+ // tmunStop
+ //
+ this.tmunStop.Name = "tmunStop";
+ this.tmunStop.Size = new System.Drawing.Size(100, 22);
+ this.tmunStop.Text = "停止";
+ this.tmunStop.Click += new System.EventHandler(this.tmunStop_Click);
+ //
+ // tmunReStart
+ //
+ this.tmunReStart.Name = "tmunReStart";
+ this.tmunReStart.Size = new System.Drawing.Size(100, 22);
+ this.tmunReStart.Text = "重启";
+ this.tmunReStart.Click += new System.EventHandler(this.tmunReStart_Click);
+ //
+ // toolStripSeparator1
+ //
+ this.toolStripSeparator1.Name = "toolStripSeparator1";
+ this.toolStripSeparator1.Size = new System.Drawing.Size(97, 6);
+ //
+ // tmunAutomatic
+ //
+ this.tmunAutomatic.Name = "tmunAutomatic";
+ this.tmunAutomatic.Size = new System.Drawing.Size(100, 22);
+ this.tmunAutomatic.Text = "自动";
+ this.tmunAutomatic.Click += new System.EventHandler(this.tmunAutomatic_Click);
+ //
+ // tmunManual
+ //
+ this.tmunManual.Name = "tmunManual";
+ this.tmunManual.Size = new System.Drawing.Size(100, 22);
+ this.tmunManual.Text = "手动";
+ this.tmunManual.Click += new System.EventHandler(this.tmunManual_Click);
+ //
+ // tmunDisable
+ //
+ this.tmunDisable.Name = "tmunDisable";
+ this.tmunDisable.Size = new System.Drawing.Size(100, 22);
+ this.tmunDisable.Text = "禁用";
+ this.tmunDisable.Click += new System.EventHandler(this.tmunDisable_Click);
+ //
// menuStrip1
//
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
@@ -185,7 +434,8 @@ namespace SiMay.RemoteMonitor.Application
this.刷新信息ToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
- this.menuStrip1.Size = new System.Drawing.Size(1049, 38);
+ this.menuStrip1.Padding = new System.Windows.Forms.Padding(3, 2, 0, 2);
+ this.menuStrip1.Size = new System.Drawing.Size(629, 25);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1";
//
@@ -194,13 +444,13 @@ namespace SiMay.RemoteMonitor.Application
this.文件ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.关闭窗口ToolStripMenuItem});
this.文件ToolStripMenuItem.Name = "文件ToolStripMenuItem";
- this.文件ToolStripMenuItem.Size = new System.Drawing.Size(53, 34);
+ this.文件ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
this.文件ToolStripMenuItem.Text = "文件";
//
// 关闭窗口ToolStripMenuItem
//
this.关闭窗口ToolStripMenuItem.Name = "关闭窗口ToolStripMenuItem";
- this.关闭窗口ToolStripMenuItem.Size = new System.Drawing.Size(152, 26);
+ this.关闭窗口ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.关闭窗口ToolStripMenuItem.Text = "关闭窗口";
this.关闭窗口ToolStripMenuItem.Click += new System.EventHandler(this.关闭窗口ToolStripMenuItem_Click);
//
@@ -210,13 +460,13 @@ namespace SiMay.RemoteMonitor.Application
this.立即刷新ToolStripMenuItem,
this.更新速度ToolStripMenuItem});
this.刷新信息ToolStripMenuItem.Name = "刷新信息ToolStripMenuItem";
- this.刷新信息ToolStripMenuItem.Size = new System.Drawing.Size(53, 34);
+ this.刷新信息ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
this.刷新信息ToolStripMenuItem.Text = "选项";
//
// 立即刷新ToolStripMenuItem
//
this.立即刷新ToolStripMenuItem.Name = "立即刷新ToolStripMenuItem";
- this.立即刷新ToolStripMenuItem.Size = new System.Drawing.Size(152, 26);
+ this.立即刷新ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.立即刷新ToolStripMenuItem.Text = "立即刷新";
this.立即刷新ToolStripMenuItem.Click += new System.EventHandler(this.立即刷新ToolStripMenuItem_Click);
//
@@ -228,13 +478,13 @@ namespace SiMay.RemoteMonitor.Application
this.低ToolStripMenuItem,
this.暂停ToolStripMenuItem});
this.更新速度ToolStripMenuItem.Name = "更新速度ToolStripMenuItem";
- this.更新速度ToolStripMenuItem.Size = new System.Drawing.Size(152, 26);
+ this.更新速度ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.更新速度ToolStripMenuItem.Text = "更新速度";
//
// 高ToolStripMenuItem
//
this.高ToolStripMenuItem.Name = "高ToolStripMenuItem";
- this.高ToolStripMenuItem.Size = new System.Drawing.Size(122, 26);
+ this.高ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
this.高ToolStripMenuItem.Text = "高";
this.高ToolStripMenuItem.Click += new System.EventHandler(this.高ToolStripMenuItem_Click);
//
@@ -243,21 +493,21 @@ namespace SiMay.RemoteMonitor.Application
this.正常ToolStripMenuItem.Checked = true;
this.正常ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.正常ToolStripMenuItem.Name = "正常ToolStripMenuItem";
- this.正常ToolStripMenuItem.Size = new System.Drawing.Size(122, 26);
+ this.正常ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
this.正常ToolStripMenuItem.Text = "正常";
this.正常ToolStripMenuItem.Click += new System.EventHandler(this.正常ToolStripMenuItem_Click);
//
// 低ToolStripMenuItem
//
this.低ToolStripMenuItem.Name = "低ToolStripMenuItem";
- this.低ToolStripMenuItem.Size = new System.Drawing.Size(122, 26);
+ this.低ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
this.低ToolStripMenuItem.Text = "低";
this.低ToolStripMenuItem.Click += new System.EventHandler(this.低ToolStripMenuItem_Click);
//
// 暂停ToolStripMenuItem
//
this.暂停ToolStripMenuItem.Name = "暂停ToolStripMenuItem";
- this.暂停ToolStripMenuItem.Size = new System.Drawing.Size(122, 26);
+ this.暂停ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
this.暂停ToolStripMenuItem.Text = "暂停";
this.暂停ToolStripMenuItem.Click += new System.EventHandler(this.暂停ToolStripMenuItem_Click);
//
@@ -270,43 +520,43 @@ namespace SiMay.RemoteMonitor.Application
this.cpuUse,
this.toolStripStatusLabel2,
this.moryUse});
- this.statusStrip1.Location = new System.Drawing.Point(0, 578);
+ this.statusStrip1.Location = new System.Drawing.Point(0, 460);
this.statusStrip1.Name = "statusStrip1";
- this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0);
+ this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 10, 0);
this.statusStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.ManagerRenderMode;
- this.statusStrip1.Size = new System.Drawing.Size(839, 30);
+ this.statusStrip1.Size = new System.Drawing.Size(629, 26);
this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1";
//
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
- this.toolStripStatusLabel1.Size = new System.Drawing.Size(58, 24);
+ this.toolStripStatusLabel1.Size = new System.Drawing.Size(47, 21);
this.toolStripStatusLabel1.Text = "进程数:";
//
// m_proNum
//
this.m_proNum.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right;
this.m_proNum.Name = "m_proNum";
- this.m_proNum.Size = new System.Drawing.Size(22, 24);
+ this.m_proNum.Size = new System.Drawing.Size(19, 21);
this.m_proNum.Text = "0";
//
// cpuUse
//
this.cpuUse.Name = "cpuUse";
- this.cpuUse.Size = new System.Drawing.Size(114, 24);
+ this.cpuUse.Size = new System.Drawing.Size(93, 21);
this.cpuUse.Text = "CPU 使用率:0%";
//
// toolStripStatusLabel2
//
this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
- this.toolStripStatusLabel2.Size = new System.Drawing.Size(504, 24);
+ this.toolStripStatusLabel2.Size = new System.Drawing.Size(363, 21);
this.toolStripStatusLabel2.Spring = true;
//
// moryUse
//
this.moryUse.Name = "moryUse";
- this.moryUse.Size = new System.Drawing.Size(121, 24);
+ this.moryUse.Size = new System.Drawing.Size(96, 21);
this.moryUse.Text = "内存:1024/1024";
//
// refreshTimer
@@ -315,114 +565,52 @@ namespace SiMay.RemoteMonitor.Application
this.refreshTimer.Interval = 1500;
this.refreshTimer.Tick += new System.EventHandler(this.RefreshTimer_Tick);
//
- // processList
+ // tabPage5
//
- this.processList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.processList.BackColor = System.Drawing.SystemColors.ControlLightLight;
- this.processList.CheckBoxes = true;
- this.processList.FullRowSelect = true;
- this.processList.HideSelection = false;
- this.processList.Location = new System.Drawing.Point(17, 18);
- this.processList.Margin = new System.Windows.Forms.Padding(4);
- this.processList.Name = "processList";
- this.processList.Size = new System.Drawing.Size(775, 438);
- this.processList.TabIndex = 11;
- this.processList.UseCompatibleStateImageBehavior = false;
- this.processList.UseWindowsThemStyle = true;
- this.processList.View = System.Windows.Forms.View.Details;
+ this.tabPage5.Controls.Add(this.UninstallList);
+ this.tabPage5.Location = new System.Drawing.Point(4, 22);
+ this.tabPage5.Name = "tabPage5";
+ this.tabPage5.Size = new System.Drawing.Size(616, 409);
+ this.tabPage5.TabIndex = 4;
+ this.tabPage5.Text = "程序信息";
+ this.tabPage5.UseVisualStyleBackColor = true;
//
- // sessionsListView
+ // UninstallList
//
- this.sessionsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.sessionsListView.BackColor = System.Drawing.SystemColors.ControlLightLight;
- this.sessionsListView.CheckBoxes = true;
- this.sessionsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.userName,
- this.sessionId,
- this.state,
- this.windowsStationName,
- this.userProcessCreated});
- this.sessionsListView.FullRowSelect = true;
- this.sessionsListView.HideSelection = false;
- this.sessionsListView.Location = new System.Drawing.Point(17, 18);
- this.sessionsListView.Margin = new System.Windows.Forms.Padding(4);
- this.sessionsListView.Name = "sessionsListView";
- this.sessionsListView.Size = new System.Drawing.Size(775, 435);
- this.sessionsListView.TabIndex = 12;
- this.sessionsListView.UseCompatibleStateImageBehavior = false;
- this.sessionsListView.UseWindowsThemStyle = true;
- this.sessionsListView.View = System.Windows.Forms.View.Details;
- //
- // userName
- //
- this.userName.Text = "用户名";
- this.userName.Width = 100;
- //
- // sessionId
- //
- this.sessionId.Text = "会话标识";
- this.sessionId.Width = 100;
- //
- // state
- //
- this.state.Text = "会话状态";
- this.state.Width = 100;
+ this.UninstallList.ContextMenuStrip = this.cmunUninstall;
+ this.UninstallList.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.UninstallList.FullRowSelect = true;
+ this.UninstallList.HideSelection = false;
+ this.UninstallList.Location = new System.Drawing.Point(0, 0);
+ this.UninstallList.Name = "UninstallList";
+ this.UninstallList.Size = new System.Drawing.Size(616, 409);
+ this.UninstallList.TabIndex = 0;
+ this.UninstallList.UseCompatibleStateImageBehavior = false;
+ this.UninstallList.UseWindowsThemStyle = true;
+ this.UninstallList.View = System.Windows.Forms.View.Details;
//
- // windowsStationName
+ // cmunUninstall
//
- this.windowsStationName.Text = "窗口站";
- this.windowsStationName.Width = 100;
+ this.cmunUninstall.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.tmunUninstall});
+ this.cmunUninstall.Name = "cmunUninstall";
+ this.cmunUninstall.Size = new System.Drawing.Size(101, 26);
//
- // userProcessCreated
- //
- this.userProcessCreated.Text = "被控用户进程";
- this.userProcessCreated.Width = 100;
+ // tmunUninstall
//
- // systemInfoList
- //
- this.systemInfoList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.systemInfoList.BackColor = System.Drawing.SystemColors.ButtonHighlight;
- this.systemInfoList.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.systemInfoList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.columnHeader1,
- this.columnHeader2});
- this.systemInfoList.FullRowSelect = true;
- this.systemInfoList.HideSelection = false;
- this.systemInfoList.Location = new System.Drawing.Point(8, 8);
- this.systemInfoList.Margin = new System.Windows.Forms.Padding(4);
- this.systemInfoList.Name = "systemInfoList";
- this.systemInfoList.Size = new System.Drawing.Size(795, 494);
- this.systemInfoList.TabIndex = 12;
- this.systemInfoList.UseCompatibleStateImageBehavior = false;
- this.systemInfoList.UseWindowsThemStyle = true;
- this.systemInfoList.View = System.Windows.Forms.View.Details;
- //
- // columnHeader1
- //
- this.columnHeader1.Text = "信息项";
- this.columnHeader1.Width = 150;
- //
- // columnHeader2
- //
- this.columnHeader2.Text = "值";
- this.columnHeader2.Width = 300;
+ this.tmunUninstall.Name = "tmunUninstall";
+ this.tmunUninstall.Size = new System.Drawing.Size(100, 22);
+ this.tmunUninstall.Text = "卸载";
//
// SystemApplication
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(839, 608);
+ this.ClientSize = new System.Drawing.Size(629, 486);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
- this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "SystemApplication";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "SystemManager";
@@ -432,10 +620,14 @@ namespace SiMay.RemoteMonitor.Application
this.tabPage1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
+ this.tabPage4.ResumeLayout(false);
+ this.munServiceList.ResumeLayout(false);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
+ this.tabPage5.ResumeLayout(false);
+ this.cmunUninstall.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -478,5 +670,25 @@ namespace SiMay.RemoteMonitor.Application
private System.Windows.Forms.ColumnHeader windowsStationName;
private System.Windows.Forms.ColumnHeader userProcessCreated;
private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.TabPage tabPage4;
+ private UListView serviceList;
+ private System.Windows.Forms.ColumnHeader columnHeader3;
+ private System.Windows.Forms.ColumnHeader columnHeader4;
+ private System.Windows.Forms.ColumnHeader columnHeader5;
+ private System.Windows.Forms.ColumnHeader columnHeader6;
+ private System.Windows.Forms.ColumnHeader columnHeader7;
+ private System.Windows.Forms.ColumnHeader columnHeader8;
+ private System.Windows.Forms.ContextMenuStrip munServiceList;
+ private System.Windows.Forms.ToolStripMenuItem tmunStart;
+ private System.Windows.Forms.ToolStripMenuItem tmunStop;
+ private System.Windows.Forms.ToolStripMenuItem tmunReStart;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
+ private System.Windows.Forms.ToolStripMenuItem tmunAutomatic;
+ private System.Windows.Forms.ToolStripMenuItem tmunManual;
+ private System.Windows.Forms.ToolStripMenuItem tmunDisable;
+ private System.Windows.Forms.TabPage tabPage5;
+ private UListView UninstallList;
+ private System.Windows.Forms.ContextMenuStrip cmunUninstall;
+ private System.Windows.Forms.ToolStripMenuItem tmunUninstall;
}
}
\ No newline at end of file
diff --git a/SiMay.RemoteMonitor/Application/SystemApplication.cs b/SiMay.RemoteMonitor/Application/SystemApplication.cs
index 471203c9a84eb3766566ea4d2081a92a138acfeb..f0a667a2ac1c8be03ee02c114517eeb3c4f851a2 100644
--- a/SiMay.RemoteMonitor/Application/SystemApplication.cs
+++ b/SiMay.RemoteMonitor/Application/SystemApplication.cs
@@ -62,15 +62,38 @@ namespace SiMay.RemoteMonitor.Application
this.processList.Columns.Add("用户名称", 100);
this.processList.Columns.Add("文件位置", 300);
+ this.UninstallList.Columns.Add("名称", 150);
+ this.UninstallList.Columns.Add("发布者", 150);
+ this.UninstallList.Columns.Add("安装时间", 100);
+ this.UninstallList.Columns.Add("大小", 100);
+ this.UninstallList.Columns.Add("版本", 100);
+
this.SystemAdapterHandler.OnProcessListHandlerEvent += OnProcessListHandlerEvent;
this.SystemAdapterHandler.OnSystemInfoHandlerEvent += OnSystemInfoHandlerEvent;
this.SystemAdapterHandler.OnOccupyHandlerEvent += OnOccupyHandlerEvent;
this.SystemAdapterHandler.OnSessionsEventHandler += OnSessionsEventHandler;
+ this.SystemAdapterHandler.OnUninstallListEventHandler += OnUninstallListEventHandler;
this._title = _title.Replace("#Name#", SystemAdapterHandler.OriginName);
this.Text = this._title;
this.SystemAdapterHandler.GetSystemInfoItems();
this.SystemAdapterHandler.EnumSession();
this.GetSystemInfos();
+
+ this.SystemAdapterHandler.OnServicesListEventHandler += OnServicesListEventHandler;
+ this.SystemAdapterHandler.Service_GetList();
+ this.SystemAdapterHandler.Uninstall_GetList();
+ }
+
+
+ private void OnUninstallListEventHandler(SystemAdapterHandler adapterHandler, IEnumerable uninstalllInfo)
+ {
+ this.UninstallList.Items.Clear();
+ var uninstalllList = new List(uninstalllInfo);
+ foreach (var item in uninstalllList)
+ {
+ var uninstalllItem = new UninstallViewItem(item.DisplayName, item.Publisher, item.InstallDate, item.Size, item.DisplayVersion);
+ this.UninstallList.Items.Add(uninstalllItem);
+ }
}
private void OnSessionsEventHandler(SystemAdapterHandler adapterHandler, IEnumerable sessions)
@@ -153,6 +176,8 @@ namespace SiMay.RemoteMonitor.Application
this.SystemAdapterHandler.OnSystemInfoHandlerEvent -= OnSystemInfoHandlerEvent;
this.SystemAdapterHandler.OnOccupyHandlerEvent -= OnOccupyHandlerEvent;
this.SystemAdapterHandler.OnSessionsEventHandler -= OnSessionsEventHandler;
+ this.SystemAdapterHandler.OnServicesListEventHandler -= OnServicesListEventHandler;
+ this.SystemAdapterHandler.OnUninstallListEventHandler -= OnUninstallListEventHandler;
this.SystemAdapterHandler.CloseSession();
}
@@ -297,5 +322,103 @@ namespace SiMay.RemoteMonitor.Application
this.SystemAdapterHandler.EnumSession();
}
+
+ private void OnServicesListEventHandler(SystemAdapterHandler adapterHandler, IEnumerable serviceItems)
+ {
+ this.serviceList.Items.Clear();
+ var serviceList = new List(serviceItems);
+ foreach (var item in serviceList)
+ {
+ var serviceitem = new ServiceViewItem(item.ServiceName, item.DisplayName, item.Description, item.Status, item.StartType, item.UserName);
+ this.serviceList.Items.Add(serviceitem);
+ }
+ }
+
+ private void tmunStart_Click(object sender, EventArgs e)
+ {
+ if (serviceList.SelectedItems.Count > 0)
+ {
+ ListView.SelectedListViewItemCollection selectItem = this.serviceList.SelectedItems;
+ this.SystemAdapterHandler.Service_Strat(new ServiceItem()
+ {
+ ServiceName = selectItem[0].Text
+ });
+ }
+ }
+
+ private void tmunStop_Click(object sender, EventArgs e)
+ {
+ if (serviceList.SelectedItems.Count > 0)
+ {
+ ListView.SelectedListViewItemCollection selectItem = this.serviceList.SelectedItems;
+ this.SystemAdapterHandler.Service_Stop(new ServiceItem()
+ {
+ ServiceName = selectItem[0].Text
+ });
+ }
+ }
+
+ private void tmunReStart_Click(object sender, EventArgs e)
+ {
+ if (serviceList.SelectedItems.Count > 0)
+ {
+ ListView.SelectedListViewItemCollection selectItem = this.serviceList.SelectedItems;
+ this.SystemAdapterHandler.Service_ReStrat(new ServiceItem()
+ {
+ ServiceName = selectItem[0].Text
+ });
+ }
+ }
+
+ private void tmunAutomatic_Click(object sender, EventArgs e)
+ {
+ if (serviceList.SelectedItems.Count > 0)
+ {
+ ListView.SelectedListViewItemCollection selectItem = this.serviceList.SelectedItems;
+ this.SystemAdapterHandler.Service_StartType_Set(new ServiceItem()
+ {
+ ServiceName = selectItem[0].Text,
+ StartType = "2"
+ });
+ }
+ }
+
+ private void tmunManual_Click(object sender, EventArgs e)
+ {
+ if (serviceList.SelectedItems.Count > 0)
+ {
+ ListView.SelectedListViewItemCollection selectItem = this.serviceList.SelectedItems;
+ this.SystemAdapterHandler.Service_StartType_Set(new ServiceItem()
+ {
+ ServiceName = selectItem[0].Text,
+ StartType = "3"
+ });
+ }
+ }
+
+ private void tmunDisable_Click(object sender, EventArgs e)
+ {
+ if (serviceList.SelectedItems.Count > 0)
+ {
+ ListView.SelectedListViewItemCollection selectItem = this.serviceList.SelectedItems;
+ this.SystemAdapterHandler.Service_StartType_Set(new ServiceItem()
+ {
+ ServiceName = selectItem[0].Text,
+ StartType = "4"
+ });
+ }
+ }
+
+ private void tmunUninstall_Click(object sender, EventArgs e)
+ {
+ if (UninstallList.SelectedItems.Count > 0)
+ {
+ ListView.SelectedListViewItemCollection selectItem = this.UninstallList.SelectedItems;
+ this.SystemAdapterHandler.Uninstall_Un(new UninstallInfo()
+ {
+ DisplayName = selectItem[0].Text
+ });
+ }
+ }
}
}
\ No newline at end of file
diff --git a/SiMay.RemoteMonitor/Application/SystemApplication.resx b/SiMay.RemoteMonitor/Application/SystemApplication.resx
index a566c40ee31aa721eeb16cc3c5652634dffd8171..23dbb6e1220a902a2fb37ec1794023ddff691260 100644
--- a/SiMay.RemoteMonitor/Application/SystemApplication.resx
+++ b/SiMay.RemoteMonitor/Application/SystemApplication.resx
@@ -117,14 +117,20 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
+
+ 524, 17
+
+
+ 157, 17
+
- 137, 17
+ 277, 17
- 258, 17
+ 398, 17
47
diff --git a/SiMay.RemoteMonitor/UserControls/ProcessListviewitem.cs b/SiMay.RemoteMonitor/UserControls/ProcessListviewitem.cs
index e79cc79bb9fdacd15463e8114bbba0e4a83c5a88..a22da2f7c818d91d74fda43f91793c30a1fca03f 100644
--- a/SiMay.RemoteMonitor/UserControls/ProcessListviewitem.cs
+++ b/SiMay.RemoteMonitor/UserControls/ProcessListviewitem.cs
@@ -113,4 +113,72 @@ namespace SiMay.RemoteMonitor.UserControls
return describe;
}
}
+
+ public class ServiceViewItem : ListViewItem
+ {
+ public string ServiceName { get; set; }
+ public string DisplayName { get; set; }
+ public string Description { get; set; }
+ public string Status { get; set; }
+ public string UserName { get; set; }
+ public string StartType { get; set; }
+ public ServiceViewItem(string serviceName, string displayName, string description, string status, string startType, string userName)
+ {
+ this.ServiceName = serviceName;
+ this.DisplayName = displayName;
+ this.Description = description;
+ this.Status = status;
+ this.StartType = startType;
+ this.UserName = userName;
+
+ this.Text = serviceName;
+ this.SubItems.Add(displayName);
+ this.SubItems.Add(description);
+ this.SubItems.Add(ServiceStatus(status));
+ this.SubItems.Add(ServiceStatus(startType));
+ this.SubItems.Add(userName);
+ }
+
+ private string ServiceStatus(string status)
+ {
+ if (status == "Running")
+ {
+ return "正在运行";
+ }
+ else if (status == "Stopped")
+ {
+ return "未在运行";
+ }
+ else if (status == "Automatic")
+ {
+ return "自动";
+ }
+ else if (status == "Manual")
+ {
+ return "手动";
+ }
+ else if (status == "Disabled")
+ {
+ return "禁用";
+ }
+ return "未知";
+ }
+ }
+
+ public class UninstallViewItem : ListViewItem
+ {
+ public UninstallViewItem(string displayName, string publisher, string installDate, string size, string displayVersion)
+ {
+ try
+ {
+ this.Text = displayName;
+ this.SubItems.Add(publisher);
+ this.SubItems.Add(DateTime.TryParse(installDate, out DateTime dt) ? DateTime.Parse(installDate).ToShortDateString() : DateTime.ParseExact(installDate, "yyyyMMdd", System.Threading.Thread.CurrentThread.CurrentCulture).ToShortDateString());
+ this.SubItems.Add(size);
+ this.SubItems.Add(displayVersion);
+ }
+ catch { }
+
+ }
+ }
}