~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/Main/ICSharpCode.Core.WinForms/MessageService/SaveErrorInformDialog.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Drawing;
 
6
using System.IO;
 
7
using System.Windows.Forms;
 
8
 
 
9
namespace ICSharpCode.Core.WinForms
 
10
{
 
11
        /// <summary>
 
12
        ///     Add summary description for SaveErrorInformDialog
 
13
        /// </summary>
 
14
        sealed class SaveErrorInformDialog : System.Windows.Forms.Form 
 
15
        {
 
16
                System.Windows.Forms.Label   descriptionLabel;
 
17
                System.Windows.Forms.TextBox descriptionTextBox;
 
18
                System.Windows.Forms.Button  exceptionButton;
 
19
                System.Windows.Forms.Button  okButton;
 
20
                
 
21
                string    displayMessage;
 
22
                Exception exceptionGot;
 
23
                
 
24
                public SaveErrorInformDialog(string fileName, string message, string dialogName, Exception exceptionGot) 
 
25
                {
 
26
                        this.Text = StringParser.Parse(dialogName);
 
27
                        //  Must be called for initialization
 
28
                        this.InitializeComponent2();
 
29
                        RightToLeftConverter.ConvertRecursive(this);
 
30
                        
 
31
                        displayMessage = StringParser.Parse(
 
32
                                message,
 
33
                                new StringTagPair("FileName", fileName),
 
34
                                new StringTagPair("Path",     Path.GetDirectoryName(fileName)),
 
35
                                new StringTagPair("FileNameWithoutPath", Path.GetFileName(fileName)),
 
36
                                new StringTagPair("Exception", exceptionGot.GetType().FullName)
 
37
                        );
 
38
                        descriptionTextBox.Lines = this.displayMessage.Split('\n');
 
39
                        
 
40
                        this.exceptionGot = exceptionGot;
 
41
                }
 
42
                
 
43
                void ShowException(object sender, EventArgs e)
 
44
                {
 
45
                        MessageService.ShowMessage(exceptionGot.ToString(), "Exception got");
 
46
                }
 
47
                
 
48
                /// <summary>
 
49
                ///     This method was autogenerated - do not change the contents manually
 
50
                /// </summary>
 
51
                private void InitializeComponent2() 
 
52
                {
 
53
                        //
 
54
                        //  Set up generated class SaveErrorInformDialog
 
55
                        // 
 
56
                        this.ClientSize = new Size(508, 320);
 
57
                        this.SuspendLayout();
 
58
                        // 
 
59
                        //  Set up member descriptionLabel
 
60
                        // 
 
61
                        this.descriptionLabel = new System.Windows.Forms.Label();
 
62
                        this.descriptionLabel.Location = new System.Drawing.Point(8, 8);
 
63
                        this.descriptionLabel.Size = new System.Drawing.Size(584, 24);
 
64
                        this.descriptionLabel.TabIndex = 3;
 
65
                        this.descriptionLabel.Anchor = (System.Windows.Forms.AnchorStyles.Top 
 
66
                                                | (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right));
 
67
                        this.descriptionLabel.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
 
68
                        this.descriptionLabel.Text = StringParser.Parse("${res:ICSharpCode.Core.Services.ErrorDialogs.DescriptionLabel}");
 
69
                        this.descriptionLabel.Name = "descriptionLabel";
 
70
                        this.Controls.Add(descriptionLabel);
 
71
                        
 
72
                        // 
 
73
                        //  Set up member descriptionTextBox
 
74
                        // 
 
75
                        this.descriptionTextBox = new System.Windows.Forms.TextBox();
 
76
                        this.descriptionTextBox.Name = "descriptionTextBox";
 
77
                        this.descriptionTextBox.Multiline = true;
 
78
                        this.descriptionTextBox.Size = new System.Drawing.Size(584, 237);
 
79
                        this.descriptionTextBox.Location = new System.Drawing.Point(8, 40);
 
80
                        this.descriptionTextBox.TabIndex = 2;
 
81
                        this.descriptionTextBox.Anchor = (System.Windows.Forms.AnchorStyles.Top 
 
82
                                                | (System.Windows.Forms.AnchorStyles.Bottom 
 
83
                                                | (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
 
84
                        this.descriptionTextBox.ReadOnly = true;
 
85
                        this.Controls.Add(descriptionTextBox);
 
86
                        
 
87
                        // 
 
88
                        //  Set up member exceptionButton
 
89
                        // 
 
90
                        this.exceptionButton = new System.Windows.Forms.Button();
 
91
                        this.exceptionButton.TabIndex = 1;
 
92
                        this.exceptionButton.Name = "exceptionButton";
 
93
                        this.exceptionButton.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
 
94
                        this.exceptionButton.Text = StringParser.Parse("${res:ICSharpCode.Core.Services.ErrorDialogs.ShowExceptionButton}");
 
95
                        this.exceptionButton.Size = new System.Drawing.Size(120, 27);
 
96
                        this.exceptionButton.Location = new System.Drawing.Point(372, 285);
 
97
                        this.exceptionButton.Click += new EventHandler(ShowException);
 
98
                        this.Controls.Add(exceptionButton);
 
99
                        
 
100
                        // 
 
101
                        //  Set up member chooseLocationButton
 
102
                        // 
 
103
                        this.okButton = new System.Windows.Forms.Button();
 
104
                        this.okButton.Name = "okButton";
 
105
                        this.okButton.TabIndex = 0;
 
106
                        this.okButton.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
 
107
                        this.okButton.Text = StringParser.Parse("${res:Global.OKButtonText}");
 
108
                        this.okButton.Size = new System.Drawing.Size(120, 27);
 
109
                        this.okButton.Location = new System.Drawing.Point(244, 285);
 
110
                        this.okButton.DialogResult = DialogResult.OK;
 
111
                        this.Controls.Add(okButton);
 
112
                        
 
113
                        
 
114
                        this.MaximizeBox = false;
 
115
                        this.Name = "SaveErrorInformDialog";
 
116
                        this.MinimizeBox = false;
 
117
                        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
 
118
                        this.ShowInTaskbar = false;
 
119
                        this.StartPosition = FormStartPosition.CenterScreen;
 
120
                        
 
121
                        this.ResumeLayout(false);
 
122
                        this.Size = new System.Drawing.Size(526, 262);
 
123
                }
 
124
        }
 
125
}