src/FingersDance.Actions/ActionStartOrEndAnnotation.cs
author cavaliet
Tue, 24 Nov 2009 22:08:57 +0100
changeset 229 05aba5def1fc
parent 214 beebae32b1ed
permissions -rw-r--r--
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Controls.Primitives;

using FingersDance.Control.TimeLine;

namespace FingersDance.Actions
{
    public class ActionStartOrEndAnnotation : FingersDance.Actions.ActionBase
    {
        
        private String _Text = "";
        private UserControlTimeLine myTimeline;

        public ActionStartOrEndAnnotation()
        {
            
        }

        public ActionStartOrEndAnnotation(String text)
        {
            _Text = text;
        }

        public ActionStartOrEndAnnotation(Object[] param)
        {
            // The context param[0] is the userPanel, so we have to get the timeline's instance.
            UserControl userPanel = (UserControl)param[0];
            // Its content...
            Grid o = (Grid)userPanel.Content;
            // and the UserControlSyncSource within the grid...
            UserControl syncSrc = (UserControl)((Grid)o.Children[1]).Children[0];
            // and finally the timeline
            myTimeline = (UserControlTimeLine)((Grid)((Grid)syncSrc.Content).Children[0]).Children[0];

            _Text = (String)param[1];
        }

        public void Execute()
        {
            if (myTimeline != null)
                myTimeline.startOrEndAnnotation(_Text);
        }
    }
}