Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/25/10 03:32:18 (14 years ago)
Author:
swagner
Message:

Worked on OKB (#1174)

Location:
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmDataView.Designer.cs

    r4481 r4492  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
    48       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AlgorithmDataView));
    4948      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    5049      this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
     
    109108      this.viewHost.Caption = "View";
    110109      this.viewHost.Content = null;
    111       this.viewHost.Enabled = false;
     110      this.viewHost.Enabled = true;
    112111      this.viewHost.Location = new System.Drawing.Point(6, 19);
    113112      this.viewHost.Name = "viewHost";
     
    131130      // newDataButton
    132131      //
    133       this.newDataButton.Image = ((System.Drawing.Image)(resources.GetObject("newDataButton.Image")));
     132      this.newDataButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.NewDocument;
    134133      this.newDataButton.Location = new System.Drawing.Point(90, 0);
    135134      this.newDataButton.Name = "newDataButton";
     
    142141      // saveFileButton
    143142      //
    144       this.saveFileButton.Image = ((System.Drawing.Image)(resources.GetObject("saveFileButton.Image")));
     143      this.saveFileButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save;
    145144      this.saveFileButton.Location = new System.Drawing.Point(150, 0);
    146145      this.saveFileButton.Name = "saveFileButton";
     
    153152      // openFileButton
    154153      //
    155       this.openFileButton.Image = ((System.Drawing.Image)(resources.GetObject("openFileButton.Image")));
     154      this.openFileButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Open;
    156155      this.openFileButton.Location = new System.Drawing.Point(120, 0);
    157156      this.openFileButton.Name = "openFileButton";
     
    174173      // refreshDataButton
    175174      //
    176       this.refreshDataButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshDataButton.Image")));
     175      this.refreshDataButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Refresh;
    177176      this.refreshDataButton.Location = new System.Drawing.Point(0, 0);
    178177      this.refreshDataButton.Name = "refreshDataButton";
     
    185184      // storeDataButton
    186185      //
    187       this.storeDataButton.Image = ((System.Drawing.Image)(resources.GetObject("storeDataButton.Image")));
     186      this.storeDataButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.PublishToWeb;
    188187      this.storeDataButton.Location = new System.Drawing.Point(30, 0);
    189188      this.storeDataButton.Name = "storeDataButton";
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmDataView.cs

    r4481 r4492  
    2121
    2222using System;
     23using System.ComponentModel;
    2324using System.IO;
    2425using System.Linq;
     
    3637  [Content(typeof(AlgorithmData), true)]
    3738  public partial class AlgorithmDataView : AsynchronousContentView {
    38     public long AlgorithmId { get; set; }
     39    private long algorithmId;
     40    public long AlgorithmId {
     41      get { return algorithmId; }
     42      set {
     43        algorithmId = value;
     44        if (Content != null) {
     45          Content.AlgorithmId = value;
     46          SetEnabledStateOfControls();
     47        }
     48      }
     49    }
    3950
    4051    public new AlgorithmData Content {
     
    5162      dataTypeComboBox.DataSource = Administrator.Instance.DataTypes.ToList();
    5263      dataTypeComboBox.SelectedIndex = -1;
     64    }
     65
     66    protected override void DeregisterContentEvents() {
     67      Content.PropertyChanged -= new PropertyChangedEventHandler(Content_PropertyChanged);
     68      base.DeregisterContentEvents();
     69    }
     70    protected override void RegisterContentEvents() {
     71      base.RegisterContentEvents();
     72      Content.PropertyChanged += new PropertyChangedEventHandler(Content_PropertyChanged);
    5373    }
    5474
     
    7999    protected override void SetEnabledStateOfControls() {
    80100      base.SetEnabledStateOfControls();
    81       storeDataButton.Enabled = saveFileButton.Enabled = Content != null;
    82       dataTypeComboBox.Enabled = Content != null && viewHost.Content == null;
     101      newDataButton.Enabled = !ReadOnly;
     102      openFileButton.Enabled = !ReadOnly;
     103      saveFileButton.Enabled = (Content != null) && (((Content.Data != null) && (Content.Data.Length != 0)) || (viewHost.Content != null));
     104      storeDataButton.Enabled = saveFileButton.Enabled && (Content.AlgorithmId != 0) && !ReadOnly;
     105      dataTypeComboBox.Enabled = Content != null && viewHost.Content == null && !ReadOnly;
    83106      fileTextBox.Enabled = Content != null;
    84107      groupBox.Enabled = Content != null;
    85108    }
    86109
     110    private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) {
     111      switch (e.PropertyName) {
     112        case "DataTypeId":
     113          dataTypeComboBox.SelectedItem = Administrator.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId);
     114          break;
     115      }
     116    }
     117
    87118    private void refreshDataButton_Click(object sender, EventArgs e) {
    88       AlgorithmData data = Administrator.Instance.GetAlgorithmData(AlgorithmId);
    89       Content = data;
     119      BeginAsyncCall();
     120      var call = new Action(delegate() {
     121        AlgorithmData data = Administrator.Instance.GetAlgorithmData(AlgorithmId);
     122        Content = data;
     123      });
     124      call.BeginInvoke(delegate(IAsyncResult result) {
     125        call.EndInvoke(result);
     126        EndAsyncCall();
     127      }, null);
    90128    }
    91129    private void storeDataButton_Click(object sender, EventArgs e) {
     
    95133            IAlgorithm algorithm = viewHost.Content as IAlgorithm;
    96134            algorithm.Prepare(true);
    97             algorithm.Problem = null;
    98135            XmlGenerator.Serialize(algorithm, stream);
    99136            stream.Close();
     
    114151        if (dialog.ShowDialog(this) == DialogResult.OK) {
    115152          try {
    116             if (Content == null) Content = new AlgorithmData { AlgorithmId = AlgorithmId, Data = new byte[0] };
     153            if (Content == null) Content = new AlgorithmData { AlgorithmId = AlgorithmId };
    117154            viewHost.Content = (IContent)dialog.TypeSelector.CreateInstanceOfSelectedType();
    118155            DataType dataType = Administrator.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);
    119156            if (dataType == null) {
    120               dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "Blob" };
     157              dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "varbinary" };
    121158              dataType.PlatformId = Administrator.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;
    122 
    123               Administrator.Instance.Store(dataType);
     159              dataType.Store();
    124160              Administrator.Instance.DataTypes.Add(dataType);
    125161              dataTypeComboBox.DataSource = Administrator.Instance.DataTypes.OrderBy(d => d.Name).ToList();
    126162            }
    127163            dataTypeComboBox.SelectedItem = dataType;
    128             dataTypeComboBox.Enabled = false;
    129164            fileTextBox.Text = "-";
    130165            noViewAvailableLabel.Visible = false;
     166            SetEnabledStateOfControls();
    131167          }
    132168          catch (Exception ex) {
     
    139175      if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
    140176        try {
    141           if (Content == null) Content = new AlgorithmData { AlgorithmId = AlgorithmId, Data = new byte[0] };
     177          if (Content == null) Content = new AlgorithmData { AlgorithmId = AlgorithmId };
    142178          IAlgorithm algorithm = null;
    143179          try {
     
    151187            DataType dataType = Administrator.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);
    152188            if (dataType == null) {
    153               dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "Blob" };
     189              dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "varbinary" };
    154190              dataType.PlatformId = Administrator.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;
    155 
    156               Administrator.Instance.Store(dataType);
     191              dataType.Store();
    157192              Administrator.Instance.DataTypes.Add(dataType);
    158193              dataTypeComboBox.DataSource = Administrator.Instance.DataTypes.OrderBy(d => d.Name).ToList();
     
    169204            }
    170205          }
    171           dataTypeComboBox.Enabled = viewHost.Content == null;
    172206          fileTextBox.Text = openFileDialog.FileName;
     207          SetEnabledStateOfControls();
    173208        }
    174209        catch (Exception ex) {
     
    198233      if (Content != null) Content.DataTypeId = ((DataType)dataTypeComboBox.SelectedItem).Id;
    199234    }
     235
     236    private void BeginAsyncCall() {
     237      if (InvokeRequired)
     238        Invoke(new Action(BeginAsyncCall));
     239      else {
     240        Cursor = Cursors.AppStarting;
     241        Enabled = false;
     242      }
     243    }
     244    private void EndAsyncCall() {
     245      if (InvokeRequired)
     246        Invoke(new Action(EndAsyncCall));
     247      else {
     248        Cursor = Cursors.Default;
     249        Enabled = true;
     250      }
     251    }
    200252  }
    201253}
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmView.Designer.cs

    r4481 r4492  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AlgorithmView));
    4847      this.platformLabel = new System.Windows.Forms.Label();
    4948      this.platformComboBox = new System.Windows.Forms.ComboBox();
     
    5756      this.dataTabPage = new System.Windows.Forms.TabPage();
    5857      this.algorithmDataView = new HeuristicLab.Clients.OKB.AlgorithmDataView();
    59       ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).BeginInit();
    6058      this.tabControl.SuspendLayout();
    6159      this.usersTabPage.SuspendLayout();
     
    6664      //
    6765      this.nameTextBox.Location = new System.Drawing.Point(90, 29);
    68       this.nameTextBox.Size = new System.Drawing.Size(495, 20);
     66      this.nameTextBox.Size = new System.Drawing.Size(543, 20);
    6967      //
    7068      // descriptionTextBox
    7169      //
    7270      this.descriptionTextBox.Location = new System.Drawing.Point(90, 55);
    73       this.descriptionTextBox.Size = new System.Drawing.Size(495, 20);
     71      this.descriptionTextBox.Size = new System.Drawing.Size(543, 20);
    7472      //
    7573      // storeButton
    7674      //
    7775      this.toolTip.SetToolTip(this.storeButton, "Store Data");
    78       //
    79       // modifiedPictureBox
    80       //
    81       this.modifiedPictureBox.Location = new System.Drawing.Point(591, 3);
    8276      //
    8377      // platformLabel
     
    9892      this.platformComboBox.Location = new System.Drawing.Point(90, 81);
    9993      this.platformComboBox.Name = "platformComboBox";
    100       this.platformComboBox.Size = new System.Drawing.Size(495, 21);
     94      this.platformComboBox.Size = new System.Drawing.Size(543, 21);
    10195      this.platformComboBox.TabIndex = 6;
    10296      this.platformComboBox.SelectedValueChanged += new System.EventHandler(this.platformComboBox_SelectedValueChanged);
     
    119113      this.algorithmClassComboBox.Location = new System.Drawing.Point(90, 108);
    120114      this.algorithmClassComboBox.Name = "algorithmClassComboBox";
    121       this.algorithmClassComboBox.Size = new System.Drawing.Size(495, 21);
     115      this.algorithmClassComboBox.Size = new System.Drawing.Size(543, 21);
    122116      this.algorithmClassComboBox.TabIndex = 8;
    123117      this.algorithmClassComboBox.SelectedValueChanged += new System.EventHandler(this.algorithmClassComboBox_SelectedValueChanged);
     
    165159      // storeUsersButton
    166160      //
    167       this.storeUsersButton.Image = ((System.Drawing.Image)(resources.GetObject("storeUsersButton.Image")));
     161      this.storeUsersButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.PublishToWeb;
    168162      this.storeUsersButton.Location = new System.Drawing.Point(36, 6);
    169163      this.storeUsersButton.Name = "storeUsersButton";
     
    176170      // refreshUsersButton
    177171      //
    178       this.refreshUsersButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshUsersButton.Image")));
     172      this.refreshUsersButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Refresh;
    179173      this.refreshUsersButton.Location = new System.Drawing.Point(6, 6);
    180174      this.refreshUsersButton.Name = "refreshUsersButton";
     
    198192      // algorithmDataView
    199193      //
     194      this.algorithmDataView.AlgorithmId = ((long)(0));
    200195      this.algorithmDataView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    201196                  | System.Windows.Forms.AnchorStyles.Left)
     
    224219      this.Controls.SetChildIndex(this.platformComboBox, 0);
    225220      this.Controls.SetChildIndex(this.tabControl, 0);
    226       this.Controls.SetChildIndex(this.modifiedPictureBox, 0);
    227221      this.Controls.SetChildIndex(this.storeButton, 0);
    228222      this.Controls.SetChildIndex(this.nameTextBox, 0);
     
    230224      this.Controls.SetChildIndex(this.descriptionLabel, 0);
    231225      this.Controls.SetChildIndex(this.descriptionTextBox, 0);
    232       ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).EndInit();
    233226      this.tabControl.ResumeLayout(false);
    234227      this.usersTabPage.ResumeLayout(false);
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmView.cs

    r4481 r4492  
    4646    }
    4747
    48     protected override void DeregisterContentEvents() {
    49       // ...
    50       base.DeregisterContentEvents();
    51     }
    52     protected override void RegisterContentEvents() {
    53       base.RegisterContentEvents();
    54       // ...
    55     }
    56 
    5748    protected override void OnContentChanged() {
    5849      base.OnContentChanged();
     
    7263    protected override void SetEnabledStateOfControls() {
    7364      base.SetEnabledStateOfControls();
    74       platformComboBox.Enabled = Content != null;
    75       algorithmClassComboBox.Enabled = Content != null;
     65      platformComboBox.Enabled = (Content != null) && !ReadOnly;
     66      algorithmClassComboBox.Enabled = (Content != null) && !ReadOnly;
    7667      refreshUsersButton.Enabled = Content != null;
    77       storeUsersButton.Enabled = usersListBox.DataSource != null;
    78       usersListBox.Enabled = usersListBox.DataSource != null;
     68      storeUsersButton.Enabled = (usersListBox.DataSource != null) && !ReadOnly;
     69      usersListBox.Enabled = (usersListBox.DataSource != null) && !ReadOnly;
    7970      algorithmDataView.Enabled = Content != null;
    8071    }
     
    8273    protected override void OnContentPropertyChanged(string propertyName) {
    8374      switch (propertyName) {
     75        case "Id":
     76          algorithmDataView.AlgorithmId = Content.Id;
     77          break;
    8478        case "PlatformId":
    8579          platformComboBox.SelectedItem = Administrator.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
     
    113107        foreach (Guid id in ids)
    114108          usersListBox.SelectedItems.Add(users.First(u => u.Id == id));
    115         usersListBox.Enabled = true;
     109        usersListBox.Enabled = !ReadOnly;
    116110        storeUsersButton.Enabled = false;
    117111      }
     
    122116    }
    123117    private void usersListBox_SelectedIndexChanged(object sender, EventArgs e) {
    124       storeUsersButton.Enabled = true;
     118      storeUsersButton.Enabled = !ReadOnly;
    125119    }
    126120  }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/DataTypeView.Designer.cs

    r4466 r4492  
    4848      this.nameTextBox = new System.Windows.Forms.TextBox();
    4949      this.sqlNameLabel = new System.Windows.Forms.Label();
    50       this.sqlNameTextBox = new System.Windows.Forms.TextBox();
    5150      this.platformLabel = new System.Windows.Forms.Label();
    5251      this.platformComboBox = new System.Windows.Forms.ComboBox();
    53       ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).BeginInit();
     52      this.comboBox1 = new System.Windows.Forms.ComboBox();
     53      this.sqlNameComboBox = new System.Windows.Forms.ComboBox();
    5454      this.SuspendLayout();
    5555      //
     
    5757      //
    5858      this.toolTip.SetToolTip(this.storeButton, "Store Data");
    59       //
    60       // modifiedPictureBox
    61       //
    62       this.modifiedPictureBox.Location = new System.Drawing.Point(308, 3);
    6359      //
    6460      // nameLabel
     
    7773      this.nameTextBox.Location = new System.Drawing.Point(71, 29);
    7874      this.nameTextBox.Name = "nameTextBox";
    79       this.nameTextBox.Size = new System.Drawing.Size(231, 20);
     75      this.nameTextBox.Size = new System.Drawing.Size(279, 20);
    8076      this.nameTextBox.TabIndex = 2;
    8177      this.nameTextBox.TextChanged += new System.EventHandler(this.nameTextBox_TextChanged);
     
    9187      this.sqlNameLabel.Text = "&SQL Name:";
    9288      //
    93       // sqlNameTextBox
    94       //
    95       this.sqlNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    96                   | System.Windows.Forms.AnchorStyles.Right)));
    97       this.sqlNameTextBox.Location = new System.Drawing.Point(71, 55);
    98       this.sqlNameTextBox.Name = "sqlNameTextBox";
    99       this.sqlNameTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
    100       this.sqlNameTextBox.Size = new System.Drawing.Size(231, 20);
    101       this.sqlNameTextBox.TabIndex = 4;
    102       this.sqlNameTextBox.TextChanged += new System.EventHandler(this.sqlNameTextBox_TextChanged);
    103       this.sqlNameTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.sqlNameTextBox_KeyDown);
    104       //
    10589      // platformLabel
    10690      //
    10791      this.platformLabel.AutoSize = true;
    108       this.platformLabel.Location = new System.Drawing.Point(3, 84);
     92      this.platformLabel.Location = new System.Drawing.Point(3, 85);
    10993      this.platformLabel.Name = "platformLabel";
    11094      this.platformLabel.Size = new System.Drawing.Size(48, 13);
     
    118102      this.platformComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    119103      this.platformComboBox.FormattingEnabled = true;
    120       this.platformComboBox.Location = new System.Drawing.Point(71, 81);
     104      this.platformComboBox.Location = new System.Drawing.Point(71, 82);
    121105      this.platformComboBox.Name = "platformComboBox";
    122       this.platformComboBox.Size = new System.Drawing.Size(231, 21);
     106      this.platformComboBox.Size = new System.Drawing.Size(279, 21);
    123107      this.platformComboBox.TabIndex = 6;
    124108      this.platformComboBox.SelectedValueChanged += new System.EventHandler(this.platformComboBox_SelectedValueChanged);
     109      //
     110      // comboBox1
     111      //
     112      this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     113                  | System.Windows.Forms.AnchorStyles.Right)));
     114      this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     115      this.comboBox1.FormattingEnabled = true;
     116      this.comboBox1.Location = new System.Drawing.Point(71, 55);
     117      this.comboBox1.Name = "comboBox1";
     118      this.comboBox1.Size = new System.Drawing.Size(279, 21);
     119      this.comboBox1.TabIndex = 6;
     120      this.comboBox1.SelectedValueChanged += new System.EventHandler(this.platformComboBox_SelectedValueChanged);
     121      //
     122      // sqlNameComboBox
     123      //
     124      this.sqlNameComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     125                  | System.Windows.Forms.AnchorStyles.Right)));
     126      this.sqlNameComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     127      this.sqlNameComboBox.FormattingEnabled = true;
     128      this.sqlNameComboBox.Items.AddRange(new object[] {
     129            "bigint",
     130            "bit",
     131            "float",
     132            "nvarchar",
     133            "varbinary"});
     134      this.sqlNameComboBox.Location = new System.Drawing.Point(71, 55);
     135      this.sqlNameComboBox.Name = "sqlNameComboBox";
     136      this.sqlNameComboBox.Size = new System.Drawing.Size(279, 21);
     137      this.sqlNameComboBox.TabIndex = 4;
     138      this.sqlNameComboBox.SelectedValueChanged += new System.EventHandler(this.sqlNameComboBox_SelectedValueChanged);
    125139      //
    126140      // DataTypeView
     
    128142      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    129143      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     144      this.Controls.Add(this.sqlNameComboBox);
     145      this.Controls.Add(this.comboBox1);
    130146      this.Controls.Add(this.platformComboBox);
    131       this.Controls.Add(this.sqlNameTextBox);
    132147      this.Controls.Add(this.platformLabel);
    133148      this.Controls.Add(this.sqlNameLabel);
     
    135150      this.Controls.Add(this.nameTextBox);
    136151      this.Name = "DataTypeView";
    137       this.Size = new System.Drawing.Size(350, 229);
    138       this.Controls.SetChildIndex(this.modifiedPictureBox, 0);
     152      this.Size = new System.Drawing.Size(350, 126);
    139153      this.Controls.SetChildIndex(this.storeButton, 0);
    140154      this.Controls.SetChildIndex(this.nameTextBox, 0);
     
    142156      this.Controls.SetChildIndex(this.sqlNameLabel, 0);
    143157      this.Controls.SetChildIndex(this.platformLabel, 0);
    144       this.Controls.SetChildIndex(this.sqlNameTextBox, 0);
    145158      this.Controls.SetChildIndex(this.platformComboBox, 0);
    146       ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).EndInit();
     159      this.Controls.SetChildIndex(this.comboBox1, 0);
     160      this.Controls.SetChildIndex(this.sqlNameComboBox, 0);
    147161      this.ResumeLayout(false);
    148162      this.PerformLayout();
     
    155169    private System.Windows.Forms.Label nameLabel;
    156170    private System.Windows.Forms.Label sqlNameLabel;
    157     private System.Windows.Forms.TextBox sqlNameTextBox;
    158171    private System.Windows.Forms.Label platformLabel;
    159172    private System.Windows.Forms.ComboBox platformComboBox;
     173    private System.Windows.Forms.ComboBox comboBox1;
     174    private System.Windows.Forms.ComboBox sqlNameComboBox;
    160175  }
    161176}
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/DataTypeView.cs

    r4466 r4492  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Windows.Forms;
    24 using System.Linq;
    25 using HeuristicLab.Core.Views;
    2625using HeuristicLab.MainForm;
    2726using HeuristicLab.MainForm.WindowsForms;
     
    4948      if (Content == null) {
    5049        nameTextBox.Text = string.Empty;
    51         sqlNameTextBox.Text = string.Empty;
     50        sqlNameComboBox.SelectedIndex = -1;
    5251        platformComboBox.SelectedIndex = -1;
    5352        if (ViewAttribute.HasViewAttribute(this.GetType()))
     
    5756      } else {
    5857        nameTextBox.Text = Content.Name;
    59         sqlNameTextBox.Text = Content.SqlName;
     58        sqlNameComboBox.Text = Content.SqlName;
    6059        platformComboBox.SelectedItem = Administrator.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);
    6160        Caption = Content.Name;
     
    6564    protected override void SetEnabledStateOfControls() {
    6665      base.SetEnabledStateOfControls();
    67       if (Content == null) {
    68         nameTextBox.Enabled = false;
    69         sqlNameTextBox.Enabled = false;
    70         platformComboBox.Enabled = false;
    71       } else {
    72         nameTextBox.Enabled = true;
    73         nameTextBox.ReadOnly = ReadOnly;
    74         sqlNameTextBox.Enabled = true;
    75         sqlNameTextBox.ReadOnly = ReadOnly;
    76         platformComboBox.Enabled = true;
    77       }
     66      nameTextBox.Enabled = Content != null;
     67      nameTextBox.ReadOnly = ReadOnly;
     68      sqlNameComboBox.Enabled = (Content != null) && !ReadOnly;
     69      platformComboBox.Enabled = (Content != null) && !ReadOnly;
    7870    }
    7971
     
    8577          break;
    8678        case "SqlName":
    87           sqlNameTextBox.Text = Content.SqlName;
     79          sqlNameComboBox.Text = Content.SqlName;
    8880          break;
    8981        case "PlatformId":
     
    10597        Content.Name = nameTextBox.Text;
    10698    }
    107     private void sqlNameTextBox_KeyDown(object sender, KeyEventArgs e) {
    108       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
    109         sqlNameLabel.Focus();  // set focus on label to validate data
    110       if (e.KeyCode == Keys.Escape) {
    111         sqlNameTextBox.Text = Content.SqlName;
    112         sqlNameLabel.Focus();  // set focus on label to validate data
     99    private void sqlNameComboBox_SelectedValueChanged(object sender, EventArgs e) {
     100      if (sqlNameComboBox.Text != Content.SqlName) {
     101        Content.SqlName = sqlNameComboBox.Text;
    113102      }
    114     }
    115     private void sqlNameTextBox_TextChanged(object sender, EventArgs e) {
    116       if (sqlNameTextBox.Text != Content.SqlName)
    117         Content.SqlName = sqlNameTextBox.Text;
    118103    }
    119104    private void platformComboBox_SelectedValueChanged(object sender, System.EventArgs e) {
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/NamedOKBItemView.Designer.cs

    r4441 r4492  
    4949      this.descriptionLabel = new System.Windows.Forms.Label();
    5050      this.descriptionTextBox = new System.Windows.Forms.TextBox();
    51       ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).BeginInit();
    5251      this.SuspendLayout();
    5352      //
     
    5554      //
    5655      this.toolTip.SetToolTip(this.storeButton, "Store Data");
    57       //
    58       // modifiedPictureBox
    59       //
    60       this.modifiedPictureBox.Location = new System.Drawing.Point(308, 3);
    61       this.modifiedPictureBox.Size = new System.Drawing.Size(39, 130);
    6256      //
    6357      // nameLabel
     
    7670      this.nameTextBox.Location = new System.Drawing.Point(72, 29);
    7771      this.nameTextBox.Name = "nameTextBox";
    78       this.nameTextBox.Size = new System.Drawing.Size(230, 20);
     72      this.nameTextBox.Size = new System.Drawing.Size(278, 20);
    7973      this.nameTextBox.TabIndex = 2;
    8074      this.nameTextBox.TextChanged += new System.EventHandler(this.nameTextBox_TextChanged);
     
    9791      this.descriptionTextBox.Name = "descriptionTextBox";
    9892      this.descriptionTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
    99       this.descriptionTextBox.Size = new System.Drawing.Size(230, 20);
     93      this.descriptionTextBox.Size = new System.Drawing.Size(278, 20);
    10094      this.descriptionTextBox.TabIndex = 4;
    10195      this.descriptionTextBox.TextChanged += new System.EventHandler(this.descriptionTextBox_TextChanged);
     
    111105      this.Controls.Add(this.nameTextBox);
    112106      this.Name = "NamedOKBItemView";
    113       this.Size = new System.Drawing.Size(350, 229);
    114       this.Controls.SetChildIndex(this.modifiedPictureBox, 0);
     107      this.Size = new System.Drawing.Size(350, 93);
    115108      this.Controls.SetChildIndex(this.storeButton, 0);
    116109      this.Controls.SetChildIndex(this.nameTextBox, 0);
     
    118111      this.Controls.SetChildIndex(this.descriptionLabel, 0);
    119112      this.Controls.SetChildIndex(this.descriptionTextBox, 0);
    120       ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).EndInit();
    121113      this.ResumeLayout(false);
    122114      this.PerformLayout();
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/NamedOKBItemView.cs

    r4456 r4492  
    6060    protected override void SetEnabledStateOfControls() {
    6161      base.SetEnabledStateOfControls();
    62       if (Content == null) {
    63         nameTextBox.Enabled = false;
    64         descriptionTextBox.Enabled = false;
    65       } else {
    66         nameTextBox.Enabled = true;
    67         nameTextBox.ReadOnly = ReadOnly;
    68         descriptionTextBox.Enabled = true;
    69         descriptionTextBox.ReadOnly = ReadOnly;
    70       }
     62      nameTextBox.Enabled = Content != null;
     63      nameTextBox.ReadOnly = ReadOnly;
     64      descriptionTextBox.Enabled = Content != null;
     65      descriptionTextBox.ReadOnly = ReadOnly;
    7166    }
    7267
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/OKBItemView.Designer.cs

    r4441 r4492  
    4848      this.storeButton = new System.Windows.Forms.Button();
    4949      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    50       this.modifiedPictureBox = new System.Windows.Forms.PictureBox();
    51       ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).BeginInit();
    5250      this.SuspendLayout();
    5351      //
     
    6361      this.storeButton.Click += new System.EventHandler(this.storeButton_Click);
    6462      //
    65       // modifiedPictureBox
    66       //
    67       this.modifiedPictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    68       this.modifiedPictureBox.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.HighPriorityLarge;
    69       this.modifiedPictureBox.Location = new System.Drawing.Point(312, 3);
    70       this.modifiedPictureBox.Name = "modifiedPictureBox";
    71       this.modifiedPictureBox.Size = new System.Drawing.Size(39, 130);
    72       this.modifiedPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
    73       this.modifiedPictureBox.TabIndex = 1;
    74       this.modifiedPictureBox.TabStop = false;
    75       this.toolTip.SetToolTip(this.modifiedPictureBox, "Data Modified");
    76       this.modifiedPictureBox.Visible = false;
    77       //
    7863      // OKBItemView
    7964      //
    8065      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    8166      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    82       this.Controls.Add(this.modifiedPictureBox);
    8367      this.Controls.Add(this.storeButton);
    8468      this.Name = "OKBItemView";
    8569      this.Size = new System.Drawing.Size(354, 308);
    86       ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).EndInit();
    8770      this.ResumeLayout(false);
    8871
     
    9376    protected System.Windows.Forms.Button storeButton;
    9477    protected System.Windows.Forms.ToolTip toolTip;
    95     protected System.Windows.Forms.PictureBox modifiedPictureBox;
    9678
    9779
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/OKBItemView.cs

    r4441 r4492  
    5454    protected override void SetEnabledStateOfControls() {
    5555      base.SetEnabledStateOfControls();
    56       storeButton.Enabled = (Content != null) && Content.Modified;
    57       modifiedPictureBox.Visible = (Content != null) && Content.Modified;
     56      storeButton.Enabled = (Content != null) && !ReadOnly && Content.Modified;
    5857    }
    5958
     
    6968      if (InvokeRequired)
    7069        Invoke(new EventHandler(Content_ModifiedChanged), sender, e);
    71       else {
    72         storeButton.Enabled = Content.Modified;
    73         modifiedPictureBox.Visible = Content.Modified;
    74       }
     70      else
     71        SetEnabledStateOfControls();
    7572    }
    7673
Note: See TracChangeset for help on using the changeset viewer.