~alexharrington/xibo/pyclient-1.1.0a22

« back to all changes in this revision

Viewing changes to client/dotNET/Image.cs

  • Committer: Dan Garner
  • Date: 2008-12-14 14:42:52 UTC
  • mto: (1.1.80 Xibo)
  • mto: This revision was merged to the branch mainline in revision 2.
  • Revision ID: mail@dangarner.co.uk-20081214144252-8dosaegtfwvv0dsl
Moved 3rd Party libraries to their own folder.
Updated jQuery to the latest revision and now use jQuery UI instead of individual plugins.

Tabs are not currently working

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Xibo - Digitial Signage - http://www.xibo.org.uk
3
 
 * Copyright (C) 2006,2007,2008 Daniel Garner and James Packer
4
 
 *
5
 
 * This file is part of Xibo.
6
 
 *
7
 
 * Xibo is free software: you can redistribute it and/or modify
8
 
 * it under the terms of the GNU Affero General Public License as published by
9
 
 * the Free Software Foundation, either version 3 of the License, or
10
 
 * any later version. 
11
 
 *
12
 
 * Xibo is distributed in the hope that it will be useful,
13
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 * GNU Affero General Public License for more details.
16
 
 *
17
 
 * You should have received a copy of the GNU Affero General Public License
18
 
 * along with Xibo.  If not, see <http://www.gnu.org/licenses/>.
19
 
 */
20
 
using System;
21
 
using System.Collections.Generic;
22
 
using System.Drawing;
23
 
using System.Text;
24
 
using System.Windows.Forms;
25
 
 
26
 
namespace XiboClient
27
 
{
28
 
    class ImagePosition : Media
29
 
    {
30
 
        private string _filePath;
31
 
        PictureBox _pictureBox;
32
 
        
33
 
        public ImagePosition(RegionOptions options)
34
 
            : base(options.width, options.height, options.top, options.left)
35
 
        {
36
 
            _filePath = options.uri;
37
 
            
38
 
            if (!System.IO.File.Exists(_filePath))
39
 
            {
40
 
                // Exit
41
 
                System.Diagnostics.Trace.WriteLine(new LogMessage("Image - Dispose", "Cannot Create image object. Invalid Filepath."), LogType.Error.ToString());
42
 
                return;
43
 
            }
44
 
 
45
 
            try
46
 
            {
47
 
                _pictureBox = new PictureBox();
48
 
                _pictureBox.SizeMode = PictureBoxSizeMode.Zoom;
49
 
                _pictureBox.Image = new Bitmap(_filePath);
50
 
                _pictureBox.Size = new Size(width, height);
51
 
                _pictureBox.Location = new Point(0, 0);
52
 
                _pictureBox.BorderStyle = BorderStyle.None;
53
 
                _pictureBox.BackColor = Color.Transparent;
54
 
                
55
 
                this.Controls.Add(this._pictureBox);
56
 
            }
57
 
            catch (Exception ex)
58
 
            {
59
 
                System.Diagnostics.Trace.WriteLine(new LogMessage("ImagePosition", String.Format("Cannot create Image Object with exception: {0}", ex.Message)), LogType.Error.ToString());
60
 
            }
61
 
        }
62
 
 
63
 
        public override void RenderMedia()
64
 
        {
65
 
            base.RenderMedia();
66
 
        }
67
 
 
68
 
        protected override void Dispose(bool disposing)
69
 
        {
70
 
            if (disposing)
71
 
            {
72
 
                try
73
 
                {
74
 
                    Controls.Remove(_pictureBox);
75
 
 
76
 
                    _pictureBox.Image.Dispose();
77
 
                    _pictureBox.Dispose();
78
 
                }
79
 
                catch (Exception ex)
80
 
                {
81
 
                    System.Diagnostics.Trace.WriteLine(new LogMessage("Image - Dispose", String.Format("Cannot dispose Image Object with exception: {0}", ex.Message)), LogType.Error.ToString());
82
 
                }
83
 
            }
84
 
 
85
 
            base.Dispose(disposing);
86
 
        }
87
 
    }
88
 
}