public void RegisterTemplate(SessionTemplate template)
        {
            _canvas   = template.LayoutPanel;
            _template = template;

            foreach (var item in _canvas.Children)
            {
                elements.Add(new LayoutElement(item as UIElement, _canvas));
            }

            try
            {
                _canvas.MouseEnter += _canvas_MouseEnter;
                _canvas.MouseDown  += _canvas_MouseDown;
                _canvas.MouseUp    += _canvas_MouseUp;
                _canvas.MouseMove  += _canvas_MouseMove;
                _canvas.MouseLeave += _canvas_MouseLeave;
                _canvas.MouseWheel += _canvas_MouseWheel;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            _template.ChildElementAdded += delegate(object sender, EventArgs a)
            {
                elements.Add(new LayoutElement(sender as UIElement, _canvas));
            };
        }
        public TemplateSettings()
        {
            InitializeComponent();

            try
            {
                KeyDown += TemplateSettings_KeyDown;

                template = Settings.CurrentTemplate;

                layoutManager = new LayoutTemplateManager();
                layoutManager.RegisterTemplate(template);

                template.AttachToControl(svPageContent);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            Loaded += delegate
            {
                NavigationService.Navigating += NavigationService_Navigating;
            };
        }
        public TemplatePreview(SessionTemplate template, SessionTemplateCollection sessionPhotos)
        {
            InitializeComponent();
            _template = template;
            template.AttachToControl(frPreview);

            var i = 0;

            foreach (Canvas pose in template.Poses)
            {
                var image = new Image();
                image.Width   = pose.Width;
                image.Height  = pose.Height;
                image.Source  = sessionPhotos[i].Image;
                image.Stretch = Stretch.Uniform;
                pose.Children.Add(image);
                pose.Background = new SolidColorBrush(Colors.Transparent);

                i++;
            }
        }
Beispiel #4
0
        public SharePhotos(SessionTemplateCollection sessionPhotos)
        {
            InitializeComponent();
            _sessionPhotos = sessionPhotos;

            _template = Settings.CurrentTemplate;

            _templatePreview = new TemplatePreview(_template, sessionPhotos);
            frPreview.Navigate(_templatePreview);

            var brush = new ImageBrush();
            var sMgr  = new SessionManager();

            gifStream         = sMgr.GenerateGifStream(sessionPhotos);
            brush.ImageSource = sMgr.ImageFromStream(gifStream);

            btnPreviewGif.Background = brush;

            var templateBrush = new ImageBrush();

            templateBrush.ImageSource = _template.RenderToBitmap();

            btnPreviewTemplate.Background = templateBrush;
        }