Esempio n. 1
0
        void MakeAnimation(int pos, int ID)
        {
            if (ID >= 0 && ID < data.pages[pos].AnimationList.Count)
            {
                FrameworkElement felm = ControlWorker.FindChild <FrameworkElement>(PlayCanvas, "ID_" + data.pages[pos].AnimationList[ID].GetID());

                if (felm != null)
                {
                    data.pages[pos].AnimationList[ID].MakeAnimation(felm);
                }
            }
        }
Esempio n. 2
0
        void MakeAnimations(int pos)
        {
            foreach (IAnimation ian in data.pages[pos].AnimationList)
            {
                FrameworkElement felm = ControlWorker.FindChild <FrameworkElement>(PlayCanvas, "ID_" + ian.GetID());

                if (felm != null)
                {
                    if (ian.DoAnimationAtStart())
                    {
                        ian.MakeAnimation(felm);
                    }
                }
            }
        }
Esempio n. 3
0
        public void DoAction(IActions action)
        {
            int act = action.DoAction();

            switch (act)
            {
            case 1:
                if (((Action_GoToPage)action).ToSpecific)
                {
                    LoadCanvas(((Action_GoToPage)action).ToPage - 1, true);
                    UpdateNumberLabel();
                }
                else if (((Action_GoToPage)action).Next)
                {
                    GoForward();
                }
                else
                {
                    GoBack();
                }
                break;

            case 2:
                Close();
                break;

            case 3:
                if (((Action_Sound)action).Stop)
                {
                    mediaplayer.Stop();
                }
                else if (((Action_Sound)action).PlayAgain)
                {
                    mediaplayer.Position = TimeSpan.Zero;
                    mediaplayer.Play();
                }
                else
                {
                    if (!String.IsNullOrWhiteSpace(((Action_Sound)action).PathToPlay))
                    {
                        SetSoundToBePlayed(((Action_Sound)action).PathToPlay, ((Action_Sound)action).Repeat);
                    }
                }
                break;

            case 4:
                LoadNewPresentation(((Action_LoadPresentation)action).PresentationPath);
                break;

            case 5:
            {
                FrameworkElement felm = ControlWorker.FindChild <FrameworkElement>(PlayCanvas, "ID_" + ((Action_SetVisibility)action).ID);

                if (felm != null)
                {
                    if (((Action_SetVisibility)action).VisibilityValue == SetVisibilityEnum.SetVisibilityValue.SetToVisible)
                    {
                        felm.Visibility = Visibility.Visible;
                    }
                    else if (((Action_SetVisibility)action).VisibilityValue == SetVisibilityEnum.SetVisibilityValue.SetToInvisible)
                    {
                        felm.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        if (felm.Visibility == Visibility.Collapsed || felm.Visibility == Visibility.Hidden)
                        {
                            felm.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            felm.Visibility = Visibility.Collapsed;
                        }
                    }
                }
                break;
            }

            case 6:
                MakeAnimation(currentLoaded, ((Action_DoAnimation)action).AnimationID);
                break;

            case 7:
            {
                FrameworkElement felm = ControlWorker.FindChild <FrameworkElement>(PlayCanvas, "ID_" + ((Action_Position)action).ID);

                if (felm != null)
                {
                    if (((Action_Position)action).ChangeX)
                    {
                        MathSignEnum.SetPositionX(((Action_Position)action).CX, ((Action_Position)action).SignX, felm);
                    }

                    if (((Action_Position)action).ChangeY)
                    {
                        MathSignEnum.SetPositionY(((Action_Position)action).CY, ((Action_Position)action).SignY, felm);
                    }
                }
                break;
            }
            }
        }
Esempio n. 4
0
        void RefreshAnimList()
        {
            if (Pid >= 0)
            {
                AnimPanel.Items.Clear();
                int k = 0;

                List <IAnimation> Removelist = new List <IAnimation>();

                foreach (IAnimation ian in data.pages[Pid].AnimationList)
                {
                    FrameworkElement felm = ControlWorker.FindChild <FrameworkElement>(canvas, "ID_" + ian.GetID());

                    if (felm != null)
                    {
                        StackPanel stc = new StackPanel();
                        stc.Orientation = Orientation.Horizontal;

                        /*
                         * if ((k % 2) == 0)
                         *  stc.Background = new SolidColorBrush(Color.FromRgb(189, 195, 199));
                         * else
                         *  stc.Background = new SolidColorBrush(Color.FromRgb(236, 240, 241));
                         */


                        Label lbl = new Label();
                        lbl.Content = (k + 1) + ".   [" + ian.GetID() + "] " + ControlNameWorker.GetTypeName(felm, out txt);

                        Image img = new Image();

                        if (ian is Animation_Position)
                        {
                            img.Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Resources/Animations/OpacityAnimation.png"));
                        }
                        else if (ian is Animation_Size)
                        {
                            img.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/Animations/Scale.png"));
                        }

                        img.Width  = 32;
                        img.Height = 32;

                        stc.Children.Add(img);
                        stc.Children.Add(lbl);

                        //stc.MouseLeftButtonDown += Stc_MouseLeftButtonDown;

                        stc.Tag = ian;

                        AnimPanel.Items.Add(stc);
                        k++;
                    }
                    else
                    {
                        Removelist.Add(ian);
                    }
                }

                foreach (IAnimation ian in Removelist)
                {
                    data.pages[Pid].AnimationList.Remove(ian);
                }
            }
        }