小编Jea*_*rie的帖子

WPF自定义路由事件 - 如何取消订阅?

如何从一个自定义路由事件中取消注册.

我有以下代码(自定义路由事件非常标准)

//Dispatch the Video Detection Movements
public delegate void MovementRoutedEventHandler( object sender
                                                , MovementRoutedEventArgs e);
public class MovementRoutedEventArgs : RoutedEventArgs
{
    private readonly DahuaDevice _device;
    private readonly byte[] _canals;
    private readonly DateTime _when;

    public MovementRoutedEventArgs(DahuaDevice device, byte[] canals, DateTime when)
    {
        _device = device;
        _canals = canals;
        _when = when;
    }
    public DahuaDevice Device
    {
        get { return _device; }
    }
    public Byte[] Canals
    {
        get { return _canals; }
    }
    public DateTime When
    {
        get { return _when; …
Run Code Online (Sandbox Code Playgroud)

wpf events routed

6
推荐指数
2
解决办法
3861
查看次数

C# MongoDB Driver 2.0 将“严格模式”Json 转换为“mongo shell 模式”BsonDocument

我有一个“严格模式”Json 字符串,其中日期以“$date”为前缀

"DateCreated\":{\"$date\":1444835457460}
Run Code Online (Sandbox Code Playgroud)

我现在需要“mongo shell 模式”中的字符串,其中

"DateCreated" : ISODate("2015-10-14T15:10:57.460+0000")
Run Code Online (Sandbox Code Playgroud)

为了实现我使用的“严格模式”

.ToJson((new JsonWriterSettings { OutputMode = JsonOutputMode.Strict })
Run Code Online (Sandbox Code Playgroud)

要转换回“mongo shell 模式”,我尝试

.ToJson((new JsonWriterSettings { OutputMode = JsonOutputMode.Shell})
Run Code Online (Sandbox Code Playgroud)

不走运,字符串未转换并且 '$date' 仍然存在(我期待 ISODate ......)

任何的想法 ?

c# serialization mongodb

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

标签 统计

c# ×1

events ×1

mongodb ×1

routed ×1

serialization ×1

wpf ×1