5 次代码提交 08a97c4253 ... 506bc7701b

作者 SHA1 备注 提交日期
  向羽 孟 506bc7701b 合并冲突解决 1 周之前
  向羽 孟 70bd02a412 合并 1 周之前
  向羽 孟 0df1ed9c91 20251113003 主界面布局优化 1 周之前
  向羽 孟 f2dff51a9f 20251113002 添加浮窗显示,增加了两个方式,窗口和展示框 1 周之前
  向羽 孟 56740dccb2 20251111002 添加系统运行时间监控 1 周之前

+ 1 - 0
MvvmScaffoldFrame48.DLL/MvvmScaffoldFrame48.Dll.csproj

@@ -110,6 +110,7 @@
     <Compile Include="ImageAlgorithm\ImageAlgorithmTools.cs" />
     <Compile Include="LogTools\TxtLog.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SystemTools\SystemRunTimeTools.cs" />
     <Compile Include="UserManager.cs" />
     <Compile Include="WindowsTools\OnScreenKeyboardTools.cs" />
     <Compile Include="WindowsTools\SystemMonitorClass.cs" />

+ 43 - 0
MvvmScaffoldFrame48.DLL/SystemTools/SystemRunTimeTools.cs

@@ -0,0 +1,43 @@
+using MvvmScaffoldFrame48.DLL.ConfigTools;
+using MvvmScaffoldFrame48.Model.StorageModel.SystemTools;
+using System;
+using System.Diagnostics;
+using System.IO;
+
+namespace MvvmScaffoldFrame48.DLL.SystemTools
+{
+    public static class SystemRunTimeTools
+    {
+        static Stopwatch SystemRunTime = new Stopwatch();
+        static long InitRunTime;
+        public static void StartSystemRunTime()
+        {
+            string localDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
+            string systemRunTimePath = Path.Combine(localDataPath, "CCDCount\\SystemRunTime.XML");
+            if (File.Exists(systemRunTimePath))
+            {
+                var systemMessage = XMLReadWrite.DeserializeFromXml<SystemMessageConfigModel>(systemRunTimePath);
+                InitRunTime = systemMessage.SystemRunTime;
+                TimeSpan timeSpan = TimeSpan.FromTicks(InitRunTime);
+            }
+            SystemRunTime.Start();
+        }
+
+        public static void StopSystemRunTime()
+        {
+            string localDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
+            string systemruntimefoundPath = Path.Combine(localDataPath, "CCDCount");
+            if (!Directory.Exists(systemruntimefoundPath))
+            {
+                Directory.CreateDirectory(systemruntimefoundPath);
+            }
+            string systemRunTimePath = Path.Combine(systemruntimefoundPath, "SystemRunTime.XML");
+            SystemRunTime.Stop();
+            long ticks = SystemRunTime.ElapsedTicks;
+            XMLReadWrite.SerializeToXml(new SystemMessageConfigModel()
+            {
+                SystemRunTime = ticks + InitRunTime
+            }, systemRunTimePath);
+        }
+    }
+}

+ 8 - 0
MvvmScaffoldFrame48.DLL/WindowsTools/SystemMonitorClass.cs

@@ -23,6 +23,10 @@ namespace MvvmScaffoldFrame48.DLL.WindowsTools
                 "Memory", "Available MBytes");
         }
 
+        /// <summary>
+        /// 获取CPU使用率
+        /// </summary>
+        /// <returns></returns>
         public float GetCpuUsage()
         {
             stopwatch.Stop();
@@ -38,6 +42,10 @@ namespace MvvmScaffoldFrame48.DLL.WindowsTools
             return HisCPUCounter;
         }
 
+        /// <summary>
+        /// 获取可用内存
+        /// </summary>
+        /// <returns></returns>
         public float GetAvailableMemory()
         {
             return _ramCounter.NextValue();

+ 1 - 0
MvvmScaffoldFrame48.MODEL/MvvmScaffoldFrame48.Model.csproj

@@ -70,6 +70,7 @@
     <Compile Include="StorageModel\ImageAlgorithm\CPUDeepObjectDetectUseModel.cs" />
     <Compile Include="StorageModel\SystemAlarm\AlarmMessModel.cs" />
     <Compile Include="StorageModel\SystemAlarm\AlarmTypes.cs" />
+    <Compile Include="StorageModel\SystemTools\SystemMessageConfigModel.cs" />
     <Compile Include="UserModel.cs" />
   </ItemGroup>
   <ItemGroup>

+ 13 - 0
MvvmScaffoldFrame48.MODEL/StorageModel/SystemTools/SystemMessageConfigModel.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MvvmScaffoldFrame48.Model.StorageModel.SystemTools
+{
+    public class SystemMessageConfigModel
+    {
+        public long SystemRunTime { get; set; }
+    }
+}

+ 10 - 0
MvvmScaffoldFrame48/MvvmScaffoldFrame48.csproj

@@ -75,6 +75,9 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
+    <Compile Include="WPFFroms\SuspensionWindow.xaml.cs">
+      <DependentUpon>SuspensionWindow.xaml</DependentUpon>
+    </Compile>
     <Compile Include="WPFPage\AlarmPage.xaml.cs">
       <DependentUpon>AlarmPage.xaml</DependentUpon>
     </Compile>
@@ -100,6 +103,10 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="WPFFroms\SuspensionWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="WPFPage\AlarmPage.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -154,6 +161,9 @@
       <Name>MvvmScaffoldFrame48.ViewModel</Name>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <Resource Include="FromImage\菜单_白.png" />
+  </ItemGroup>
   <ItemGroup>
     <Resource Include="testfile\testimage\2025-08-04-13-28-43-744.jpg" />
     <Resource Include="testfile\testimage\2025-08-04-13-28-45-807.jpg" />

+ 23 - 31
MvvmScaffoldFrame48/Properties/Resources.Designer.cs

@@ -1,69 +1,61 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     此代码由工具生成。
-//     运行时版本: 4.0.30319.42000
+//     运行时版本:4.0.30319.42000
 //
-//     对此文件的更改可能导致不正确的行为,如果
-//     重新生成代码,则所做更改将丢失。
+//     对此文件的更改可能导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
 // </auto-generated>
 //------------------------------------------------------------------------------
 
-namespace MvvmScaffoldFrame48.Properties
-{
-
-
+namespace MvvmScaffoldFrame48.Properties {
+    using System;
+    
+    
     /// <summary>
-    ///   强类型资源类,用于查找本地化字符串等。
+    ///   一个强类型资源类,用于查找本地化字符串等。
     /// </summary>
     // 此类是由 StronglyTypedResourceBuilder
     // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
     // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
     // (以 /str 作为命令选项),或重新生成 VS 项目。
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    internal class Resources
-    {
-
+    internal class Resources {
+        
         private static global::System.Resources.ResourceManager resourceMan;
-
+        
         private static global::System.Globalization.CultureInfo resourceCulture;
-
+        
         [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
-        internal Resources()
-        {
+        internal Resources() {
         }
-
+        
         /// <summary>
-        ///   返回此类使用的缓存 ResourceManager 实例。
+        ///   返回此类使用的缓存 ResourceManager 实例。
         /// </summary>
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Resources.ResourceManager ResourceManager
-        {
-            get
-            {
-                if ((resourceMan == null))
-                {
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
                     global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MvvmScaffoldFrame48.Properties.Resources", typeof(Resources).Assembly);
                     resourceMan = temp;
                 }
                 return resourceMan;
             }
         }
-
+        
         /// <summary>
         ///   重写当前线程的 CurrentUICulture 属性,对
         ///   使用此强类型资源类的所有资源查找执行重写。
         /// </summary>
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Globalization.CultureInfo Culture
-        {
-            get
-            {
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
                 return resourceCulture;
             }
-            set
-            {
+            set {
                 resourceCulture = value;
             }
         }

+ 8 - 5
MvvmScaffoldFrame48/Properties/Resources.resx

@@ -46,7 +46,7 @@
     
     mimetype: application/x-microsoft.net.object.binary.base64
     value   : The object must be serialized with 
-            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
             : and then encoded with base64 encoding.
     
     mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
             : and then encoded with base64 encoding.
     -->
   <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
     <xsd:element name="root" msdata:IsDataSet="true">
       <xsd:complexType>
         <xsd:choice maxOccurs="unbounded">
@@ -68,9 +69,10 @@
               <xsd:sequence>
                 <xsd:element name="value" type="xsd:string" minOccurs="0" />
               </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="name" use="required" type="xsd:string" />
               <xsd:attribute name="type" type="xsd:string" />
               <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
             </xsd:complexType>
           </xsd:element>
           <xsd:element name="assembly">
@@ -85,9 +87,10 @@
                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
               </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
               <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
               <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
             </xsd:complexType>
           </xsd:element>
           <xsd:element name="resheader">
@@ -109,9 +112,9 @@
     <value>2.0</value>
   </resheader>
   <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
 </root>

+ 17 - 4
MvvmScaffoldFrame48/WPFFroms/MainWindow.xaml

@@ -5,14 +5,27 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:MvvmScaffoldFrame48"
         mc:Ignorable="d"
-        Title="MainWindow" Height="450" Width="800">
+        Title="MainWindow" Height="450" Width="800" Closing="Window_Closing">
     <Grid>
         <Grid.RowDefinitions>
-            <RowDefinition Height="80"/>
+            <RowDefinition Height="70"/>
             <RowDefinition Height="*"/>
         </Grid.RowDefinitions>
-        <Grid Grid.Row="0">
-            <Button x:Name="Button" Content="目标检测" Margin="10,10,10,10" Width="80" HorizontalAlignment="Left" Click="Button_Click"/>
+        <Grid Grid.Row="0" Background="#FF0050FF">
+            <Button x:Name="HomeButton" HorizontalAlignment="Left" VerticalAlignment="Center" Width="55" Height="65" Background="{x:Null}">
+                <StackPanel>
+                    <Image Source="/FromImage/菜单_白.png" Stretch="Fill" HorizontalAlignment="Center" Height="45" Width="45"/>
+                    <TextBlock Text="菜单" HorizontalAlignment="Center" Foreground="White" />
+                </StackPanel>
+            </Button>
+            <Grid Margin="55,0,0,0">
+                <Button x:Name="DeepObjectDetectBtn" Width="55" HorizontalAlignment="Left" Click="DeepObjectDetectBtn_Click" Background="{x:Null}" Height="65">
+                    <StackPanel>
+                        <Image Source="/FromImage/菜单_白.png" Stretch="Fill" HorizontalAlignment="Center" Width="45"/>
+                        <TextBlock Text="目标检测" HorizontalAlignment="Center" Foreground="White" />
+                    </StackPanel>
+                </Button>
+            </Grid>
         </Grid>
         <Grid Grid.Row="1">
             <Frame x:Name="ShowFrame" Margin="0,0,0,0" NavigationUIVisibility="Hidden"/>

+ 7 - 1
MvvmScaffoldFrame48/WPFFroms/MainWindow.xaml.cs

@@ -15,7 +15,13 @@ namespace MvvmScaffoldFrame48
             InitializeComponent();
         }
 
-        private void Button_Click(object sender, RoutedEventArgs e)
+        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
+        {
+
+            Environment.Exit(0);
+        }
+
+        private void DeepObjectDetectBtn_Click(object sender, RoutedEventArgs e)
         {
             Uri ShowUri = new Uri("WPFPage\\DeepObjectDetectPage.xaml", UriKind.Relative);
             ShowFrame.Navigate(ShowUri);

+ 16 - 0
MvvmScaffoldFrame48/WPFFroms/SuspensionWindow.xaml

@@ -0,0 +1,16 @@
+<Window x:Class="MvvmScaffoldFrame48.WPFFroms.SuspensionWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:MvvmScaffoldFrame48.WPFFroms"
+        mc:Ignorable="d"
+        Title="SuspensionWindow" WindowStyle="None" ResizeMode="NoResize" Topmost="True"
+        AllowsTransparency="True" Background="Transparent"
+        SizeToContent="WidthAndHeight">
+    <Grid>
+        <Border Background="White" BorderBrush="Gray" BorderThickness="1" CornerRadius="5">
+            <TextBlock Text="悬浮窗口内容" Padding="20" Margin="10"/>
+        </Border>
+    </Grid>
+</Window>

+ 32 - 0
MvvmScaffoldFrame48/WPFFroms/SuspensionWindow.xaml.cs

@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace MvvmScaffoldFrame48.WPFFroms
+{
+    /// <summary>
+    /// SuspensionWindow.xaml 的交互逻辑
+    /// </summary>
+    public partial class SuspensionWindow : Window
+    {
+        public SuspensionWindow()
+        {
+            InitializeComponent();
+            this.WindowStyle = WindowStyle.None;
+            this.ResizeMode = ResizeMode.NoResize;
+            this.Topmost = true;
+            this.AllowsTransparency = true;
+            this.Background = Brushes.Transparent;
+        }
+    }
+}

+ 13 - 0
MvvmScaffoldFrame48/WPFPage/CustomControlPage.xaml

@@ -116,6 +116,19 @@
                     </Button.Template>
                 </Button>
             </StackPanel>
+            <StackPanel Orientation ="Horizontal"  HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,120,0,0"> 
+                <Label Content="悬浮提示框:"/>
+                <Button Content="悬浮提示框" Name="PopupBtn" BorderThickness="1" HorizontalAlignment="Right" VerticalAlignment="Top" Width="100" Height="30" Click="PopupBtn_Click"/>
+                <Popup Name="myPopup" Placement="Mouse" AllowsTransparency="True">
+                    <Border Background="LightYellow" BorderBrush="Gray" BorderThickness="1">
+                        <TextBlock Text="这是一个悬浮提示" Padding="10"/>
+                    </Border>
+                </Popup>
+            </StackPanel>
+            <StackPanel Orientation ="Horizontal"  HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,160,0,0">
+                <Label Content="悬浮窗口:"/>
+                <Button Content="悬浮窗口" Name="FloatBtn" BorderThickness="1" HorizontalAlignment="Right" VerticalAlignment="Top" Width="100" Height="30" Click="FloatBtn_Click"/>
+            </StackPanel>
         </Grid>
     </Grid>
 </Page>

+ 19 - 0
MvvmScaffoldFrame48/WPFPage/CustomControlPage.xaml.cs

@@ -1,4 +1,5 @@
 using MvvmScaffoldFrame48.ViewModel.ViewModel;
+using MvvmScaffoldFrame48.WPFFroms;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -21,11 +22,29 @@ namespace MvvmScaffoldFrame48.WPFPage
     /// </summary>
     public partial class CustomControlPage : Page
     {
+        SuspensionWindow suspensionWindow = new SuspensionWindow();
         public CustomControlPage()
         {
             InitializeComponent();
             CustomControlViewModel viewModel = new CustomControlViewModel();
             this.DataContext = viewModel;
         }
+
+        private void PopupBtn_Click(object sender, RoutedEventArgs e)
+        {
+            myPopup.IsOpen = !myPopup.IsOpen;
+        }
+
+        private void FloatBtn_Click(object sender, RoutedEventArgs e)
+        {
+            if(suspensionWindow.IsVisible)
+            {
+                suspensionWindow.Hide();
+            }
+            else
+            {
+                suspensionWindow.Show();
+            }
+        }
     }
 }