TerminalMACS

**注意:** 此项目只用于存放一些测试代码,逐渐沦为一个大杂烩仓库,请谨慎star。 1. 刚开始的规划是做一个多平台的监控开源项目,做着做着就变成一个demo集合项目了。 2. 不定期的更新.NET最新版本,目前是 .NET 7,不做历史版本保留,抱歉。 3. 现在此项目的目标只是做学习和积累。 ## 0. 简介 一个使用 Prism 作为模块化框架、基于多个开源控件库作为UI控件选择、集成开源 UI 界面设计的 .NET 7 WPF 客户端项目。 ## 1. 特性 - 使用 [.NET 7](https://dotnet.microsoft.com/zh-cn/) 开发,体验最新 .NET 平台 >.NET是免费,跨平台,开源的,用于构建所有应用的开发人员平台。 - 基于 [Prism 8](https://github.com/PrismLibrary/Prism) 搭建模块化框架,方便程序扩展 >Prism为程序设计提供指导,旨在帮助用户更加容易的设计和构建丰富、灵活、易于维护WPF桌面应用程序。Prism使用设计模式(如MVVM,复合视图,事件聚合器),帮助你创建一个松耦合的程序。遵循这些设计模式原则,将目标程序解耦成独立的模块。这些类型的应用程序被称为复合应用程序。 - 已使用或即将使用到多个开源WPF控件库 多种开源 WPF UI 库选择,开发 WPF 项目更方便:[MaterialDesignInXamlToolkit](https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit)、 [HandyControl](https://github.com/HandyOrg/HandyControl)、 [PanuonUI.Silver](https://github.com/Panuon/PanuonUI.Silver)、 [AduSkin](https://github.com/aduskin/AduSkin)。 - ECharts ECharts:[pie-doughnut](https://echarts.apache.org/examples/zh/editor.html?c=pie-doughnut) - 本地化支持 - 动态国际化支持 - 支持主题色动态切换 ## 2. 支持环境 - .NET 7.0。 - Visual Studio 2022 ## 3. 当前版本 0.1 ## 4. 链接 官方网站 - Dotnet9:[https://dotnet9.com](https://dotnet9.com) - 快乐玩转技术:[https://dotnet9.com](https://dotnet9.com) ## 5. 项目界面截图 ### 5.1. 关于

关于TerminalMACS

### 5.2. 首页模块 ### 5.3. 服务端模块 ### 5.4. 客户端模块 ### 5.5. 测试案例 收集全球优秀的开源WPF界面设计 以下为2022年收集的案例 --- ## 2022年05月23日 新手引导(MVVM版本) - 参考文章:[WPF 简易新手引导](https://www.cnblogs.com/ZXdeveloper/p/8391864.html) - 参考开源项目:[AIStudio.Wpf.Controls](https://gitee.com/akwkevin/aistudio.-wpf.-controls) ![](./assets/TestDemos/GuidWithMVVM.gif) ## 2022年05月20日 新手引导 - 参考文章:[WPF 简易新手引导](https://www.cnblogs.com/ZXdeveloper/p/8391864.html) ![](./assets/TestDemos/SimpleGuide.gif) ## 2022年05月16日 登录界面5 界面设计 - 参考视频:[Multiple User Login Form | C# WPF](https://www.youtube.com/watch?v=t4Kg62UeSws) - 参考代码:[Multi-login-CSharp-WPF](https://github.com/alihaider11/Multi-login-CSharp-WPF) ![](./assets/TestDemos/login5.gif) ## 2022年05月14日 黑暗模式的钱包支付仪表盘界面设计 - 参考视频:[C# WPF UI | How to Design Dark Mode Wallet Payment Dashboard in WPF](https://www.youtube.com/watch?v=i2cN_JfP9fw) - 参考代码:[WPF-Dark-Wallet-Payment](https://github.com/sajjad-z/WPF-Dark-Wallet-Payment) - 介绍文章:[WPF|黑暗模式的钱包支付仪表盘界面设计](https://dotnet9.com/2022/05/wpf%e9%bb%91%e6%9a%97%e6%a8%a1%e5%bc%8f%e7%9a%84%e9%92%b1%e5%8c%85%e6%94%af%e4%bb%98%e4%bb%aa%e8%a1%a8%e7%9b%98%e7%95%8c%e9%9d%a2%e8%ae%be%e8%ae%a1/) ![](./assets/TestDemos/WalletPayment.gif) ## 2022年05月11日 如何在 WPF 中设计漂亮的社交媒体信息仪表板 - 参考视频:[C# WPF UI | How to Design Beautiful Social Media Info Dashboard in WPF](https://www.youtube.com/watch?v=ZqEj7BcXE9M) - 参考代码:[WPF-Social-Media-Info-Dashboard](https://github.com/sajjad-z/WPF-Social-Media-Info-Dashboard) - 介绍文章:[WPF|如何在 WPF 中设计漂亮的社交媒体信息仪表板](https://dotnet9.com/2022/05/wpf%e5%a6%82%e4%bd%95%e5%9c%a8-wpf-%e4%b8%ad%e8%ae%be%e8%ae%a1%e6%bc%82%e4%ba%ae%e7%9a%84%e7%a4%be%e4%ba%a4%e5%aa%92%e4%bd%93%e4%bf%a1%e6%81%af%e4%bb%aa%e8%a1%a8%e6%9d%bf/) ![](./assets/TestDemos/Dashboar3.gif) ## 2022年05月10日 一个比较摩登的登录界面 - 参考视频:[C# WPF UI | How to Design Modern Login Page in WPF](https://www.youtube.com/watch?v=PoPUB1_q2kE&t=907s) - 介绍文章:[WPF|分享一个登录界面设计](https://dotnet9.com/2022/05/wpf%e5%88%86%e4%ba%ab%e4%b8%80%e4%b8%aa%e7%99%bb%e5%bd%95%e7%95%8c%e9%9d%a2%e8%ae%be%e8%ae%a1/) ![](./assets/TestDemos/ModernLogin.gif) ---- 以下为2022年之前的收集。 **登录注册分类 1** 1. 简单登录窗体设计1 参考视频:[C# WPF Material Design UI: Login Window](https://www.youtube.com/watch?v=gBR1mbMEPnk) 参考源码:[Login2](https://github.com/Abel13/Login2)

简单登录窗体设计1

2. 简单登录窗体设计2 参考视频:[C# WPF Material Design UI: Login Window](https://www.youtube.com/watch?v=9Y2EvautQnM) 参考源码:[Login1](https://github.com/Abel13/Login1)

简单登录窗体设计2

3. 美食应用登录 参考视频:[WPF Food App Login UI Material Design [Speed Design]](https://www.youtube.com/watch?v=1i5oWNvIYmo)

美食应用登录

**菜单类 2** 1. 抽屉式菜单1 参考视频:[C# WPF Material Design UI: Animated Colorful Navigation Drawer](https://www.youtube.com/watch?v=PQFyoKKfstM) 参考源码:[AnimatedColorfulMenu](https://github.com/Abel13/AnimatedColorfulMenu)

抽屉式菜单1

2. 抽屉式菜单2 参考视频:[WPF - Navigation Drawer / Sidebar Menu | UI Design | C# |](https://www.youtube.com/watch?v=fzBcXicj2G8) 参考源码:[Navigation-Drawer-Sidebar-Menu-in-WPF](https://github.com/CSharpDesignPro/Navigation-Drawer-Sidebar-Menu-in-WPF)

抽屉式菜单2

3. 菜单切换用户控件 参考视频:[C# WPF Material Design UI: Fast Food Sales](https://www.youtube.com/watch?v=VNYOKc1PLqA&t=24s) 参考源码:[Pizzaria1](https://github.com/Abel13/Pizzaria1)

菜单切换用户控件

4. 菜单切换动画 参考视频:[C# WPF Material Design UI: Animated Menu](https://www.youtube.com/watch?v=yrnE2Aah4B4&t=23s) 参考源码:[AnimatedMenu1](https://github.com/Abel13/AnimatedMenu1)

菜单切换用户控件

**其他界面设计 3** 1. 移动应用仪表盘 参考视频:[WPF Dashboard UI – Material Design [Speed Design]](https://www.youtube.com/watch?v=h962rCLfGuA&t=282s) 参考源码:[WPF-Dashboard-UI-Material-Design-Concept](https://github.com/vasanthmes/WPF-Dashboard-UI-Material-Design-Concept)

移动应用仪表盘

2. 简易仪表盘2 参考视频:[WPF Dashboard UI – Material Design [Speed Design]](https://www.youtube.com/watch?v=h962rCLfGuA&t=282s) 参考源码:[WPF-Dashboard-UI-Material-Design-Concept](https://github.com/vasanthmes/WPF-Dashboard-UI-Material-Design-Concept) ECharts:[pie-doughnut](https://echarts.apache.org/examples/zh/editor.html?c=pie-doughnut)

简易仪表盘2

3. Instagram重新设计 参考视频:[C# WPF Material Design UI: Redesign Instagram](https://www.youtube.com/watch?v=X-FcXgDnglA&t=39s) 参考源码:[Instagram](https://github.com/Abel13/Instagram)

Instagram重新设计

4. LoLGoal 参考视频:[dotnet9](https://dotnet9.com/7026.html) 参考源码:[dotnet9](https://dotnet9.com/7026.html)

LoLGoal

5. 简易音乐播放器1 参考视频:[C# WPF Material Design UI: Dashboard](https://www.youtube.com/watch?v=sgEhK3mbDYo&t=26s) 参考源码:[Dashboard](https://github.com/Abel13/Dashboard1)

简易音乐播放器1

6. 百度地图

百度地图

6. 聊天界面设计 参考视频: - [C# WPF Design UI – 1/3 – Contact List](https://www.youtube.com/watch?v=SzPj59ioTNc) - [C# WPF Design UI – 2/3 – Profile](https://www.youtube.com/watch?v=wkoXTj2UgzM) - [C# WPF Design UI – 3/3 – Chat](https://www.youtube.com/watch?v=834UHMisrxw&t=25s) 参考源码:[Chat](https://github.com/Abel13/Chat/tree/chat/Chat)

聊天界面设计

7. 计算器 参考视频: - [Calcalator](https://www.youtube.com/watch?v=G76O79eLcKM)

计算器

## 更新记录 ### 2020-11-15 添加快捷应用:src\Tools\QuickApp 参考开源项目: https://github.com/yanjinhuagood/SoftWareHelper 文章 https://www.cnblogs.com/yanjinhua/p/13896894.html Dotnet9站点介绍文章:https://dotnet9.com/16722.html ![快捷应用](https://git.imweb.io/dotnet9/imgs/raw/c8b4d01d9020e44184055b1863d6434a7e0b4c1d/dotnet9_com/wp-content/uploads/2020/11/11_run_horizontal_choice_app.gif) 功能: 1. ☑菜单通过配置文件配置,因为操作系统可能装了太多应用,不需要全部加载。 后面计划改成sqlite数据库存储: ```json { "IsPowerOn": true, "MenuItemInfos": [ { "FilePath": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", "IconPath": null, "Name": "Google Chrome", "Type": 0 }, { "FilePath": "https://dotnet9.com/", "IconPath": "logo.png", "Name": "Dotnet9", "Type": 1 }, { "FilePath": "mstsc /v:192.168.1.133", "IconPath": "shell.png", "Name": "192.168.1.133", "Type": 2 } ] } ``` 2. ☑支持exe拖拽(或者系统生成的快捷方式拖拽)添加。 ```C# private void Grid_Drop(object sender, DragEventArgs e) { try { var fileName = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString(); MenuItemInfo menuItem = new MenuItemInfo() { FilePath = fileName }; // 快捷方式需要获取目标文件路径 if (fileName.ToLower().EndsWith("lnk")) { WshShell shell = new WshShell(); IWshShortcut wshShortcut = (IWshShortcut)shell.CreateShortcut(fileName); menuItem.FilePath = wshShortcut.TargetPath; } ImageSource imageSource = SystemIcon.GetImageSource(true, menuItem.FilePath); System.IO.FileInfo file = new System.IO.FileInfo(fileName); if (string.IsNullOrWhiteSpace(file.Extension)) { menuItem.Name = file.Name; } else { menuItem.Name = file.Name.Substring(0, file.Name.Length - file.Extension.Length); } menuItem.Type = MenuItemType.Exe; if (ConfigHelper.AddNewMenuItem(menuItem)) { var btn = AddMenuItem(menuItem); fishButtons.Children.Add(btn); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void Grid_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effects = DragDropEffects.Link; } else { e.Effects = DragDropEffects.None; } } ``` ```json { "FilePath": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", "IconPath": null, "Name": "Google Chrome", "Type": 0 } ``` 3. ☑支持网址配置(点击打开指定网址,类似网页收藏快捷方式)。 ```json { "FilePath": "https://dotnet9.com/", "IconPath": "logo.png", "Name": "Dotnet9", "Type": 1 } ``` ```C# else if (menuItem.Type == MenuItemType.Web) { Process.Start(new ProcessStartInfo("cmd", $"/c start {menuItem.FilePath}") { UseShellExecute = false, CreateNoWindow = true }); } ``` 4. ☑支持cmd命令配置(比如系统应用mstsc,远程桌面配置目标IP及端口,一键打开连接等) ```json { "FilePath": "mstsc /v:192.168.1.133", "IconPath": "shell.png", "Name": "192.168.1.133", "Type": 2 } ``` ```C# else if( menuItem.Type == MenuItemType.Cmd) { Process p = new Process(); p.StartInfo.FileName = "cmd"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; p.Start(); p.StandardInput.WriteLine($"{menuItem.FilePath} &exit"); p.StandardInput.AutoFlush = true; p.WaitForExit(); p.Close(); } ``` 5. ☒提供界面配置菜单 6. ☒显示图标与文字 ...更多想法还在想 ### 2020-11-16 添加DotNetty服务端与客户端:src\Tools\NettyTest 公司项目有使用到DotNetty与java端Netty项目通信,所以花时间整了这个demo,打算一直维护下去。 功能: - 服务端和客户端都采用 C# + WPF开发