我正在使用Windows 7应用程序编写System.Device.Location
,这取决于Windows传感器和位置平台.我下载了Consumer预览版,但我找不到它.
谢谢.
我有三种形式,主要的,销售和登录。
在主表单中,我有一个计时器,例如5分钟后将启动登录表单。
我可以打开“销售”表单的“主表单”,关闭“主表单”,这样就会启动“登录”表单。
问题是“登录”表单没有集中在“销售”表单的顶部,因此用户必须登录才能使用“销售”表单。
主要形式的一些代码:
public void timer_Tick(object sender, EventArgs e)
{
timer.Stop();
LoginDialog loginForm = new LoginDialog();
loginForm.TopLevel = true;
loginForm.ShowDialog();
timer.Start()
}
private void pbSales_Click(object sender, EventArgs e)
{
Sales salesForm = new Sales();
salesForm .ShowDialog(this);
}
Run Code Online (Sandbox Code Playgroud) 我正在对表单调用Tester.cs中的功能进行单元测试,以下是错误:
Error 7/31/2012 10:43:11 PM One of the background threads threw exception:
System.TypeInitializationException: The type initializer for 'Tester.Tester' threw an exception. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: String
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s)
at Tester.Tester..cctor() in E:\Incubator\Tester\Tester\Tester.cs:line 35
--- End of inner exception stack trace ---
at Tester.Tester.Dispose(Boolean disposing)
at System.ComponentModel.Component.Finalize() MY-PC
Run Code Online (Sandbox Code Playgroud)
第35行是一个代码,该代码基本上从配置文件中检索值并将其转换为整数:
private static int _part = int.Parse(ConfigurationManager.AppSettings["Part"]);
Run Code Online (Sandbox Code Playgroud)
有什么错误?谢谢。
Windows 8商店应用不再支持线程:
我在类库中创建一个线程:
protected static Thread m_thread = null;
Run Code Online (Sandbox Code Playgroud)
然后在其中一个功能:
m_thread = new Thread(new ParameterizedThreadStart(RunDetection));
m_thread.Start(Something);
Run Code Online (Sandbox Code Playgroud)
我还需要中止该功能:
m_thread.Abort();
Run Code Online (Sandbox Code Playgroud)
如何在WIN8商店应用中执行此操作?
我有下面的代码可以得到回复HTTP GET
:
private void ResponseReady(IAsyncResult aResult)
{
HttpWebRequest request = aResult.AsyncState as HttpWebRequest;
try
{
this.Dispatcher.BeginInvoke(delegate()
{
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(aResult);
Run Code Online (Sandbox Code Playgroud)
当没有连接时出现问题,就会停在该response
行。它没有捕获异常。是因为吗Dispatcher.Invoke
?
我在桌面应用程序中使用此代码,但它在Windows 8 Store应用程序中不起作用,因为System.Text不再具有ASCIIEncoding
支持:
tagdata
是一个byte array
.
ASCIIEncoding.ASCII.GetString(tagdata).Trim();
Run Code Online (Sandbox Code Playgroud)
我应该使用UT8Encoding吗?我只想将字节数组转换为ASCII
文本.
谢谢.
我有一个Bootstrap模式,每次出现时我都会使用KO绑定一个<select
>下拉列表.
HTML:
<select id="album" name="album" class="form-control" data-bind="options: availableAlbums">
</select>
Run Code Online (Sandbox Code Playgroud)
JavaScript的:
$('#uploadModal').on('show.bs.modal', (function () {
function AlbumsListViewModel() {
var self = this;
self.availableAlbums = ko.observableArray([]);
$.ajax({
url: "../../api/eventapi/getalbums",
type: "get",
contentType: "application/json",
async: false,
success: function (data) {
var array = [];
$.each(data, function (index, value) {
array.push(value.Title);
});
self.availableAlbums(array);
}
});
}
ko.applyBindings(new AlbumsListViewModel());
}));
Run Code Online (Sandbox Code Playgroud)
但是,在第二次展示时,KO会向我显示以下错误:
错误:您无法多次将绑定应用于同一元素.
如果我将一个空数组传递给jade,我怎么知道它是否为空?
使用Javascript:
var data = [];
Run Code Online (Sandbox Code Playgroud)
玉:
if(data)
table ...
else
table ...
Run Code Online (Sandbox Code Playgroud) c# ×5
node.js ×2
.net ×1
iisnode ×1
javascript ×1
knockout.js ×1
pug ×1
unit-testing ×1
windows ×1
wpf ×1
xaml ×1