小编Tho*_*mas的帖子

在VS2010中关闭双击取消停靠

我不小心双击了VS2010中的标签并取消了它们.是否可以关闭此行为?

注意:我正在使用Productivity Power Tools中的Document Well 2010 Plus,以防万一.

multiple-monitors visual-studio-2010

19
推荐指数
2
解决办法
2802
查看次数

从Spotify API获取赛道的数量

是否可以获得歌曲的播放次数(针对当前用户)?我只找到了ToplistTrack类,但都没有告诉我用户听歌的频率.

spotify spotify-app

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

可用的VS2010修补程序列表

随着我使用VS2010崩溃的规律性增加,我一直在寻找一个修补程序列表. 这篇博文说没有官方列表,所以让我们制作一个(仅限RTM).

或者这个页面是否足够:https://connect.microsoft.com/VisualStudio/Downloads

hotfix visual-studio-2010

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

Application.Current.Shutdown()没有

标题是关于它的.WPF应用程序,带有一些用于IPC的WCF内容.我打电话Application.Current.Shutdown(),应用程序继续愉快.我以为Shutdown应该是不可阻挡的.

也许是因为它是从后台线程调用的?我是否需要做一些调度员摆弄?

wpf application-shutdown

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

MvvmLight EventToCommand和WPFToolkit DataGrid双击

试图弄清楚如何使用EventToCommand为行设置datagrid双击处理程序.该命令位于每行的viewmodel中.我的经验就是这么多,因为我还没有使用过互动.

谢谢.

我会使用mvvmlight标签,但我还没有足够高的代表来制作新标签.

c# mvvm wpftoolkit wpfdatagrid mvvm-light

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

ListBox TwoWay绑定到SelectedItem

我已经多次看到这个问题并且一遍又一遍地查看我的代码.但是,当我SelectedItem使用对象分配我的绑定属性时,它不会更新显示的选定项.看来ListBox我认为我指定的对象不是其项目的成员.

public class MainViewModel : ViewModelBase
{
    //...
    public SortedObservableCollection<TubeViewModel> Items { get; private set; }
    public TubeViewModel SelectedTube { //get, set, propertychanged, etc. }
}

<ListBox x:Name="TubeList"
         Margin="10"
         ItemsSource="{Binding Items}"
         ItemTemplate="{StaticResource TubeTemplate}"
         SelectedItem="{Binding SelectedTube, Mode=TwoWay}" 
         SelectionMode="Single"
         VirtualizingStackPanel.IsVirtualizing="False">
</ListBox>
Run Code Online (Sandbox Code Playgroud)

这是我尝试设置的其中一个地方的impl SelectedTube- 肯定发生在主线程上.

 var match =
    from t in Items
    where t.Model.DataFileName == filename
    select t;
 if (match.Any())
    SelectedTube = match.First();
Run Code Online (Sandbox Code Playgroud)

我注意到,SelectedTube除非我手动点击它,否则从未突出显示,但有点忽略它.但后来我想ScrollIntoViewCentered所选项目,所以我DependencyProperty在我的视图中添加了一个观察SelectedItem更改.处理程序最初看起来像这样:

private void OnSelectedItemChanged(DependencyObject target, DependencyPropertyChangedEventArgs e) …
Run Code Online (Sandbox Code Playgroud)

data-binding wpf listbox selecteditem two-way-binding

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

将EF4 DbContext与域服务一起使用

我使用来自实体框架4的新代码构建了我的数据访问层,其中一个类派生自DbContext和各种DbSet成员.

现在我正在扩展到Silverlight并希望使用WCF RIA服务来访问数据库.我是否必须重新开始使用ADO.NET实体数据模型,或者是否有某种方法可以使用我所拥有的内容?

entity-framework-4 wcf-ria-services

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

Postgres 中的离线有限多主机

站点 A 将生成一组记录。他们每晚都会备份数据库并将其 ftp 到站点 B。站点 B 根本不会修改这些记录,但会添加更多记录,并且其他表将为站点 A 的记录创建 FK。

因此,本质上,我需要设置一个系统来从站点 A 的转储中获取所有增量更改(主要是插入和更新,但也可能进行一些删除)并将它们应用到站点 B。

此时,我们正在使用 Postgres 8.3,但如果有价值的话可以升级。

我相信我可以用Bucardo相对直接地做到这一点,但在我设置 Linux 盒子来测试它之前,我很想听到替代方案(或 Bucardo 的确认)。

postgresql replication database-replication

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

Spotify API创建临时播放列表未加载

我正在制作一个小应用程序,显示艺术家相关艺术家的首首歌曲列表.当我第一次尝试加载我的应用程序时,它什么也没显示.但是,当我"重新加载应用程序"时,一切似乎都有效.当我不断开始"重新加载"时,它会不断添加更多相同的曲目到列表中.

如何阻止它不断地将更多曲目添加到列表中以及收紧代码以使其在加载时工作?

require([
  '$api/models',
  '$views/list#List',
  '$api/toplists#Toplist'

  ], function(models, List, Toplist){
    'use strict';

  // Build playlist
  function buildList(trackURIArray){
    var arr = trackURIArray;
    models.Playlist
      .createTemporary("myTempList")
      .done(function(playlist){ 
        playlist.load("tracks").done(function(loadedPlaylist){
          for(var i = 0; i < arr.length; i++){
            loadedPlaylist.tracks.add(models.Track.fromURI(arr[i]));
          }
        });

        // Create list
        var list = List.forPlaylist(playlist,{
          style:'rounded'
        });

        $('#playlistContainer').append(list.node);
        list.init();
      });
  }

  // Get top track
  function getTopTrack(artist, num, callback){
    var artistTopList = Toplist.forArtist(artist);

    artistTopList.tracks.snapshot(0, num).done(function (snapshot){ 
      snapshot.loadAll('name').done(function(tracks){
        var i, num_toptracks;
        num_toptracks = num; 

        for(i = 0; i < num_toptracks; i++){
          callback(artist, tracks[i]); …
Run Code Online (Sandbox Code Playgroud)

javascript api spotify spotify-app

3
推荐指数
1
解决办法
616
查看次数

ES6 从箭头函数(OOP)中移除事件监听器

我有一个这样的课程:

class Hanoi{

   constructor(canvas) {
      //construcor things
   }

   onMouseDown(e) {
      for (var i = 0; i < this.pieces.length; i++) {
         let piece = this.pieces[i];
         if (piece.isClicked(e)) {
            this.isDragging = true;
            this.dragPiece = piece;
            this.bound = evt => this.onMouseMove(evt);
            this.canvas.addEventListener("mousemove", ev => {this.onMouseMove(ev)});
            this.canvas.addEventListener("mouseup", ev =>{this.onMouseUp(ev)});
            this.draw();
         }
      }
   }

   onMouseMove(e) {
      this.dragPiece.x = e.clientX;
      this.dragPiece.y = e.clientY;
      this.draw();
   }

   onMouseUp(e) {
      this.canvas.removeEventListener("mousemove", this.onMouseMove);
      this.canvas.removeEventListener("mouseup", this.onMouseUp);
      this.isDragging = false;
      this.draw();
   }
}
Run Code Online (Sandbox Code Playgroud)

onMouseDown 添加了两个事件侦听器,但是由于有箭头函数,所以在调用 onMouseUp 时我无法删除它们。

处理这个问题的最佳方法是什么?

javascript oop ecmascript-6 arrow-functions

3
推荐指数
1
解决办法
4453
查看次数

xaml样式中的WPF4 DataGridHeaderBorder

提出一个单独的问题,与对WPF 4答案的评论有关:DataGridColumnHeader发生了什么?

看来我可以在UserControl中使用DataGridHeaderBorder,在ResourceDictionary中独立使用,但不能在Style的模板设置器中使用.

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    >

    <!-- Works -->
    <DataTemplate x:Key="yomama">
        <DataGridColumnHeader />
    </DataTemplate>

    <!-- Compile Error: error MC3074: The tag 'DataGridHeaderBorder' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'. -->
    <Style x:Key="{x:Type DataGridRowHeader}"
        TargetType="{x:Type DataGridRowHeader}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridRowHeader}">
                    <Grid>
                        <DataGridHeaderBorder></DataGridHeaderBorder>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
Run Code Online (Sandbox Code Playgroud)

如果我使用xmlns,我可以让它工作:dg ="http://schemas.microsoft.com/wpf/2008/toolkit",即使我没有在项目中引用WPFToolkit.我已经验证我已经设置为.NET4并引用了PresentationFramework v4.

谢谢你帮我删除了dg:hack.

wpf xaml wpfdatagrid wpf-4.0 datagridheaderborder

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

System.Transactions.Diagnostics.DiagnosticTrace抛出TypeInitializationException

似乎与OdbcConnection.Open()中出现的Strange异常有关,但我不确定.

我最近切换到Win8,从那以后没有运行这个应用程序.我正在使用VS2012,但项目尚未升级.转储异常如下所示:

Unhandled Exception: System.TypeInitializationException: 
 The type initializer for 'System.Transactions.Diagnostics.DiagnosticTrace' threw an exception. ---> 
 System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> 
 System.TypeInitializationException: The type initializer for 'System.Uri' threw an exception. ---> 
 System.TypeInitializationException: The type initializer for 'System.UriParser' threw an exception. ---> 
 System.TypeInitializationException: The type initializer for 'System.Runtime.Versioning.BinaryCompatibility' threw an exception. ---> 
 System.ArgumentException: String cannot be of zero length.
Parameter name: frameworkName
   at System.Runtime.Versioning.BinaryCompatibility.ParseFrameworkName(String frameworkName, String& identifier, Int32& version, String& profile)
   at System.Runtime.Versioning.BinaryCompatibility.ParseTargetFrameworkMonikerIntoEnum(String targetFrameworkMoniker, TargetFrameworkId& targetFramework, Int32& targetFrameworkVersion)
   at …
Run Code Online (Sandbox Code Playgroud)

.net c++-cli .net-4.0 windows-8

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

端口到VS2015/.NET 4.6后,C++/CLI DLL在加载时崩溃

老实说,这可能是VS2015的愚蠢:迁移的项目编译,但不会运行("调试断言失败!"),但没有答案,我有更多的细节.

最近将我们的代码库从VS2010移植到目标v4.6的v4.0到VS2015.我们有一个托管C++ DLL来提供对我们的C++代码库的.NET访问.所有引用它的.NET应用程序在启动时崩溃.它似乎正在崩溃注册静态以便在退出时进行破坏.

这是调试callstack:

ntdll.dll!RtlValidateHeap() Unknown
KernelBase.dll!_HeapValidate@12()   Unknown
ucrtbased.dll!_CrtIsValidHeapPointer(const void * block) Line 1385  C++
ucrtbased.dll!_msize_dbg(void * block, int block_use) Line 1037 C++
ucrtbased.dll!_msize(void * block) Line 30  C++
ucrtbased.dll!_recalloc_dbg(void * block, unsigned int count, unsigned int element_size, int block_use, const char * file_name, int line_number) Line 771   C++
ucrtbased.dll!_register_onexit_function::__l23::<lambda>() Line 112 C++
ucrtbased.dll!__crt_seh_guarded_call<int>::operator()<void <lambda>(void),int <lambda>(void) &,void <lambda>(void) >(__acrt_lock_and_call::__l3::void <lambda>(void) && setup, _register_onexit_function::__l23::int <lambda>(void) & action, __acrt_lock_and_call::__l4::void <lambda>(void) && cleanup) Line 199  C++
ucrtbased.dll!__acrt_lock_and_call<int <lambda>(void) >(const __acrt_lock_id lock_id, …
Run Code Online (Sandbox Code Playgroud)

.net dll c++-cli visual-studio-2015

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