【c# – 简单注入器 – Windows窗体示例已损坏】教程文章相关的互联网学习教程文章

c# – Windows表单加载然后退出【代码】

我正在为超市创建一个结账系统.它由结账,服务器和MIS程序组成,它们之间运行WCF服务.我遇到的问题是结帐程序,它是一个Windows窗体,在它的application_load方法中做了一些必要的事情,然后就退出了. 这是代码:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CheckoutLibrary; u...

c# – Windows 8 Metro:ListView忽略ItemTemplate【代码】

我正在关注this教程,但我遇到了一个奇怪的问题.有一部分说:In SplitPage.xaml, we also update the ItemTemplate property in itemListView to use our DefaultListItemTemplate resource instead of Standard130ItemTemplate, which is the default template. Here’s the updated XAML for itemListView.但是,无论我做什么,它都会显示带有默认模板的列表,看起来像this.这是我的代码:<DataTemplate x:Key="DefaultListItemTempl...

c# – 如何在Windows8应用程序中刷新页面和内容【代码】

所以我有一个Windows 8应用程序,我在其中设置一些数据到defaultViewModel.我的问题是,在页面创建之后,我向数据添加了一些内容,如何刷新页面并显示所做的更改?protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState){ //inital loadvar DataGroups = SampleDataSource.GetGroups((String)navigationParameter);this.DefaultViewModel["Items"] = DataGroups; ...

c# – Windows应用商店应用 – 枚举字体

如何枚举Windows应用商店应用中的所有已安装字体? System.Windows.Media.Fonts命名空间不再可用.解决方法:你必须使用DirectWrite.见DirectWrite font enumeration sample

c# – 如何在Windows Azure上设置Websocket连接?

Azure是否支持使用WebSockets for .NET,如果是这样,如何启动和处理Websocket连接?解决方法:Azure网站现在支持Web套接字.要使用它们,请转到管理门户中的“站点配置”页面,然后启用Web套接字.

c# – Windows Server证书服务总线无法验证【代码】

使用Service Bus for Windows Server 我得到以下例外.Message=The X.509 certificate CN=*********** is not in the trustedpeople store. The X.509 certificate CN=******** chain building failed.The certificate that was used has a trust chain that cannot beverified. Replace the certificate or change thecertificateValidationMode. The signature of the certificate cannot beverified.我想从我的开发盒连接另一台计...

c# – Windows服务自动启动和停止,异常处理问题【代码】

我开发了32位服务,我在Windows 7 Home Premium x64中运行它.问题是,当我启动它时,Windows会给我以下消息The WLConsumer service on Local Computer started and then stopped. Some services stopautomatically if they are not in use by other services or programs.我在事件日志中找到了以下消息Service cannot be started. System.ArgumentException: Log WLConsumer has already been registered as a source on the local co...

c# – 如何从WindowsForm项目中显示/打开/启动ExcelWorkbook项目(Sheet1)?【代码】

如标题所示,假设我在一个解决方案中有两个项目.我有三个,最后一个只是一个例子.一个项目叫做ExcelWorkbook(EWB) 另一个是WindowsForm调用(Core).我想从Core展示/打开/启动这个EWB.我添加了对第一个的引用: 我可以看到该特定工作簿的表格.当你从另一个项目展示形式时,它就不那么容易了.仅供注意,EWB.Sheet1不包含带0个参数的构造函数,其构造函数有两个参数,… 以下是这些论点: > Microsoft.Office.Tools.Excel.Factory工厂> IServ...

c# – 如何调试Windows Phone上的内存不足

我正在用c#制作一个WP8图像处理应用程序,并且遇到了一些内存问题. 如果我离开应用程序,并导航回了很多次,我的内存耗尽(例如Home – > back – > home – > back …). 我想知道如何调试这个问题?我正在尝试尽可能多地清理内存(使用Dispose / setting to null),但它无法正常工作. 我该如何调试?有没有办法找出内存是如何使用的?解决方法:检查这个问题的答案: Windows Phone Memory ProfilersThe Windows Phone SDK comes with...

c# – WinForms应用程序的Windows窗体身份验证

我正在Visual Studio 2012上使用C#和.NET Framework 4.5创建Windows窗体应用程序. 我现在想要创建一个登录表单,用户可以在其中输入一些用户名和密码(之前在数据库中创建),并且应用程序验证并登录用户.如果可能的话,使用“角色控制”. 我尝试在Google上搜索,但我没有在ASP.NET上找到与Windows Forms相关的内容. .NET Framework是否有任何好的(和官方)解决方案来解决WinForms中的身份验证问题?解决方法:不会.会员系统是Asp.net的一部...

c# – Windows Phone 8异步等待使用【代码】

我刚刚开始学习WP编程,所以这可能是一个很愚蠢的问题…… 我开发的应用程序从一个Web服务获取数据几个不同的方法.所以我决定将所有这些Web服务提取代码放到一个类中:class WebApiWorker {public async Task<List<GeocodeResponse>> GetGeocodeAsync(String address){String url = "http://api.com&search=" + HttpUtility.UrlEncode(address) + "&format=json";HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Creat...

c# – 为什么“暂停”按钮在此秒表计时器中不起作用? –Windows Phone App Developement【代码】

我不知道为什么这个暂停按钮在这里不起作用.我的秒表类也没有Restart方法所以我想通过组合“reset and start”来编写它.还有其他想法吗?或者有关如何使这个暂停按钮工作的任何想法?using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; usin...

c# – windows 8 App从App.xaml.cs访问页面方法【代码】

可能是一个愚蠢的问题所以我提前道歉.我是构建Windows 8商店应用程序的新手. 当应用程序被挂起时,我需要在我的页面脚本上运行一些方法.我只有一个页面,我在Page1.xaml.cs文件中有一些公共方法.我想从App.xaml.cs文件中的OnSuspending()方法调用它们.我需要确保保存一些文本文件. 如何创建对Page1脚本的引用?解决方法:您可以尝试从当前Frame的Content属性访问Page1对象.像这样的东西:var currentFrame = Window.Current.Content a...

c# – Windows窗体打开其他表单【代码】

我想要的是我正在创建一个具有两个功能的应用程序.这两种功能都有自己的形式(称为FactuurForm和VerhuurForm).我有另一个名为Home的表单,其中包含两个按钮.根据单击的按钮,我希望打开两个表单中的一个,然后关闭主页表单. 是)我有的目前,我有以下代码:static class Program {[STAThread]static void Main(){Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Home home = new Home();home.Sh...

c# – Windows Phone,你能从GPS获得实时吗?【代码】

是否有可能从GPS定位请求获得实时,而不是系统时间(因为这可以更改)? 这好像是Geoposition.Coordinate.Timestamp是系统时间,见这里:http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geocoordinate.aspxTimestampRead-only The system time at which the location was determined.我知道我可以使用NTP服务器,但如果我没有数据连接怎么办. 谢谢 史蒂夫 我想我只需要一个明确的答案,是否有可能...