Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/17/13 10:05:34 (11 years ago)
Author:
ascheibe
Message:

#2100 merged r9915-r9916, r9920-r9921, r9935 into stable branch

Location:
stable
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.MainForm.WindowsForms/3.3/Dialogs/InfoBox.cs

    r9916 r9977  
    2727namespace HeuristicLab.MainForm.WindowsForms {
    2828  public partial class InfoBox : Form {
    29     public string Caption {
    30       get { return this.Text; }
    31       set {
    32         if (InvokeRequired)
    33           Invoke(new Action<string>(x => this.Text = x), value);
    34         else
    35           this.Text = value;
    36       }
     29    protected string embeddedResourceName;
     30    protected IView parentView;
     31
     32    public InfoBox(string caption, string embeddedResourceName, IView parentView) {
     33      InitializeComponent();
     34      this.Text = caption;
     35      this.parentView = parentView;
     36      this.embeddedResourceName = embeddedResourceName;
    3737    }
    3838
    39     protected string embeddedResourceName;
    40     public string EmbeddedResourceName {
    41       get { return embeddedResourceName; }
    42       set {
    43         if (InvokeRequired)
    44           Invoke(new Action<string>(x => this.EmbeddedResourceName = x), value);
    45         else {
    46           embeddedResourceName = value;
    47           LoadEmbeddedResource(embeddedResourceName);
    48         }
    49       }
    50     }
    51 
    52     public IView ParentView { get; set; }
    53 
    54     public InfoBox() {
    55       InitializeComponent();
    56     }
    57 
    58     public InfoBox(string caption, string embeddedResourceName, IView parentView)
    59       : this() {
    60       Caption = caption;
    61       ParentView = parentView;
    62       EmbeddedResourceName = embeddedResourceName;
    63     }
    64 
    65     protected virtual void LoadEmbeddedResource(string resourceName) {
    66       string extension = Path.GetExtension(resourceName);
    67       Assembly assembly = Assembly.GetAssembly(ParentView.GetType());
     39    protected virtual void LoadEmbeddedResource() {
     40      string extension = Path.GetExtension(embeddedResourceName);
     41      Assembly assembly = Assembly.GetAssembly(parentView.GetType());
    6842      try {
    69         using (Stream stream = assembly.GetManifestResourceStream(resourceName)) {
     43        using (Stream stream = assembly.GetManifestResourceStream(embeddedResourceName)) {
    7044          if (extension == ".rtf") {
    7145            infoRichTextBox.LoadFile(stream, RichTextBoxStreamType.RichText);
     
    8256    }
    8357
    84     protected virtual void okButton_Click(object sender, EventArgs e) {
    85       Close();
     58    private void InfoBox_Load(object sender, EventArgs e) {
     59      LoadEmbeddedResource();
    8660    }
    8761  }
Note: See TracChangeset for help on using the changeset viewer.