source: trunk/CrypPlugins/WorkspaceManager/View/VisualComponents/UserContentWrapper.xaml.cs @ 1847

Last change on this file since 1847 was 1847, checked in by kopal, 11 years ago
  • added support for serializing/deserializing pictures into model files
File size: 2.0 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows;
6using System.Windows.Controls;
7using System.Windows.Data;
8using System.Windows.Documents;
9using System.Windows.Input;
10using System.Windows.Media;
11using System.Windows.Media.Imaging;
12using System.Windows.Navigation;
13using System.Windows.Shapes;
14using WorkspaceManager.Model;
15
16namespace WorkspaceManager.View.VisualComponents
17{
18    /// <summary>
19    /// Interaction logic for UserContentWrapper.xaml
20    /// </summary>
21    public partial class UserContentWrapper : UserControl
22    {
23        public WorkspaceModel Model;
24        public List<ImageWrapper> ImageList { get; set; }
25        public List<TextBox> TextList { get; set; }
26
27        public UserContentWrapper(WorkspaceModel WorkspaceModel)
28        {
29            InitializeComponent();
30            (BottomBoxParent.Child as BottomBox).ImageSelected += new EventHandler<ImageSelectedEventArgs>(UserContentWrapper_ImageSelected);
31            ImageList = new List<ImageWrapper>();
32            TextList = new List<TextBox>();
33            this.Model = WorkspaceModel;
34            foreach (ImageModel ImageModel in WorkspaceModel.AllImageModels)
35            {
36                AddImage(ImageModel);
37            }
38        }
39
40        void UserContentWrapper_ImageSelected(object sender, ImageSelectedEventArgs e)
41        {
42            AddImage(e.uri, new Point(0, 0));
43        }
44
45        public void AddImage(Uri imgUri, Point point)
46        {
47            ImageModel model = Model.newImageModel(imgUri);
48            ImageWrapper imgWrap = new ImageWrapper(model, point);
49            ImageList.Add(imgWrap);
50            ContentRoot.Children.Add(imgWrap);
51        }
52
53        public void AddImage(ImageModel model)
54        {
55            ImageWrapper imgWrap = new ImageWrapper(model, model.Position);
56            ImageList.Add(imgWrap);
57            ContentRoot.Children.Add(imgWrap);
58        }
59    }
60}
Note: See TracBrowser for help on using the repository browser.