ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/AnywhereTS-MSSQL/trunk/CSDLL/frmClientBootPicture.cs
Revision: 4
Committed: Wed Jul 11 14:19:13 2012 UTC (10 years, 10 months ago) by william
File size: 4880 byte(s)
Log Message:
imported from https://anywherets.svn.sourceforge.net/svnroot/anywherets/trunk/
Revision: 1
Author: beartown
Date: 3:10:40 AM, Monday, June 21, 2010
Message:
First upload. Still todo in order to get a fully working product: Replace Thinstation images with vanilla Thinstation, modify ImageDesigntimeConfig.cs, ImageRuntimeConfig.cs in order to support the Thinstation image

File Contents

# Content
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Text;
7 using System.Windows.Forms;
8 using System.Drawing.Imaging;
9 using System.Drawing.Drawing2D;
10
11 using System.IO;
12
13 namespace AnywhereTS
14 {
15
16 public partial class frmClientBootPicture : Form
17 {
18
19 public ATSImage currentImage = null; // The current client configuration. Will be set by caller.
20
21 public frmClientBootPicture()
22 {
23 InitializeComponent();
24 }
25
26 private void btnLoad_Click(object sender, EventArgs e)
27 {
28 bool exitDialog = false;
29 do
30 {
31 try
32 {
33 OpenFileDialog open = new OpenFileDialog();
34 open.Filter = "Image Files(*.jpg; *.jpeg;)|*.jpg; *.jpeg;";
35 if (open.ShowDialog() == DialogResult.OK)
36 {
37 // Open picture file
38 currentImage.DesigntimeConfig.BootPicture.CustomPicture = new Bitmap(open.FileName);
39
40 // Display boot picture on form.
41 picBoot.Image = currentImage.DesigntimeConfig.BootPicture.CustomPicture;
42 }
43 exitDialog = true;
44 }
45
46 catch (Exception)
47 {
48 MessageBox.Show("Could not open file. Unknown format.", "AnywhereTS");
49 }
50 } while (!exitDialog);
51 }
52
53
54 private void frmClientBootPicture_Load(object sender, EventArgs e)
55 {
56 helpProvider.HelpNamespace = ATSGlobals.strHelpFilePath; // Initiate helpProvider
57
58 // Display boot picture resolution
59 switch (currentImage.DesigntimeConfig.BootPicture.Width)
60 {
61 case 640:
62 radBootPicRes640.Checked = true; // 640x480
63 break;
64 case 800:
65 radBootPicRes800.Checked = true; // 800x600
66 break;
67 case 1024:
68 radBootPicRes1024.Checked = true; // 1024x768
69 break;
70 case 1280:
71 radBootPicRes1280.Checked = true; // 1280x1024
72 break;
73 default:
74 MessageBox.Show("ERROR unknown boot picture resolution (49488)", "AnywhereTS");
75 radBootPicRes1024.Checked = true; // Default to 1024x768
76 break;
77 }
78
79 // Display boot picture
80 picBoot.Image = currentImage.DesigntimeConfig.BootPicture.CustomPicture;
81 }
82
83 private void btnOk_Click(object sender, EventArgs e)
84 {
85 // Parse boot picture resolution
86 if (radBootPicRes640.Checked)
87 {
88 currentImage.DesigntimeConfig.BootPicture.Width = 640;
89 currentImage.DesigntimeConfig.BootPicture.Height = 480;
90 }
91 else if (radBootPicRes800.Checked)
92 {
93 currentImage.DesigntimeConfig.BootPicture.Width = 800;
94 currentImage.DesigntimeConfig.BootPicture.Height = 600;
95 }
96 else if (radBootPicRes1024.Checked)
97 {
98 currentImage.DesigntimeConfig.BootPicture.Width = 1024;
99 currentImage.DesigntimeConfig.BootPicture.Height = 768;
100 }
101 else if (radBootPicRes1280.Checked)
102 {
103 currentImage.DesigntimeConfig.BootPicture.Width = 1280;
104 currentImage.DesigntimeConfig.BootPicture.Height = 1024;
105 }
106
107 // Check size
108 if (currentImage.DesigntimeConfig.BootPicture.CustomPicture.Width != currentImage.DesigntimeConfig.BootPicture.Width || currentImage.DesigntimeConfig.BootPicture.CustomPicture.Height != currentImage.DesigntimeConfig.BootPicture.Height)
109 {
110 MessageBox.Show(
111 "The source image is not of the selected size. Image will be resized(" +
112 currentImage.DesigntimeConfig.BootPicture.CustomPicture.Width.ToString() + "x" +
113 currentImage.DesigntimeConfig.BootPicture.CustomPicture.Height.ToString() + " > " +
114 currentImage.DesigntimeConfig.BootPicture.Width.ToString() + "x" +
115 currentImage.DesigntimeConfig.BootPicture.Height.ToString() + ").", "AnywhereTS");
116 currentImage.DesigntimeConfig.BootPicture.ImageResize();
117
118
119 }
120 currentImage.DesigntimeConfig.BootPicture.Type = 1; // Custom boot picture.
121
122 DialogResult = DialogResult.OK;
123 }
124 }
125 }