diff --git a/SiMay.Core/MessageHead.cs b/SiMay.Core/MessageHead.cs index 305df705d784f2da577b39b364e324bcbb20584c..f16f879d4b634a4ebc97eced18e41f03377d0b5a 100644 --- a/SiMay.Core/MessageHead.cs +++ b/SiMay.Core/MessageHead.cs @@ -121,6 +121,8 @@ namespace SiMay.Core 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, //进程列表 @@ -128,6 +130,7 @@ namespace SiMay.Core 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/SystemInfoPack.cs b/SiMay.Core/Packets/SysManager/SystemInfoPack.cs index f2dbec208eea847f4e89f43a7e735f8e6819cdec..338c94e2965f26af6c066568ac813227895b61fd 100644 --- a/SiMay.Core/Packets/SysManager/SystemInfoPack.cs +++ b/SiMay.Core/Packets/SysManager/SystemInfoPack.cs @@ -30,4 +30,9 @@ namespace SiMay.Core.Packets { 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/SiMay.Core.csproj b/SiMay.Core/SiMay.Core.csproj index 42a241c142c1ebff4e26992b32353c2bf22ee3a3..ff3900e38faa875464c80dc6e9f9a6ba34ba70a9 100644 --- a/SiMay.Core/SiMay.Core.csproj +++ b/SiMay.Core/SiMay.Core.csproj @@ -149,6 +149,7 @@ + diff --git a/SiMay.RemoteClient.NewCore/ApplicationService/SystemService.cs b/SiMay.RemoteClient.NewCore/ApplicationService/SystemService.cs index f4193342ca5b89387e9fd33b5d641e06994aac4c..cd969e8c5833c0537c2465d6913d7f5e952e54d8 100644 --- a/SiMay.RemoteClient.NewCore/ApplicationService/SystemService.cs +++ b/SiMay.RemoteClient.NewCore/ApplicationService/SystemService.cs @@ -419,5 +419,96 @@ namespace SiMay.ServiceCore { 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 7a3689164ce080bb4d751c45b5216c75cf88d2d4..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) { @@ -136,5 +139,20 @@ namespace SiMay.RemoteControlsCore.HandlerAdapters { 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 b164ba16dd8d4dc80c89ec522f51cf955677f80d..1c65f30d31adfeef3df458ae684e0cf5fab3c26f 100644 --- a/SiMay.RemoteMonitor/Application/SystemApplication.Designer.cs +++ b/SiMay.RemoteMonitor/Application/SystemApplication.Designer.cs @@ -82,6 +82,10 @@ 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.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(); @@ -90,6 +94,8 @@ namespace SiMay.RemoteMonitor.Application this.munServiceList.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); + this.tabPage5.SuspendLayout(); + this.cmunUninstall.SuspendLayout(); this.SuspendLayout(); // // tabControl1 @@ -101,8 +107,9 @@ namespace SiMay.RemoteMonitor.Application this.tabControl1.Controls.Add(this.tabPage3); this.tabControl1.Controls.Add(this.tabPage2); 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, 2, 2, 2); + this.tabControl1.Margin = new System.Windows.Forms.Padding(2); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(624, 435); @@ -116,9 +123,9 @@ namespace SiMay.RemoteMonitor.Application this.tabPage1.Controls.Add(this.button2); this.tabPage1.Controls.Add(this.processList); this.tabPage1.Location = new System.Drawing.Point(4, 22); - this.tabPage1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.tabPage1.Margin = new System.Windows.Forms.Padding(2); this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + 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 = "进程管理"; @@ -127,7 +134,7 @@ namespace SiMay.RemoteMonitor.Application // this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button4.Location = new System.Drawing.Point(401, 387); - this.button4.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.button4.Margin = new System.Windows.Forms.Padding(2); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(66, 19); this.button4.TabIndex = 14; @@ -139,7 +146,7 @@ namespace SiMay.RemoteMonitor.Application // this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button3.Location = new System.Drawing.Point(472, 387); - this.button3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.button3.Margin = new System.Windows.Forms.Padding(2); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(66, 19); this.button3.TabIndex = 13; @@ -151,7 +158,7 @@ namespace SiMay.RemoteMonitor.Application // this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button2.Location = new System.Drawing.Point(542, 387); - this.button2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.button2.Margin = new System.Windows.Forms.Padding(2); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(66, 19); this.button2.TabIndex = 12; @@ -169,7 +176,7 @@ namespace SiMay.RemoteMonitor.Application 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, 2, 2, 2); + 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; @@ -182,9 +189,9 @@ namespace SiMay.RemoteMonitor.Application this.tabPage3.Controls.Add(this.button1); this.tabPage3.Controls.Add(this.sessionsListView); this.tabPage3.Location = new System.Drawing.Point(4, 22); - this.tabPage3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.tabPage3.Margin = new System.Windows.Forms.Padding(2); this.tabPage3.Name = "tabPage3"; - this.tabPage3.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + 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 = "会话管理"; @@ -194,7 +201,7 @@ namespace SiMay.RemoteMonitor.Application // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button1.Location = new System.Drawing.Point(542, 386); - this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.button1.Margin = new System.Windows.Forms.Padding(2); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(66, 19); this.button1.TabIndex = 13; @@ -218,7 +225,7 @@ namespace SiMay.RemoteMonitor.Application 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, 2, 2, 2); + 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; @@ -256,9 +263,9 @@ namespace SiMay.RemoteMonitor.Application this.tabPage2.BackColor = System.Drawing.SystemColors.ButtonHighlight; this.tabPage2.Controls.Add(this.systemInfoList); this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.tabPage2.Margin = new System.Windows.Forms.Padding(2); this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + 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 = "系统信息"; @@ -276,7 +283,7 @@ namespace SiMay.RemoteMonitor.Application 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, 2, 2, 2); + 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; @@ -298,9 +305,9 @@ namespace SiMay.RemoteMonitor.Application // this.tabPage4.Controls.Add(this.serviceList); this.tabPage4.Location = new System.Drawing.Point(4, 22); - this.tabPage4.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.tabPage4.Margin = new System.Windows.Forms.Padding(2); this.tabPage4.Name = "tabPage4"; - this.tabPage4.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + 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 = "服务信息"; @@ -320,7 +327,7 @@ namespace SiMay.RemoteMonitor.Application 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, 2, 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; @@ -558,6 +565,43 @@ namespace SiMay.RemoteMonitor.Application this.refreshTimer.Interval = 1500; this.refreshTimer.Tick += new System.EventHandler(this.RefreshTimer_Tick); // + // tabPage5 + // + 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; + // + // UninstallList + // + 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; + // + // cmunUninstall + // + this.cmunUninstall.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.tmunUninstall}); + this.cmunUninstall.Name = "cmunUninstall"; + this.cmunUninstall.Size = new System.Drawing.Size(101, 26); + // + // tmunUninstall + // + this.tmunUninstall.Name = "tmunUninstall"; + this.tmunUninstall.Size = new System.Drawing.Size(100, 22); + this.tmunUninstall.Text = "卸载"; + // // SystemApplication // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -582,6 +626,8 @@ namespace SiMay.RemoteMonitor.Application this.menuStrip1.PerformLayout(); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); + this.tabPage5.ResumeLayout(false); + this.cmunUninstall.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -640,5 +686,9 @@ namespace SiMay.RemoteMonitor.Application 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 630ea658411d6df6a8e45c8ffb0bfabcf044fd7e..f0a667a2ac1c8be03ee02c114517eeb3c4f851a2 100644 --- a/SiMay.RemoteMonitor/Application/SystemApplication.cs +++ b/SiMay.RemoteMonitor/Application/SystemApplication.cs @@ -62,10 +62,17 @@ 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(); @@ -74,6 +81,19 @@ namespace SiMay.RemoteMonitor.Application 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) @@ -156,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(); } @@ -386,5 +408,17 @@ namespace SiMay.RemoteMonitor.Application }); } } + + 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 2ff891cd22af6c38a5ce68fe9c7edc12fb31ae70..23dbb6e1220a902a2fb37ec1794023ddff691260 100644 --- a/SiMay.RemoteMonitor/Application/SystemApplication.resx +++ b/SiMay.RemoteMonitor/Application/SystemApplication.resx @@ -120,6 +120,9 @@ 17, 17 + + 524, 17 + 157, 17 diff --git a/SiMay.RemoteMonitor/UserControls/ProcessListviewitem.cs b/SiMay.RemoteMonitor/UserControls/ProcessListviewitem.cs index 55c2fc26b2efefab7dfc71a3978b04c6259ec202..a22da2f7c818d91d74fda43f91793c30a1fca03f 100644 --- a/SiMay.RemoteMonitor/UserControls/ProcessListviewitem.cs +++ b/SiMay.RemoteMonitor/UserControls/ProcessListviewitem.cs @@ -164,4 +164,21 @@ namespace SiMay.RemoteMonitor.UserControls 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 { } + + } + } }