Force more aggressive wrapping of text in a WPF FlowDocument

I’ve got a WPF application and I want to display some text with a little icon preceding it. The text must wrap around. I’ve got the following code working that does most of what I want (the code should work if you put it in a new WPF view): <FlowDocumentScrollViewer HorizontalScrollBarVisibility=”Hidden” VerticalScrollBarVisibility=”Hidden”> <FlowDocument IsHyphenationEnabled=”False” IsOptimalParagraphEnabled=”False” PagePadding=”0″ TextAlignment=”Left” ScrollViewer.CanContentScroll=”False” ScrollViewer.VerticalScrollBarVisibility=”Hidden” SelectiveScrollingGrid.SelectiveScrollingOrientation=”None”…
Read more

How to get the permission

I got the roleid from some operation. How could i know what is the permissions from it? for example: 107374182731GUIDOP What is the permission “1073741827” represent? Source: .net

usesystemdefault is not working in web.config

I was using HttpClient behind a firewall, so I want to use my IE proxy for the HttpClient. But when I set <system.net> <defaultProxy enabled=”true”> <proxy autoDetect=”true” usesystemdefault=”true”></proxy> </defaultProxy> <settings> </settings> </system.net> in my web.config, then use WebRequest.DefaultProxy to get the proxy, the proxy is still blank in both the ProxyAddress and the ScriptEngine. Could anyone help me figure out…
Read more

Creating unit tests for .net5 projects

Trying to move from .Net4.5 to .Net5, so i have created my solution, which consists of folders called “Solution Items” and “src”. I have managed to get 3 projects building using .NET 5. I had to create the projects as “Class Library (Package) – PREVIEW – A project template for creating a class library as a NuGet package that can…
Read more

XML Attribute Update

I have an XML similar to this : <?xml version=”1.0″ encoding=”utf-8″?> <Configuration> <Format_Version>1.0</Format_Version> <Reporting> </Reporting> <Jobs> <!–<Job> <Name>SpaceCheck</Name> <Job_Type>SpaceCheck</Job_Type> <Schedule> <Start_Time>0300</Start_Time> <Frequency>24 hours</Frequency> <Max_Run_Time_In_Seconds>10</Max_Run_Time_In_Seconds> </Schedule> <Parameters> <Drive>C</Drive> <Drive>D</Drive> </Parameters> </Job> <Job> <Name>CPUCheck</Name> <Job_Type>UsageMonitor</Job_Type> <Schedule> <Frequency>3 minutes</Frequency> </Schedule> <Parameters> <Threshold>90%</Threshold> <Duration>10 minutes</Duration> </Parameters> </Job> <Job> <Name>overloaded CPUCheck</Name> <Job_Type>CPUcheck2</Job_Type> <Schedule> <Frequency>3 minutes</Frequency> </Schedule> <Parameters> <Threshold>80%</Threshold> <Duration>50 minutes</Duration> </Parameters> </Job>–> <Job> <Name>Connection</Name> <Job_Type>Connectivity</Job_Type>…
Read more

System.TypeAccessException: Attempt by method ‘X’ to access type ‘Y’ failed

Ok, I have googled this for almost two days and I have tried almost all SO solutions that are related to this error, but nothing works. And most questions about this are for Security ssettings on Click-once applications, JSON, web applications etc. But nothing for a plain old winforms app. Here is the full error System.TypeAccessException: Attempt by method ‘Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterSystemSetup.Write3_SystemSetup(System.Object)’…
Read more

Extracting zip file with nested files containing dots and spaces

i got this following zip file name System Update 1.2.4.zip The file structure inside the file is as following: System Update 1.2.4 Files Software Changelog.txt I’m using the following line to extract my file ZipFile.ExtractToDirectory(zipPath, extractPath); The zipPath and extractPath is correct, but i’m getting the following error: An unhandled exception of type ‘System.IO.IOException’ occurred in System.IO.Compression.FileSystem.dll Additional information: Zip…
Read more

SoapException System.Data.SqlClient missing or not registered / loaded

I had to move an old existing application to a new application server (Windows 2012). Unfortunately, when starting the application and searching for an entity, it shows the following error message: System.Web.Services.Protocols.SoapException: Server was unable to process request. —> System.ArgumentException: The ADO.NET provider with invariant name ‘System.Data.SqlClient’ is either not registered in the machine or application config file, or could…
Read more

How to check if printer is in network?

public bool IsPrinterReady(string PrinterName) { ManagementScope scope = new ManagementScope(@”rootcimv2″); scope.Connect(); ManagementObjectSearcher searcher = new ManagementObjectSearcher(“select * from Win32_Printer”); string strPrinter = string.Empty; foreach(ManagementObject printer in searcher.Get()) { strPrinter = printer[“Name”].ToString(); if(strPrinter.ToLower() == PrinterName.ToLower()) return printer[“PrinterStatus”].ToString().ToLower().Equals(“3”); } return false; } I am using the code to check if my printer is in network. When I hit the Print button the…
Read more

How to send a ‘ajax’ post request using httpwebrequest in C#?

I have the following request-header taken from firebug on clicking a button on a webpage(the url doesn’t change, so it is an ajax post request!) Accept :text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding :gzip, deflate Accept-Language :en-US,en;q=0.5 Cache-Control :no-cache Connection :keep-alive Content-Length :725 Content-Type :application/x-www-form-urlencoded;charset=UTF-8 Cookie :language=en_IN; _ga=GA1.3.184236920.1443720063;__gads=ID=9a55686039c6e6f0:T=1443720047:S=ALNI_MaWPaHUEUBgf-Zf7qdtCfl0jdtTcQ; JSESSIONID=nnMsc6NkqzXSgHXQ0DaNuHLwMl0OLChvEiv2hxBtunG22tmF_rTB!-30889781; SLB_Cookie=ffffffff09461c2745525d5f4f58455e445a4a422972; _gat_UA-57718223-1=1; _gat_UA-57718223-3=1 Faces-Request :partial/ajax Host :www.example.com Pragma :no-cache Referer :https://www.example.com/photography/homepage.jsf User-Agent :Mozilla/5.0 (Windows NT 10.0;…
Read more