我正在尝试使用Windows窗体以最基本的方式运行后台工作程序,例如获取后台进程来更改标签中的文本..我在这里获得了基本的后台工作程序代码.. http://www.albahari .com/threading/part3.aspx继承 我的表单中的代码..试图使它按下按钮然后生成后台工作线程,更改标签中的文本
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;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
BackgroundWorker _bw = new BackgroundWorker();
void backgroundio()
{
_bw.DoWork += bw_DoWork;
_bw.RunWorkerAsync("Message to worker");
}
void bw_DoWork(object sender, DoWorkEventArgs e)
{
// This is called on the worker thread
label1.Text = (string)(e.Argument); // writes "Message to worker"
// Perform time-consuming task...
}
void button1_Click(object sender, …Run Code Online (Sandbox Code Playgroud) 我正在尝试对文本框使用 SelectionStart 和 SelectionLength 属性。它没有效果,但也没有错误。它实际上是后台工作人员 ProgressChanged 方法的一部分,但我已经在测试解决方案中单独尝试了 SelectionStart 和 SelectionLength 并且它是相同的......没有任何反应......
有任何想法吗?谢谢!!!
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
// Update the GUI as the music is playing
textBox1.SelectionStart = ((int)e.UserState);
textBox1.SelectionLength = (1);
}
Run Code Online (Sandbox Code Playgroud) 我似乎无法从表单文本字段中的值获取字符串长度这是我的函数的代码,它传递了textfields名称的参数
function validate(thing)
{
var location = document.getElementById(thing);
var cardst = location.value;
window.alert (cardst);
cardst = String(cardst);
window.alert (cardst.lenght);
Run Code Online (Sandbox Code Playgroud)
第一个警报工作,它会警告我在文本字段中键入的内容,但第二个警报始终未定义.正如你所看到的,我把它作为一个字符串投射但是我得到了未定义的......任何想法?
我正在 Unity 中为移动设备制作游戏。我使用 Ironsource 作为广告中介。我已将 SDK 添加到我的项目中,并在 Android 上运行。
如果我将构建目标切换到 iOS,我会收到编译器错误..
Assets\IronSource\Editor\IronSourceBuildPostprocessor.cs(53,48):错误 CS0619:“PBXProject.GetUnityTargetName()”已过时:“此功能已弃用。现在有两个目标,调用 GetUnityMainTargetGuid() - 对于应用程序或 GetUnityFrameworkTargetGuid() - 对于源/插件获取 Guid 而不是调用 TargetGuidByName(GetUnityTargetName())。
我在 Unity 2019.3.2f1 上 2019.3 之后的任何功能都已弃用。
因此,与其等待来自 Ironsource 的修复或答案,我可以自己解决此问题,方法是将已弃用的函数替换为错误中建议的任何一个函数...
但哪一个?我不知道该函数的作用是什么.. 这是有问题的行所在的 Ironsource sdk 中的整个类.. 该文件名为 IronSourceBuildPostprocessor.cs 我标记了错误的行。
#if UNITY_IOS
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Reflection;
namespace IronSource.Editor
{
public class IronSourceBuildPostprocessor
{
[PostProcessBuild]
public static void OnPostprocessBuild (BuildTarget buildTarget, string buildPath)
{
if (buildTarget == BuildTarget.iOS) …Run Code Online (Sandbox Code Playgroud) c# ×2
winforms ×2
casting ×1
ios ×1
ironsource ×1
javascript ×1
selection ×1
string ×1
textbox ×1
undefined ×1