小编ide*_*lix的帖子

嵌套存储过程链

我有这个SQL Server有很多存储过程分布在所有数据库中,我正在寻找一种方法来找到这些嵌套存储过程如何相互链接,所以基本上看看哪个存储过程正在运行哪个.

想知道是否有任何人遇到同样的问题,并找到了以一种无痛的方式获取此类信息的方法,而不是打开每个存储过程并检查它正在运行的其他存储过程.

谢谢

sql-server stored-procedures nested

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

访问WPF ListBox中的ListBoxItem控件

在WPF应用程序中,我使用在XAML中的以下DataTemplate中定义的ItemTemplate创建Listbox:

<DataTemplate x:Key="ListItemTemplate">
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"></RowDefinition>
      <RowDefinition Height="*"></RowDefinition>
    </Grid.RowDefinitions>
    <StackPanel>
      <Button/>
      <Button/>
      <Button Name="btnRefresh" IsEnabled="false"/>
      <TextBlock/>
      <TextBlock/>
      <TextBlock/>
      <TextBlock/>
    </StackPanel>
    <TextBox/>
  </Grid>
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)

生成ListBox后,我需要在所有ListBoxItem上更改以下按钮IsEnabled propety为true: <Button Name="btnRefresh" IsEnabled="false"/>

问题:

我无法访问ListBoxItem,因此无法使用该按钮访问其子项.

在WPF中是否有像ListBox.Descendents()这样的Silverlight或任何其他方式来获取该按钮,

wpf listbox datatemplate listboxitem

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

Dispatcher.Invoke循环冻结UI

我有日志拖尾应用程序,它在不定式循环中执行后台工作程序线程并检查某些TXT文件中的最新条目.一旦找到新条目,我使用Dispatcher.Invoke更新屏幕上的TextBox,并将最新条目添加到文本文件中.

问题是,如果源文本文件每毫秒不断更新,用户界面就会冻结,因为Dispatcher.Invoke经常更新文本框.

不知道是否有任何解决方法.我可以从文本文件中获取更大的块但不想破坏日志拖尾的实时体验,也不想延迟通过UI线程将行写入TextBox,因为这会使我的应用程序与实际数据不同步源文本文件.

这是后台工作者的DoWork方法

private void worker_DoWork(object sender, DoWorkEventArgs e)
{
  reader = new StreamReader(new FileStream(file.File, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
  lastMaxOffset = reader.BaseStream.Length;

  while (true)
  {
    if (worker.CancellationPending)
    {
      e.Cancel = true;
      break;
    }                

    if (reader.BaseStream.Length == lastMaxOffset)
      continue;

    reader.BaseStream.Seek(lastMaxOffset, SeekOrigin.Begin);

    string line = "";
    while ((line = reader.ReadLine()) != null)

    this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)(() =>
    {
      textLog.Text += "\r" + line;
      scrollViewer.ScrollToBottom();
    })); 

    lastMaxOffset = reader.BaseStream.Position;        
  }
}
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,UI线程只是简单地将文本附加到TextBox,并且当它经常发生接口冻结时

wpf textbox dispatcher backgroundworker

0
推荐指数
1
解决办法
5556
查看次数