问题列表 - 第41588页

datetime和timestamp之间有什么区别

Sql Server中的datetime和timestamp数据类型有什么区别?

sql-server-2005

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

如何通过样式设置事件功能?

我有几个GUI控件元素,其中一些应该在鼠标交互(MouseEnter,MouseLeave)上生成相同的操作(代码隐藏函数调用).
[edit] 我在我的事件处理程序中执行一些非样式相关的功能.
现在我在每个控件中使用事件属性:

<Button Name="Button" Content="Button 1" 
    MouseEnter="GeneralMouseEnter" MouseLeave="GeneralMouseLeave" 
    PreviewMouseDown="Button1_PreviewMouseDown" PreviewMouseUp="Button1_PreviewMouseUp" />
<Button Name="NotInteractingButton" Content="Button 2" 
    /><!-- this button has no MouseOver-effects -->
<ToggleButton Content="ToggleButton" 
    MouseEnter="GeneralMouseEnter" MouseLeave="GeneralMouseLeave"  />
<!-- needs to use IsMouseDirectlyOver on the slider knob... -->
<Slider Name="HorizontalSlider" 
    MouseEnter="GeneralMouseEnter" MouseLeave="GeneralMouseLeave" 
    ValueChanged="Slider_ValueChanged" />
<Slider Name="VerticalSlider" Orientation="Vertical" 
    MouseEnter="GeneralMouseEnter" MouseLeave="GeneralMouseLeave" 
    ValueChanged="Slider_ValueChanged" />
Run Code Online (Sandbox Code Playgroud)

由于此示例中的许多控件都调用相同的两个函数"GeneralMouseEnter"和"GeneralMouseLeave",因此我希望能够定义一个样式或类似的东西来封装该行为.

[编辑 - 澄清]
这应该成为后来的一种插件.
(将代码和XAML文件包含到任何GUI程序中,并在每个交互式控件元素上设置样式...)

根据我在网络上发现的内容,我可以EventTriggers在此示例中使用:

<Style.Triggers>
  <EventTrigger RoutedEvent="Click">
    <EventTrigger.Actions>
      <BeginAction TargetName="SomeAction" />
    </EventTrigger.Actions>
  </EventTrigger>
</Style.Triggers>
Run Code Online (Sandbox Code Playgroud)

我不知道是否以及如何在一个动作中调用函数.

  • 是否可以通过创建一个带有action + trigger的样式来应用于每个控件来获得此功能?怎么做?
  • 如何为一个控件分配多个样式(用于多个交互事件)?
  • 甚至可能有更简洁的方法来实现这种行为?
  • [编辑]
    如果我想在GUI中的所有滑块上进行鼠标交互怎么办?

c# wpf events styles code-behind

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

如何将耐心设置为默认的git diff算法

在.git/config中我尝试过:

[diff]
    patience = true
Run Code Online (Sandbox Code Playgroud)

但没有运气

我必须这样做:

git diff --patience
git show --patience HEAD
Run Code Online (Sandbox Code Playgroud)

等等,每一次?

git diff

48
推荐指数
2
解决办法
6784
查看次数

通过javascript检测ipad/iphone webview

如果网站在ipad safari中运行或在应用程序WebView中运行,是否有办法通过javascript进行区分?

javascript webview ipad ios

87
推荐指数
6
解决办法
8万
查看次数

Lazy <T>:"函数评估需要所有线程运行"

我有一个带有一些静态属性的静态类.我在静态构造函数中初始化了所有这些,但后来意识到它是浪费的,我应该在需要时懒惰加载每个属性.所以我切换到使用该System.Lazy<T>类型来完成所有脏工作,并告诉它不要使用它的任何线程安全功能,因为在我的情况下执行始终是单线程的.

我最后得到了以下课程:

public static class Queues
{
    private static readonly Lazy<Queue> g_Parser = new Lazy<Queue>(() => new Queue(Config.ParserQueueName), false);
    private static readonly Lazy<Queue> g_Distributor = new Lazy<Queue>(() => new Queue(Config.DistributorQueueName), false);
    private static readonly Lazy<Queue> g_ConsumerAdapter = new Lazy<Queue>(() => new Queue(Config.ConsumerAdaptorQueueName), false);

    public static Queue Parser { get { return g_Parser.Value; } }
    public static Queue Distributor { get { return g_Distributor.Value; } }
    public static Queue ConsumerAdapter { get { return g_ConsumerAdapter.Value; } }
}
Run Code Online (Sandbox Code Playgroud)

在调试时,我注意到了一条我从未见过的消息: …

c# lazy-loading visual-studio-2010 visual-studio visual-studio-debugging

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

在包/命名空间级别添加.NET源文档以便使用Doxygen进行处理

我使用doxygen和XML文档注释为我们的框架库创建内部API文档.

Doxygen为每个命名空间创建一个"包".我想知道是否有可能在命名空间级别添加源文档以显示在Doxygen的包视图中?

.net documentation doxygen documentation-generation

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

YQL财务数据不可用

我已经在这方面工作了一个星期,无法从YQL控制台获取certin数据.我想要改变汇率.它似乎在雅虎这里工作,http://uk.finance.yahoo.com/q?s = GBPUSD = X,但不是在这里,select * from yahoo.finance.quotes where symbol in ("GBPUSD=X")

有人有任何解决方案?

json yql yahoo-finance

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

xsl中for-each和模板之间的差异?

双方xsl:for-eachxsl:template用于检索XML节点的XSL样式表.但它们之间的根本区别是什么?请指导我.提前致谢.

xslt foreach templates

16
推荐指数
3
解决办法
8276
查看次数

C#中的旋转文本对齐

我需要能够旋转标签中的文本并将其与左,右或中心对齐.到目前为止,我能够在派生标签的onPaint方法中使用此代码进行旋转:

 float width = graphics.MeasureString(Text, this.Font).Width;
 float height = graphics.MeasureString(Text, this.Font).Height;

 double angle = (_rotationAngle / 180) * Math.PI;
 graphics.TranslateTransform(
     (ClientRectangle.Width + (float)(height * Math.Sin(angle)) - (float)(width * Math.Cos(angle))) / 2,
     (ClientRectangle.Height - (float)(height * Math.Cos(angle)) - (float)(width * Math.Sin(angle))) / 2);
 graphics.RotateTransform(270f);
 graphics.DrawString(Text, this.Font, textBrush, new PointF(0,0), stringFormat);
 graphics.ResetTransform();
Run Code Online (Sandbox Code Playgroud)

它工作正常.我可以看到文字旋转了270度.

但是当我尝试在stringFormat中设置对齐时,它变得疯狂,我无法弄清楚发生了什么.

如何将文本旋转270度并将其对齐?

c# drawstring rotation

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

用cron运行python脚本

这可能是一个非常简单的问题,但我怎么能每2天在我的fedora dist上运行一个python脚本?

谢谢

安东尼

python cron

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