草庐IT

application-icon

全部标签

c# - 将 VB 转换为 C# - My.Application.Info.DirectoryPath

以下VB(VB.NET、VisualBasic)语句的最佳C#(csharp)等价物是什么:My.Application.Info.DirectoryPathMy.Computer.ClipboardMy.Computer.Audio.PlaySystemSound()My.Application.Shutdown() 最佳答案 应用程序.ExecutablePath系统.Windows.Forms.剪贴板系统.媒体.*应用程序.退出 关于c#-将VB转换为C#-My.Applicati

c# - 无法处理消息,因为内容类型 'application/json; charset=utf-8' 不是预期的类型 'text/xml; charset=utf-8'

我在通过ajaxjson调用WCF服务时收到上述响应。我的调用代码是:$(document).ready(function(){$.ajax({type:"POST",contentType:"application/json;charset=utf-8",url:"http://localhost:90/WebServices/UserService.svc/Calculate",data:"{}",timeout:10000,dataType:"json",success:function(response){alert(response)},error:function(xhr,

C#.NET : Convert Icon to byte[] and back again

如何在System.Drawing.Icon类型和byte[]之间进行转换?我正在寻找可以(希望)在.NET2中工作的简单方法。 最佳答案 你通过MemoryStream,基本上:publicstaticbyte[]IconToBytes(Iconicon){using(MemoryStreamms=newMemoryStream()){icon.Save(ms);returnms.ToArray();}}publicstaticIconBytesToIcon(byte[]bytes){using(MemoryStreamms=ne

c# - 不能包含 Microsoft.Security.Application?

我不能包含Microsoft.Security.ApplicationusingMicrosoft.Security.Application;给出这个错误:Thetypeornamespacename'Security'doesnotexistinthenamespace'Microsoft'(areyoumissinganassemblyreference?)是的,我点击了Bin->AddReference...->AntiXSSLibrary.dll并将其添加到包含AntiXSSLibrary.xml的Bin文件夹中。我重建了整个网站,但仍然一无所获。我正在使用ASP.NET3.5

c# - 如何从资源文件获取图像到 WPF menuitem.icon

我有以下代码(XAMLC#)://Iwanttoinsertimagehere还有一个名为images.resx的资源文件,其中包含一个名为lang.png的图像。如何插入图像作为菜单项的图标?有没有更好的办法? 最佳答案 正如Jason所说,最好将图像作为资源添加到项目中。打开项目的“属性”选择垂直标签资源从左侧组合框中选择图片从右侧的ComboBox中选择“添加资源->添加现有文件...”找到您要使用的图像,例如“C1.png”(它将自动复制到项目根目录中的Resources文件夹)在您新添加的资源图片上选择属性在属性中,将构建

c# - 全局异常过滤器或 Application_Error 都没有捕获未处理的异常

我有一个名为LogErrorAttribute的全局异常过滤器:publicclassLogErrorAttribute:IExceptionFilter{privateILogUtilslogUtils;publicvoidOnException(ExceptionContextfilterContext){if(this.logUtils==null){this.logUtils=StructureMapConfig.Container.GetInstance();}this.logUtils.LogError(HttpContext.Current.User.Identity.G

c# - SharePoint 错误 : Web application at xxxx could not be found

当我尝试执行这段代码时:SPSitesiteCollection=newSPSite(@"http://sp-devxxx:10000/");它抛出以下错误:TheWebapplicationathttp://sp-devxxx:10000couldnotbefound.VerifythatyouhavetypedtheURLcorrectly.IftheURLshouldbeservingexistingcontent,thesystemadministratormayneedtoaddanewrequestURLmappingtotheintendedapplication.我可以

c# - 将 Application Insights 与单元测试结合使用?

我有一个MVC网络应用程序,我正在使用SimpleInjectorforDI。单元测试几乎覆盖了我所有的代码。但是,现在我已经在一些Controller中添加了一些遥测调用,我在设置依赖项时遇到了问题。遥测调用用于将指标发送到MicrosoftAzure托管的ApplicationInsights服务。该应用程序不在Azure中运行,只是一个带有ISS的服务器。AI门户告诉您有关应用程序的各种信息,包括您使用遥测库发送的任何自定义事件。因此,Controller需要一个Microsoft.ApplicationInsights.TelemetryClient的实例,它没有接口(inte

c# - 如何公开 Application.Properties.Settings 并保持这种状态

我正在将我的应用程序设置集中到一个位置,我选择使用我的公共(public)库中的设置集合来完成此操作。我已将所有这些设置移动到它们自己的文件中,该文件使用配置源拉入我的app.config中:这让我可以使用VisualStudio的“添加链接”功能,在我的Web和测试应用程序中使用导入的配置文件覆盖默认库设置。现在,我希望能够从我的其他库中访问所有这些很棒的设置值,并且发现我可以通过公开生成的类来简单地做到这一点:文件:Common.Properties.SettingspublicsealedpartialclassSettings:global::System.Configurat

c# - 如何在 WPF 中使用 Application.Exit 事件?

我需要删除某些文件,然后用户关闭了WPF中的程序。所以我从这里尝试了MDSN代码http://msdn.microsoft.com/en-us/library/system.windows.application.exit.aspx这样:此代码位于App.xml.cspublicpartialclassApp:Application{voidApp_Exit(objectsender,ExitEventArgse){MessageBox.Show("Filedeleted");varsystemPath=System.Environment.GetFolderPath(Environm