小编Ebi*_*ser的帖子

申请流程不会关闭

我有一个WPF应用程序,关闭应用程序后,其进程app.exe *32仍在任务管理器的进程列表中运行.

我需要这个关闭,因为当我编辑我的代码时,我得到以下错误 -

Unable to copy file "obj\x86\Release\frontEndTest.exe" to "bin\Release\app.exe". The process cannot access the file 'bin\Release\app.exe' because it is being used by another process.
Run Code Online (Sandbox Code Playgroud)

我知道此前已经提出过这类问题.

但是,通过将我Assembly.cs改为 - 解决方案对我不起作用

[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
Run Code Online (Sandbox Code Playgroud)

我想也许,如果我要找到Window closed事件并推动类似的东西 - Process.GetCurrentProcess().Kill();在事件中,当用户从'x'表单右上角的红色按钮关闭应用程序时,这可能会杀死进程?

c# wpf exe process

13
推荐指数
2
解决办法
2万
查看次数

价值不在预期范围内

我使用以下代码更新列表框,这是从Web服务接收列表 -

client.userKeywordsCompleted += new EventHandler<userKeywordsCompletedEventArgs>(client_userKeywordsCompleted);
client.userKeywordsAsync();
Run Code Online (Sandbox Code Playgroud)

使用 -

void client_userKeywordsCompleted(object sender, userKeywordsCompletedEventArgs e)
{

    string result = System.Convert.ToString(e.Result);

    for (int i = 0; i < e.Result.Count; i++)
    {

        ListBoxItem lbitem = new ListBoxItem();

        lbitem.Name = "lb_" + i;
        lbitem.Content = e.Result[i];

        lbitem.AddHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(ListBoxItem_DoubleClickEvent), true);

        listBox1.Items.Add(lbitem);

    }
Run Code Online (Sandbox Code Playgroud)

这工作正常,因为我在加载子窗口时使用它,因此列表框从数据库中获取列表,但是当用户选择列表框中的一个项目时,他们可以选择编辑所选项目.因此编辑就位,有一个编辑按钮,用于更新数据库中表格中的列.然后在按钮单击时,我再次调用上述代码以使用新凭据更新列表框.然而这带来了bcak的错误 -

"Value does not fall within the expected range."
Run Code Online (Sandbox Code Playgroud)

为什么我不能在按钮点击上调用web方法,因为它所做的就是刷新列表框???

c# silverlight web-services listbox

10
推荐指数
1
解决办法
15万
查看次数

每个循环的Xml节点读数

我试图循环一个Xml文件并在消息中显示帐户的值.

XmlNodeList nodeList = testDoc.SelectNodes("/details/row/var");
foreach (XmlNode no in nodeList)
{
   XmlNode node = testDoc.SelectSingleNode("/details/row/var[@name='account']");
   test.actual = node.Attributes["value"].Value;

   MessageBox.Show(test.account);
 }
Run Code Online (Sandbox Code Playgroud)

消息框当前正在重复显示第一条记录,如何进入下一条记录?

感谢您提前输入.

c# xml foreach loops nodes

8
推荐指数
2
解决办法
7万
查看次数

设置DateTime格式

我有以下代码 -

DateTime timeStamp;

timeStamp = System.Convert.ToDateTime(y.InnerText);
Run Code Online (Sandbox Code Playgroud)

哪里y.InnerText11/03/2013 11:35:24.

然而,由于数据库正在寻找格式,这打破了我的import语句 -

2013-03-11 11:35:24
Run Code Online (Sandbox Code Playgroud)

如何设置DateTime对象的格式?

c# format datetime

8
推荐指数
1
解决办法
5万
查看次数

在HTML :: Element的look_down例程Perl中指定多个类?

我正在使用HTML :: TreeBuilder来解析一些HTML.

你能在' look_down '例程中指定多个类吗?

在使用以下方式搜索HTML时的情况 -

for ( $tree->look_down( 'class' => 'postbody'))
Run Code Online (Sandbox Code Playgroud)

我也是'postprofile'在同一个循环中搜索另一个类.

有没有办法这样做而不必使用新的 - for ( $tree->look_down( 'class' => 'postprofile' ))

因为这会带回2组结果,而我只想要一个合并集.

我尝试过使用 - for ( $tree->look_down( 'class' => 'postbody||postprofile')) 但这不起作用,

先感谢您.

perl for-loop class html-tree

5
推荐指数
1
解决办法
1812
查看次数

检测Twitter提交Android

我目前正在编写一个Android应用程序.

我打算在我的手机后台运行我的应用程序,我希望能够检测到我在同一设备上使用Twitter应用程序提交帖子的时间.

这甚至可能吗?

c# twitter android

5
推荐指数
1
解决办法
172
查看次数

在 Cytoscape.js 中设置节点位置

我正在使用出色的Cytoscape.js进行绘图。

我以前一直为此使用可乐选项,因为它使用力方向。

然而,我现在想可视化没有连接的多个图形,并意识到fCose在这方面做得更好。

我现在面临的问题是,当我已经有了坐标时,我现在无法设置节点位置。

我能够Cola通过在布局选项中执行以下操作来实现这一点-

    name: 'cola',
    padding: layoutPadding,
    nodeSpacing: 40,
    edgeLengthVal: 20,
    animate: false,              // setting this to false
    randomize: false,            // and this to false allowed me to manually set the node position coordinates
    maxSimulationTime: maxLayoutDuration,
    boundingBox: { 
        x1: 0,
        y1: 0,
        x2: 10000,
        y2: 10000
    },
    edgeLength: function (e) {
        let w = e.data('weight');
        return w;
    }
Run Code Online (Sandbox Code Playgroud)

同样在默认值中Cola positions设置为undefined,我认为这意味着如果传入坐标,它们将被相应地设置。

然而我的问题是fCose,无论我做什么,当传递节点的坐标时,渲染时的影响为零。

在默认值中, …

javascript cytoscape.js

5
推荐指数
1
解决办法
1126
查看次数

"根级别的数据无效.第1行,第1位"解析XML时

我想解析下面的xml来获取richTextBox1所以显示'John Smith','35','Jpeg'.

<?xml version="1.0" encoding="utf-8" ?> 
- <Games>
- <Gamer Name="John Smith" Age="35" Win%="5.33502797236373">
   <Picture-id>Jpeg</Picture-id> 
   <Game>300</Game> 
  </Gamer>
</Games>
Run Code Online (Sandbox Code Playgroud)

我使用以下代码尝试这样做 -

StringBuilder output = new StringBuilder();

String xmlString = @"Gamer.xml";

// Create an XmlReader
using (XmlReader reader = XmlReader.Create(new StringReader(xmlString)))
{
    reader.ReadToFollowing("Gamer");
    reader.MoveToFirstAttribute();
    string genre = reader.Value;
    output.AppendLine("Name" + "Age");

    reader.ReadToFollowing("Picture-id");
    output.AppendLine(reader.ReadElementContentAsString());
}

richTextBox1.Text = output.ToString();
Run Code Online (Sandbox Code Playgroud)

出于某种原因,当我执行它时会带回错误 - '根级别的数据无效.第1行,第1行.' 我怎样才能使这个工作,非常感谢任何输入.

c# xml parsing

4
推荐指数
1
解决办法
1万
查看次数

Xml阅读器跳过值

我有以下XML代码段 -

-<Row>
 <RowType Id="1"Label="Scotland">1985</RowType>
 <Year Id="11"Label="1994"/>
 <Value Id="123">18</Value>
 <Field Id="123"Label="Country">16</Field>
 <Field Id="123"Label="Soccer">Yes</Field>
</Row>
-<Row>
 <RowType Id="1"Label="England">1986</RowType>
 <Year Id="11"Label="1994"/>
 <Value Id="123">19</Value>
 <Field Id="123"Label="Country">16</Field>
 <Field Id="123"Label="Soccer">Yes</Field>
</Row>
-<Row>
 <RowType Id="1"Label="Wales">1987</RowType>
 <Year Id="11"Label="1994"/>
 <Value Id="123">20</Value>
 <Field Id="123"Label="Country">16</Field>
 <Field Id="123"Label="Soccer">Yes</Field>
</Row>
Run Code Online (Sandbox Code Playgroud)

我正在使用它XmlReader从中检索特定数据 -

using (XmlReader reader = XmlReader.Create(new StringReader(xml)))
        {
            string country = "";
            string Year = "";
            string count = "";
            string tss= "";
            string tss2 = "";


            reader.MoveToContent();
            while (reader.Read())
            {

                reader.ReadToFollowing("RowType");
                country = reader.GetAttribute("Label");
                country = country.Replace("'", ""); …
Run Code Online (Sandbox Code Playgroud)

c# xmlreader xml-parsing

4
推荐指数
1
解决办法
3179
查看次数

你调用的对象是空的

我有以下代码 -

private static void convert()
    {
        string csv = File.ReadAllText("test.csv");
        XDocument doc = ConvertCsvToXML(csv, new[] { "," });
        doc.Save("update.xml");

        XmlTextReader reader = new XmlTextReader("update.xml");
        XmlDocument testDoc = new XmlDocument();
        testDoc.Load(@"update.xml");

        XDocument turnip = XDocument.Load("update.xml");
        webservice.function[] test = new webservice.function[1];
        webservice.function CallWebService = new webservice.function();

        foreach(XElement el in turnip.Descendants("row"))
        {
                            test[0].com = System.Convert.ToInt32(el.Descendants("var").Where(x => (string)x.Attribute("name") == "com").SingleOrDefault().Attribute("value").Value);
            test[0].Centre = el.Descendants("var").Where(x => (string)x.Attribute("name") == "Centre").SingleOrDefault().Attribute("value").Value;
            test[0].CCentre = el.Descendants("var").Where(x => (string)x.Attribute("name") == "CCentre").SingleOrDefault().Attribute("value").Value;

            MessageBox.Show(test[0].person, "person");
            MessageBox.Show(System.Convert.ToString(test[0].actually), "Actually");
            MessageBox.Show(System.Convert.ToString(test[0].com), "Com");

            CallWebService.updateFeedStatus(test);
        }
Run Code Online (Sandbox Code Playgroud)

它出现了错误 …

c# xml web-services object nullreferenceexception

2
推荐指数
1
解决办法
2970
查看次数