shaoshao
茶飘香,酒罢去,聚朋友,再回楼。
Your story may not have such a happy beginning,
but that doesn’t make who you are.
It’s the rest of your story,who you choose to be.
为天地立心,为生民立命,为往圣继绝学,为万世开太平。
你不是父母续集,子女的前传,朋友的番外。你不妨大胆点生活,不要因为没有掌声而丢掉梦想,不要因为看不清前路而轻易放弃。我相信你生来就是高山,而非溪流。亲爱的,勇敢而热烈的活着吧。
2023新春快乐!
2023新春快乐!
旧岁千般皆如意,新年万事定称心!
.Net/C#读取CAD软件dwg数据表实体
.Net/C#读取CAD软件dwg数据表实体使用ACadSharp库读取CAD软件dwg数据表实体
文末附ACadSharp.dll库文件及源码
CadDocReader123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124using ACadSharp;using ACadSharp.Entities;using ACadSharp.IO;using CSMath;using System.Text.RegularExpressions;namespace NCad.Toolkits{ int ...
Arcpy 登录Portal:Unable to connect ArcGIS Online.
Arcpy 登录Portal:Unable to connect ArcGIS Online.1234import arcpyarcpy.SignInToPortal("https://wc.geoscene.cn/portal","portaladmin","1qaz2wsx")print("success")
Traceback (most recent call last): File “/opt/shao/tpy.py”, line 3, in arcpy.SignInToPortal(“https://***/portal”,”portaladmin”,”***“) File “C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\Resources\ArcPy\arcpy_init_.py”, line 2483, in SignInToPortal ret ...
ArcGIS Pro DAML ID Reference
ADCore.damlcontrols
button
comboBox
checkBox
customControl
dynamicMenu
editBox
labelControl
spinner
tool
categories
conditions
dockpanes
galleries
groups
insertsheet
menus
minitoolbars
modules
palettes
buttonPalette
toolPalette
panes
propertysheets
splitbuttons
subgroups
tabgroups
tabs
toolbars
controls
button
Name: Add To FavoritesID: esri_addFavoriteButtonCondition: esri_projectItem_isValidAndOpenProjectCondition
Name: Add To New Projec ...
Nlog 配置文件说明
Nlog 配置文件说明123456789101112131415161718192021222324252627282930313233343536373839404142<?xml version="1.0" encoding="utf-8" ?><nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" autoReload="true" throwExceptions="false" internalLogLevel="OFF" internal ...
方向分布(标准差椭圆)算法
方向分布(标准差椭圆)算法计算过程
计算平均/加权平均中心
计算加全协方差矩阵
计算协方差矩阵的特征值与特征向量
计算椭圆长轴和短轴
计算旋转角度
Python实现引库1234import numpy as npimport matplotlib.pyplot as pltfrom matplotlib.patches import Ellipsefrom scipy.stats import chi2
二维点测试数据1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261 ...
Prism(八) 导航
Prism(八) 导航源码地址 - WineMonk/PrismStudy: Prism框架学习 (github.com)
导航基础视图ViewA/B.xaml
12345678910<UserControl x:Class="ModuleA.Views.ViewA" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:prism="http://prismlibrary.com/" prism:ViewModelLocator.AutoWireViewModel="True"> <StackPanel> ...
Prism(七) 区域上下文
Prism(七) 区域上下文源码地址 - WineMonk/PrismStudy: Prism框架学习 (github.com)
人物ModelPerson.cs
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465public class Person : INotifyPropertyChanged{ #region Properties private string _firstName; public string FirstName { get { return _firstName; } set { _firstName = value; OnPropertyChanged(); } ...
Prism(六) 事件聚合器
Prism(六) 事件聚合器源码地址 - WineMonk/PrismStudy: Prism框架学习 (github.com)
事件聚合器
事件发布模块MessageView.xaml
12345678910<UserControl x:Class="ModuleA.Views.MessageView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:prism="http://prismlibrary.com/" prism:ViewModelLocator.AutoWireViewModel="True" Padding="25&qu ...
Prism(五) 命令
Prism(五) 命令源码地址 - WineMonk/PrismStudy: Prism框架学习 (github.com)
委托命令MainWindow.xaml
123456789101112131415<Window x:Class="UsingDelegateCommands.Views.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:prism="http://prismlibrary.com/" prism:ViewModelLocator.AutoWireViewModel="True" Title="Using DelegateCommand" ...
Prism(四) 视图模型定位器
Prism(四) 视图模型定位器源码地址 - WineMonk/PrismStudy: Prism框架学习 (github.com)
视图模型定位器在 Prism 中,视图模型定位器(ViewModelLocator)是一种设计模式,用于自动将视图(View)和视图模型(ViewModel)进行关联。这种关联是通过在 XAML 中使用特定的命名约定来实现的,而不需要显式地指定视图模型。
Prism 的视图模型定位器通常使用 XAML 的附加属性(Attached Properties)来实现。这些附加属性告诉 Prism 在加载视图时,应该使用哪个视图模型。
以下是一个简单的示例,展示了如何在 Prism 中使用视图模型定位器:
123456789<UserControl x:Class="MyNamespace.Views.MyView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: ...
Prism(三) 模块配置
Prism(三) 模块配置源码地址 - WineMonk/PrismStudy: Prism框架学习 (github.com)
模块ModuleAModule.cs
12345678910111213public class ModuleAModule : IModule{ public void OnInitialized(IContainerProvider containerProvider) { var regionManager = containerProvider.Resolve<IRegionManager>(); regionManager.RegisterViewWithRegion("ContentRegion", typeof(ViewA)); } public void RegisterTypes(IContainerRegistry containerRegistry) { }} ...
Prism(二)视图
Prism(二)视图源码地址 - WineMonk/PrismStudy: Prism框架学习 (github.com)
视图发现MainWindow.xaml
123456789<Window x:Class="ViewDiscovery.Views.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:prism="http://prismlibrary.com/" Title="Shell" Height="350" Width="525"> <Grid> <ContentControl prism:Regi ...
Prism(一)框架使用
Prism(一)框架使用源码地址 - WineMonk/PrismStudy: Prism框架学习 (github.com)
引入prism框架使用启动加载器12345678910public partial class App : Application{ protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var bootstrapper = new Bootstrapper(); bootstrapper.Run(); }}
123456789101112class Bootstrapper : PrismBootstrapper{ protected override DependencyObject CreateShell() { return Container.Resolve<MainWindow>(); ...
WPF国际化
WPF国际化环境:VisualStudio2022
ResXManager 1.84.6269.0
实现方法step1:安装VisualStudio扩展工具 - ResXManager
step2:创建资源文件
step3:设置访问级别
step4:打开 ResXManager
step5:设置/添加语言
step6:添加语言管理类123456789101112131415161718192021222324252627282930313233343536373839404142434445public class LanguageManager : INotifyPropertyChanged{ /// <summary> /// 资源 /// </summary> private readonly ResourceManager _resourceManager; /// <summary> /// 懒加载 /// </summary> private stat ...
Socket 套接字
Socket 套接字
xaml123456789101112131415161718192021222324252627282930313233343536<Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition Width="2*" /> </Grid.ColumnDefinitions> <StackPanel Margin="10"> <TextBlock Text="IP" /> <TextBox x:Name="textBoxIP" Text="127.0.0.1" /> <TextBlock Text="端口" /> <TextBox x:Name=" ...
(Config文件)自动配置组件
Config配置文件自动配置组件12345678910111213141516171819/// <summary>/// 配置上下文接口/// </summary>public interface IConfigurationContext{ /// <summary> /// 重载 /// </summary> void Reload(); /// <summary> /// 持久化 /// </summary> void Persistent(); /// <summary> /// 获取持久化路径 /// </summary> /// <returns>持久化路径</returns> string GetPersistentPath();}
12345678/// <summary>/// 配置转换器接口/// </summary>p ...
WPF: NotSupportedException: The URI prefix is not recognized.
WPF: NotSupportedException: The URI prefix is not recognized.1.如果你有MyWindow的源代码,添加前缀pack://application:,,,
1_dictionary.Source = new Uri("pack://application:,,,/RibbonControlsLibrary;component/Themes/RibbonWindow.xaml", UriKind.Relative);
2.如果MyWindow是第三方提供的,你就需要在new MyWindow()之前加上下面的语句:
12System.Windows.Application app = new System.Windows.Application();app.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
分析Applicaiton的源代码其实就会发现,在它的静态构造函数中有下面的代码:
123// Add an ...
Visual Studio 离线安装
(1)先进官网下载链接,下载安装包引导程序。(2)可以在D盘新建一个文件夹VS2019,将下载好的.exe文件保存到该文件夹中,然后可以在VS2019文件夹内再新建一个installer文件夹,用于存放后面下载的各种离线包。(3)在上述文件夹目录下打开终端,输入:
1.\vs_2019_community.exe --layout .\vs_installer --add Microsoft.VisualStudio.Workload.ManagedDesktop --includeRecommended --lang zh-CN
大致讲解以下,我这里面命令的意思:
12--layout 后面是需要下载离线包的路径。这里选择的是当前目录下的installer文件夹。--add 是微软官方设计的添加各种工作负荷或者组件ID。
常用到几个工作负荷ID有:
1234567ID: Microsoft.VisualStudio.Workload.CoreEditor Visual Studio 核心编辑器ID: Microsoft.VisualStudio.Workload.M ...
CSharp == 字符串比较
CSharp == 字符串比较123456789101112131415161718192021string a = null;string b = null;bool v = a == b;AppLogger.Instance.Information($"null==null : {v}");b = string.Empty;v = a == b;AppLogger.Instance.Information($"null==Empty : {v}");a = string.Empty;v = a == b;AppLogger.Instance.Information($"Empty==Empty : {v}");string a1 = new string(a);v = a == b;AppLogger.Instance.Information($"new string Empty==Empty : {v}" ...
命令行Tab自动补全
Windows命令行Tab自动补全
使用win+r打开 运行 控制台
输入 regedit 打开注册表
进入HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\CompletionChar 将值改为十进制的 9 ;点击确定
以后运行CMD的时候 输入首字母按住 TAB键就能自动补全输入的命令了。