コード例 #1
0
 protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
 {
     pre_View = null;
     main_View = null;
     base.OnClosing(e);
 }
コード例 #2
0
        public FullWindowForAudience(MainWindow main, FullWindowForPresentor pre)
        {
            main_View = main;
            pre_View = pre;
            AddKeyBindings();

            InitializeComponent();
            int i = 0;
            canvas_arr = new List<KEAPCanvas>();

            foreach (KEAPCanvas canvas in main.canvas_List)
            {
                bool ani_null = false;
                if (!main.animation_Dictionary.Keys.Contains(i)) ani_null = true;
                else animations = main.animation_Dictionary;
                List<Dictionary<int, string>> anilist = new List<Dictionary<int,string>>();
                if (ani_null)
                    anilist = null;
                else
                {
                //    if (i < animations.Count)
                    Dictionary<int, string>[] ani_arr = new Dictionary<int,string>[main.animation_Dictionary[i].Count];
                    //main.animation_Dictionary[i].CopyTo(animations);
                    main.animation_Dictionary[i].CopyTo(ani_arr);
                    for (int k = 0; k < main.animation_Dictionary[i].Count;k++)
                    {
                        Dictionary<int,string> tempdic = new Dictionary<int,string>();
                        tempdic.Add(ani_arr[k].Keys.First(),ani_arr[k].Values.First());
                        anilist.Add(tempdic);
                    }
                //    else
                //        anilist = null;
                }
                canvas_arr.Add(new KEAPCanvas());
                canvas_arr[i].Width = SystemParameters.WorkArea.Width;
                canvas_arr[i].Height = SystemParameters.PrimaryScreenHeight;
                canvas_arr[i].Background = canvas.Background;

                for (int j=0; j<main.canvas_List[i].Children.Count; j++)
                {
                    UIElement ele = main.canvas_List[i].Children[j];
                    if (ele is EditableTextBlock)
                    {
                        EditableTextBlock copyele = ele as EditableTextBlock;
                        EditableTextBlock textblock = new EditableTextBlock()
                        {
                            Text = copyele.Text,
                            Width = copyele.Width * (SystemParameters.WorkArea.Width / canvas.Width),
                            Height = copyele.Height * (SystemParameters.PrimaryScreenHeight / canvas.Height),
                            FontSize = copyele.FontSize,
                            TextAlignment = copyele.TextAlignment,
                            Effect = copyele.Effect,
                            FontWeight = copyele.FontWeight,
                            FontFamily = copyele.FontFamily,
                            Background = copyele.Background,
                            Foreground = copyele.Foreground,
                            TextDecorations = copyele.TextDecorations
                        };
                        Canvas.SetLeft(textblock, Canvas.GetLeft(copyele) * (SystemParameters.WorkArea.Width / canvas.Width) );
                        Canvas.SetTop(textblock, Canvas.GetTop(copyele) * (SystemParameters.PrimaryScreenHeight / canvas.Height) );

                        canvas_arr[i].Children.Add(textblock);
                    }
                    else if (ele is Polygon)
                    {
                        Polygon copyele = ele as Polygon;
                        Polygon polygon = new Polygon()
                        {
                            Points = copyele.Points,
                            Stroke = copyele.Stroke,
                            StrokeThickness = copyele.StrokeThickness,
                            Fill = copyele.Fill
                        };

                        Point[] copy_points = new Point[polygon.Points.Count];
                        PointCollection copy_collection = new PointCollection();
                        polygon.Points.CopyTo(copy_points, 0);
                        for (int p = 0; p < polygon.Points.Count; p++)
                        {
                            copy_points[p].X = copy_points[p].X * (SystemParameters.WorkArea.Width / canvas.Width) ;
                            copy_points[p].Y = copy_points[p].Y * (SystemParameters.PrimaryScreenHeight / canvas.Height) ;
                            copy_collection.Add(copy_points[p]);
                        }
                        polygon.Points = copy_collection;

                        canvas_arr[i].Children.Add(polygon);
                    }
                    else if (ele is Line)
                    {
                        Line copyele = ele as Line;
                        Line line = new Line()
                        {
                            X1 = copyele.X1 * (SystemParameters.WorkArea.Width / canvas.Width) ,
                            Y1 = copyele.Y1 * (SystemParameters.PrimaryScreenHeight / canvas.Height) ,
                            X2 = copyele.X2 * (SystemParameters.WorkArea.Width / canvas.Width) ,
                            Y2 = copyele.Y2 * (SystemParameters.PrimaryScreenHeight / canvas.Height) ,
                            Stroke = copyele.Stroke,
                            StrokeThickness = copyele.StrokeThickness,
                        };

                        canvas_arr[i].Children.Add(line);
                    }
                    else if (ele is Image)
                    {
                        Image copyele = ele as Image;
                        Image image = new Image()
                        {
                            Source = copyele.Source,
                            Width = copyele.Width * (SystemParameters.WorkArea.Width / canvas.Width) ,
                            Height = copyele.Height * (SystemParameters.PrimaryScreenHeight / canvas.Height)
                        };
                        Canvas.SetLeft(image, Canvas.GetLeft(copyele) * (SystemParameters.WorkArea.Width / canvas.Width) );
                        Canvas.SetTop(image, Canvas.GetTop(copyele) * (SystemParameters.PrimaryScreenHeight / canvas.Height) );

                        canvas_arr[i].Children.Add(image);
                    }
                    else if (ele is Rectangle)
                    {
                        Rectangle copyele = ele as Rectangle;
                        Rectangle rectangle = new Rectangle()
                        {
                            Width = copyele.Width * (SystemParameters.WorkArea.Width / canvas.Width) ,
                            Height = copyele.Height * (SystemParameters.PrimaryScreenHeight / canvas.Height) ,
                            Fill = copyele.Fill,
                            Stroke = copyele.Stroke,
                            StrokeThickness = copyele.StrokeThickness
                        };
                        Canvas.SetLeft(rectangle, Canvas.GetLeft(copyele) * (SystemParameters.WorkArea.Width / canvas.Width) );
                        Canvas.SetTop(rectangle, Canvas.GetTop(copyele) * (SystemParameters.PrimaryScreenHeight / canvas.Height) );

                        canvas_arr[i].Children.Add(rectangle);
                    }
                    else if (ele is Ellipse)
                    {
                        Ellipse copyele = ele as Ellipse;
                        Ellipse ellipse = new Ellipse()
                        {
                            Width = copyele.Width * (SystemParameters.WorkArea.Width / canvas.Width) ,
                            Height = copyele.Height * (SystemParameters.PrimaryScreenHeight / canvas.Height) ,
                            Fill = copyele.Fill,
                            Stroke = copyele.Stroke,
                            StrokeThickness = copyele.StrokeThickness
                        };
                        Canvas.SetLeft(ellipse, Canvas.GetLeft(copyele) * (SystemParameters.WorkArea.Width / canvas.Width) );
                        Canvas.SetTop(ellipse, Canvas.GetTop(copyele) * (SystemParameters.PrimaryScreenHeight / canvas.Height) );

                        canvas_arr[i].Children.Add(ellipse);
                    }
                    //canvas_arr[i].Measure(new Size(SystemParameters.WorkArea.Width, SystemParameters.MaximizedPrimaryScreenHeight));
                    //canvas_arr[i].Arrange(new Rect(0, 0, SystemParameters.WorkArea.Width, SystemParameters.MaximizedPrimaryScreenHeight));
                }
                if (anilist != null)
                {
                    foreach (Dictionary<int, string> dic in anilist)
                    {
                        string ani = dic[dic.Keys.First()];
                        if (ani.Contains("Bounds") || ani.Contains("Move") || ani.Contains("FadeIn")
                            || ani.Contains("Interlaced") || ani.Contains("Block") || ani.Contains("Circle") || ani.Contains("Radial") || ani.Contains("WaterFall"))
                        {
                            canvas_arr[i].Children[dic.Keys.First()].Visibility = Visibility.Collapsed;
                        }
                    }
                }
                i++;
            }

            /*
            for(i=0; i<main.animation_Dictionary.Count; i++)
            {
                animations.Add(i,new Dictionary<int,string>[main.animation_Dictionary[i].Count()]);
                main.animation_Dictionary[i].CopyTo(animations[i]);
            }*/
            DefaultPageNum = main.DefaultCanvasNum;
        }