/// <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
    public void ChangeTitle_And_CheckIt()
    {
      var doc = new Memo("a.txt", MemoKind.Text);
      doc.RenameTo("newtitle");
      doc.Save();

      Assert.AreEqual(true, StorageIo.Exists("newtitle.txt"));
      Assert.AreEqual(false, StorageIo.Exists("a.txt"));
    }
示例#3
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();
    }
    public MiniTextMemoControlSamplePage()
    {
      InitializeComponent();

      Memo memo = new Memo("HAHAHA.txt",
        MemoKind.Text)
      {
        Summary = "Here is what I have so far.  Each team leaders should review them and consult with Frank Kim for possible adjustment."
      };
      _memoctrl.Open(memo);
      _memoctrl.Width = 200;
      _memoctrl.Height = 200;

      _memo2.Open(memo);
      _memo2.ShowBackSide();
    }
    public MiniPhotoMemoControlSamplePage()
    {
      InitializeComponent();

      const string IMAGE_FILE_PATH = "/HAHAHA.image";
      var bmp = BitmapUtils.CreateBitmapImmediately("Images/sample/a.jpg");
      BitmapUtils.SaveBitmapToIso(IMAGE_FILE_PATH, bmp);

      var thumbpath = Memo.ThumbPathFromFullPath(IMAGE_FILE_PATH);
      BitmapUtils.SaveBitmapToIso(thumbpath, bmp);

      Memo memo = new Memo(
        IMAGE_FILE_PATH,
        MemoKind.Photo);

      _memo0.Open(memo);
    }
    /// <summary>
    /// Build document list
    /// </summary>
    void BuildMemoList()
    {
      MemoList = new List<Memo>();

      foreach (var fn in Workspace.GetMemoFiles(WorkspaceFileAccessMode.Visible))
      {
        var fullpath = Workspace.GetFullPath(fn);
        var kind =
          WorkspaceFileOp.IsPhotoMemoFile(fn)
          ? MemoKind.Photo
          : MemoKind.Text;

        var doc = new Memo(fullpath, kind)
        {
          WorkspaceName = Workspace.Name
        };

        MemoList.Add(doc);
      }
    }
示例#7
0
    /// <summary>
    /// Constructor for the Application object.
    /// </summary>
    public App()
    {
      BitmapPool.AddBitmap(PhotoViewerPage.BMP_ID_RENAME_BUTTON,
                           "Images/photoviewer/photo-rename-button.png");

      // Global handler for uncaught exceptions.
      UnhandledException += Application_UnhandledException;

      // Standard Silverlight initialization
      InitializeComponent();

      // Phone-specific initialization
      InitializePhoneApplication();

      // Show graphics profiling information while debugging.
      if (System.Diagnostics.Debugger.IsAttached)
      {
        // Display the current frame rate counters.
        Application.Current.Host.Settings.EnableFrameRateCounter = true;

        // Show the areas of the app that are being redrawn in each frame.
        //Application.Current.Host.Settings.EnableRedrawRegions = true;

        // Enable non-production analysis visualization mode,
        // which shows areas of a page that are handed off to GPU with a colored overlay.
        //Application.Current.Host.Settings.EnableCacheVisualization = true;

        // Disable the application idle detection by setting the UserIdleDetectionMode property of the
        // application's PhoneApplicationService object to Disabled.
        // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
        // and consume battery power when the user is not using the phone.
        PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
      }

      ViewModelLocator.Initialize();

      var memo = new Memo("photomemo-00.jpg", MemoKind.Photo);
      memo.NewPhotoMemo(BitmapUtils.CreateBitmapImmediately("Images/sample/a.jpg"));

      Messenger.Default.Send(new OpenMemoMessage(memo));
    }
    public MemoSummaryControlSamplePage()
    {
      InitializeComponent();

      const string IMAGE_FILE_PATH = "/HAHAHA.image";
      var bmp = BitmapUtils.CreateBitmapImmediately("Images/sample/a.jpg");
      BitmapUtils.SaveBitmapToIso(IMAGE_FILE_PATH, bmp);

      var thumbpath = Memo.ThumbPathFromFullPath(IMAGE_FILE_PATH);
      BitmapUtils.SaveBitmapToIso(thumbpath, bmp);

      var photomemo = new Memo(IMAGE_FILE_PATH,
                               MemoKind.Photo);

      const string FULLPATH = "/HAHAHA.txt";
      StorageIo.WriteTextFile(
        FULLPATH,
        "Here is what I have so far.  Each team leaders should review them and consult with Frank Kim for possible adjustment.");
      var memo = new Memo(FULLPATH,
                          MemoKind.Text);

      _a.Open(photomemo);
    }
示例#9
0
    /// <summary>
    /// Open text document
    /// </summary>
    /// <param name="memo"></param>
    public void Open(Memo memo)
    {
      _memo = memo;

      _title.Text = _memo.Title;
      _titleengraving.Text = _title.Text;
      _summary.Text = _memo.Summary;
    }
示例#10
0
    /// <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;
        });
      }
    }
示例#11
0
 /// <summary>
 /// Create new photo memo
 /// </summary>
 /// <param name="photo">Bitmap object</param>
 /// <returns>Create new photo memo</returns>
 public Memo NewPhotoMemo(
           BitmapImage bmp)
 {
   var fullpath = SeekNewFileName(AppSetting.JPEG_EXT);
   var memo = new Memo(fullpath, MemoKind.Photo)
   {
     WorkspaceName = Name
   };
   memo.NewPhotoMemo(bmp);
   return memo;
 }
示例#12
0
    /// <summary>
    /// Create new text document
    /// </summary>
    /// <returns>Text document object</returns>
    public Memo NewTextDocument()
    {
      var fullpath = SeekNewFileName(AppSetting.TEXT_MEMO_EXT);
      var doc = new Memo(fullpath, MemoKind.Text)
      {
        WorkspaceName = Name
      };
      doc.NewTextMemo();

      return doc;
    }
示例#13
0
 /// <summary>
 /// CTOR
 /// </summary>
 public OpenMemoMessage(Memo memo)
   : base("open-document-message")
 {
   this.Memo = memo;
 }
示例#14
0
    /// <summary>
    /// Create text memo controls
    /// </summary>
    void CreateTextMemoControls(Memo memo)
    {
      memo.OpenSummary();

      _textmemo = new MiniTextMemoControl();
      this.Children.Add(_textmemo);

      _textmemo.EmailClicked += new EventHandler(OnEmailClicked);
      _textmemo.CopyToClipboardClicked += new EventHandler(OnCopyToClipboardClicked);
      _textmemo.TrashClicked += new EventHandler(OnTrashButtonClicked);
      _textmemo.CancelClicked += new EventHandler(OnCancelButtonClicked);
      _textmemo.MoreCommandsClicked += new EventHandler(OnMoreCommandsClicked);

      _textmemo.Open(memo);
    }
示例#15
0
    /// <summary>
    /// Open text document
    /// </summary>
    /// <param name="memo"></param>
    public void Open(Memo memo)
    {
      Memo = memo;
      if (memo.IsTextMemo)
        CreateTextMemoControls(memo);
      else
      {
        memo.OpenThumb();

        _photomemo = new MiniPhotoMemoControl();
        this.Children.Add(_photomemo);

        _photomemo.TrashClicked += new EventHandler(OnTrashButtonClicked);
        _photomemo.CancelClicked += new EventHandler(OnCancelButtonClicked);
        _photomemo.MoreCommandsClicked += new EventHandler(OnMoreCommandsClicked);

        _photomemo.Open(memo);
      }
    }
示例#16
0
 /// <summary>
 /// Delete given document
 /// </summary>
 /// <param name="doc">Text document</param>
 public void DeleteMemo(Memo doc)
 {
   MemoList.Remove(doc);
   doc.Delete();
 }
示例#17
0
    /// <summary>
    /// Add new memo to front
    /// </summary>
    /// <param name="doc"></param>
    public void AddMemoToFront(Memo doc)
    {
      /*MoveMemosByRel(MemoSummaryControl.DESIRED_WIDTH);*/
      var c = CreateAndAddSummaryControl(doc);
      _list.Add(c);

      ArrangeMemoControls();
      UpdateScrollRange();
      if (_list.Count == 1)
        BeginAlignAnimationTo(_beginx);
      else
        BeginAlignAnimationTo(_endx);
    }
示例#18
0
    /// <summary>
    /// Create summary control
    /// </summary>
    /// <returns>summary control</returns>
    MemoSummaryControl CreateAndAddSummaryControl(Memo memo)
    {
      var c = new MemoSummaryControl
      {
        Width = MemoSummaryControl.DESIRED_WIDTH,
        Height = MemoSummaryControl.DESIRED_HEIGHT,
        RenderTransform = new TranslateTransform(),
        CacheMode = new BitmapCache()
      };
      c.Open(memo);
      c.Click += new EventHandler<MemoClickedEventArgs>(OnMemoClicked);
      c.DeleteClicked += new EventHandler<MemoClickedEventArgs>(OnMemoDeleteClicked);
      c.FrontToBackFlipped += new EventHandler<MemoClickedEventArgs>(OnMemoFlipped);

      this.Children.Add(c);
      return c;
    }