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新春快乐!
旧岁千般皆如意,新年万事定称心!
C#获取系统目录
C#获取系统目录1Environment.GetFolderPath(Environment.SpecialFolder specialFolder)
枚举项
值
说明
AdminTools
48
用于存储各个用户的管理工具的文件系统目录。 Microsoft Management Console (MMC) 会将自定义的控制台保存在此目录中,并且此目录将随用户一起漫游。
ApplicationData
26
用作当前漫游用户的应用程序特定数据的公共储存库的目录。 漫游用户在网络上的多台计算机上工作。 漫游用户的配置文件保留在网络服务器上,并在用户登录时加载到系统中。
CDBurning
59
充当等待写入 CD 的文件的临时区域的文件系统目录。
CommonAdminTools
47
包含计算机所有用户的管理工具的文件系统目录。
CommonApplicationData
35
用作所有用户使用的应用程序特定数据的公共储存库的目录。
CommonDesktopDirectory
25
包含在所有用户桌面上出现的文件和文件夹的文件系统目录。
Com ...
C#判断程序是否为管理员权限启动
C# 判断程序是否为管理员权限启动123456bool IsAdministrator(){ WindowsIdentity current = WindowsIdentity.GetCurrent(); WindowsPrincipal windowsPrincipal = new WindowsPrincipal(current); return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);}
C#创建快捷方式
C#创建快捷方式123456789101112131415161718192021222324252627282930//实例化WshShell对象WshShell shell = new WshShell();//通过该对象的 CreateShortcut 方法来创建 IWshShortcut 接口的实例对象IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut( Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "//ShortCut.lnk");//设置快捷方式的目标所在的位置(源程序完整路径)shortcut.TargetPath = proInstallDir+ "\\bin\\ArcGISPro.exe";//应用程序的工作目录//当用户没有指定一个具体的目录时,快捷方式的目标应用程序将使用该属性所指定的目录来装载或保存文件。shortcut.WorkingDirectory = proIns ...
RegistryKey 读取注册表信息
RegistryKey 读取注册表信息RegistryKey读取注册表,明明看得到却读不到?
不要直接使用:
1var localMachineKey = Registry.LocalMachine;
而是使用如下与计算机位数相关的代码
12var useRegistryView = Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32; var localMachineKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, useRegistryView);
SkiaSharp 初探
SkiaSharp 初探有个 .Net Framework 4.x 的项目需要升级到 .Net 6,升级过后发现 System.Drawing.dll 库相关功能模块会报错:
Could not load file or assembly ‘System.Drawing.Common, Version=7.0.0.0, Culture=neutral,PublicKeyToken=cc7b13ffcd2ddd51’.系统找不到指定文件。
因为 System.Drawing 对跨平台不支持,只支持Windows系统,.Net 6 貌似不再支持。
于是使用 SkiaSharp 代替。
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 ...
Neo4j初探
Neo4j 初探Create下边是一个巨大的代码块,其中包含由多个 CREATE 子句组成的单个 Cypher 查询语句。这将创建电影图形。
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 ...
C#读写config配置文件
C#读写config配置文件12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970public static class ConfigHelper{ public static LocalConfig _LocalConfig = null; static ConfigHelper() { _LocalConfig = new LocalConfig(); }}public class ConfigBase{ protected Configuration configObject; public ConfigBase(string configFilePath) { ExeConfigurationFileMap fileMap = new ExeCo ...
Git-报错 error: bad signature 0x00000000 fatal: index file corrupt
Git- 报错 error: bad signature 0x00000000 fatal: index file corrupt解决方案:
123rm -f .git/index git reset
WPF数据模板
DataGrid 数据模板12345678910111213141516171819<DataGrid SelectedItem="{Binding SelectHexoPost}" AutoGenerateColumns="False" VerticalContentAlignment="Center" IsReadOnly="True" CanUserSortColumns="True" CanUserAddRows="False" ItemsSource="{Binding HexoPosts}"> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding Id}" Width="0.3*" Header="ID"/&g ...
C#中Brush、Color、String相互转换
C#中Brush、Color、String相互转换1、String转换成Color
Color color = (Color)ColorConverter.ConvertFromString(string);
2、String转换成Brush
BrushConverter brushConverter = new BrushConverter(); Brush brush = (Brush)brushConverter.ConvertFromString(string);
3、Color转换成Brush
Brush brush = new SolidColorBrush(color));
4、Brush转换成Color有两种方法:
(1)先将Brush转成string,再转成Color。
Color color= (Color)ColorConverter.ConvertFromString(brush.ToString());
(2)将Brush转成SolidColo ...
ArcGIS Pro SDK 汇总
框架如何在停靠窗格可见或隐藏时订阅和取消订阅事件1234567891011121314151617181920private SubscriptionToken _eventToken = null;// Called when the visibility of the DockPane changes.protected override void OnShow(bool isVisible){ if (isVisible && _eventToken == null) //Subscribe to event when dockpane is visible { _eventToken = MapSelectionChangedEvent.Subscribe(OnMapSelectionChangedEvent); } if (!isVisible && _eventToken != null) //Unsubscribe as the dockpane closes. { MapSel ...
ArcGIS Pro SDK 工作流管理器
工作流管理器如何获取管理器对象12345// WorkflowModule.GetManager returns a manager of the type specified// keyword is currently just an empty stringvar wfCon = await WorkflowModule.ConnectAsync();var jobManager = wfCon.GetManager<JobsManager>();var configManager = wfCon.GetManager<ConfigurationManager>();
如何获取群组1234// GetAllGroups returns a list of Workflow Manager groupsvar wfCon = await WorkflowModule.ConnectAsync();var configManager = wfCon.GetManager<ConfigurationManager>();var allGroups ...
ArcGIS Pro SDK 任务
任务检索项目中的所有任务项12345IEnumerable<TaskProjectItem> taskItems = Project.Current.GetItems<TaskProjectItem>();foreach (var item in taskItems){ // do something}
打开任务文件 - .esriTasks 文件12345678910111213141516// Open a task filetry{ // TODO - substitute your own .esriTasks file to be opened string taskFile = @"c:\Tasks\Get Started.esriTasks"; //At 2.x - //System.Guid guid = await TaskAssistantModule.OpenTaskAsync(taskFile); var guid = await TaskAssistantFactory.I ...
ArcGIS Pro SDK 实时要素类
实时要素类从实时数据存储连接到实时要素类12345678910111213141516171819202122var url = "https://geoeventsample1.esri.com:6443/arcgis/rest/services/AirportTraffics/StreamServer"; await QueuedTask.Run(() =>{ var realtimeServiceConProp = new RealtimeServiceConnectionProperties( new Uri(url), RealtimeDatastoreType.StreamService ); using (var realtimeDatastore = new RealtimeDatastore(realtimeServiceCo ...
ArcGIS Pro SDK 订阅和搜索
订阅和搜索搜索和订阅流数据123456789101112131415161718192021222324252627282930313233343536373839404142434445464748await QueuedTask.Run(async () =>{ //query filter can be null to search and retrieve all rows //true means recycling cursor using (var rc = streamLayer.SearchAndSubscribe(qfilter, true)) { //waiting for new features to be streamed //default is no cancellation while (await rc.WaitForRowsAsync()) { while (rc.MoveNext()) { using (var row = rc.Cur ...
ArcGIS Pro SDK 渲染
渲染定义唯一值呈现器定义1234567891011var uvrDef = new UniqueValueRendererDefinition(){ ValueFields = new List<string> { "ACTYPE" }, SymbolTemplate = SymbolFactory.Instance.ConstructPointSymbol( ColorFactory.Instance.RedRGB, 10, SimpleMarkerStyle.Hexagon) .MakeSymbolReference(), ValuesLimit = 5};//Note: CreateRenderer can only create value classes based on//the current events it has receivedstreamLayer.SetRenderer(streamLayer.CreateRenderer(uvrDef));
为最新观测值设置唯一 ...
ArcGIS Pro SDK 流图层
流图层创建流图层使用 URI 创建流图层123456789101112//Must be on the QueuedTaskvar url = "https://geoeventsample1.esri.com:6443/arcgis/rest/services/AirportTraffics/StreamServer";var createParam = new FeatureLayerCreationParams(new Uri(url)){ IsVisible = false //turned off by default};var streamLayer = LayerFactory.Instance.CreateLayer<StreamLayer>(createParam, map);//or use "original" create layer (will be visible by default)Uri uri = new Uri(url);streamLayer = LayerFactory. ...
ArcGIS Pro SDK 场景图层
场景图层创建场景图层123456789101112131415161718192021var sceneLayerUrl = @"https://myportal.com/server/rest/services/Hosted/SceneLayerServiceName/SceneServer";//portal items also ok as long as the portal is the current active portal...//var sceneLayerUrl = @"https://myportal.com/home/item.html?id=123456789abcdef1234567890abcdef0";await QueuedTask.Run(() =>{ //Create with initial visibility set to false. Add to current scene var createparams = new LayerCreationParams(new Uri(s ...
ArcGIS Pro SDK 光栅
光栅在文件夹中打开栅格数据集123456// Create a FileSystemConnectionPath using the folder path.FileSystemConnectionPath connectionPath = new FileSystemConnectionPath(new System.Uri(@"C:\Temp"), FileSystemDatastoreType.Raster);// Create a new FileSystemDatastore using the FileSystemConnectionPath.FileSystemDatastore dataStore = new FileSystemDatastore(connectionPath);// Open the raster dataset.RasterDataset fileRasterDataset = dataStore.OpenDataset<RasterDataset>("Sample.tif");
在地理数据库中 ...
ArcGIS Pro SDK 宗地结构
宗地结构获取活动记录1234567891011121314151617181920string errorMessage = await QueuedTask.Run(() =>{ try { var myParcelFabricLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<ParcelLayer>().FirstOrDefault(); //if there is no fabric in the map then bail if (myParcelFabricLayer == null) return "There is no fabric in the map."; var theActiveRecord = myParcelFabricLayer.GetActiveRecord(); if (theActiveRecord == null) return "There is no A ...