/// <summary>
    /// Open memo
    /// </summary>
    /// <param name="msg">Open memo message</param>
    void OnOpenMemoMessage(OpenMemoMessage msg)
    {
      if (msg.Memo.IsPhotoMemo == false)
        return;

      Memo = msg.Memo;
      Memo.Open();
    }
示例#2
0
    /// <summary>
    /// Open document message
    /// </summary>
    /// <param name="msg">Message from others</param>
    void OnOpenMemoMessage(OpenMemoMessage msg)
    {
      //
      // Only accept text memo
      //
      if (msg.Memo.IsTextMemo == false)
        return;

      Memo = msg.Memo;
      Memo.Open();
    }
    /// <summary>
    /// Open text document
    /// </summary>
    /// <param name="memo"></param>
    public void Open(Memo memo)
    {
      Debug.Assert(memo.IsPhotoMemo);
      if (false == memo.IsPhotoMemo)
        return;

      memo.Open();

      if (memo.Thumb != null)
      {
        _image.Source = memo.Thumb;
      }
      else
      {
        Observable
        .FromEvent<PropertyChangedEventHandler, PropertyChangedEventArgs>(
            a => new PropertyChangedEventHandler((x, xe) => a(xe)),
            h => memo.PropertyChanged += h,
            h => memo.PropertyChanged -= h)
        .Where(args => args.PropertyName == Memo.ThumbPropertyName)
        .Select(x => memo.Thumb)
        .Where(thumb => thumb != null)
        .ObserveOnDispatcher()
        .Subscribe(thumb =>
        {
          _image.Source = thumb;
        });
      }
    }