Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/15/18 12:07:16 (6 years ago)
Author:
gkronber
Message:

#2925 merged changes r15972:16382 from trunk to branch

Location:
branches/2925_AutoDiffForDynamicalModels
Files:
2 deleted
9 edited
4 copied

Legend:

Unmodified
Added
Removed
  • branches/2925_AutoDiffForDynamicalModels

  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Access.Views

  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Access.Views/3.3/HeuristicLab.Clients.Access.Views-3.3.csproj

    r11623 r16386  
    147147      <DependentUpon>LightweightUserInformationView.cs</DependentUpon>
    148148    </Compile>
     149    <Compile Include="UserViews\RefreshableLightweightAccessClientInformationView.cs">
     150      <SubType>UserControl</SubType>
     151    </Compile>
     152    <Compile Include="UserViews\RefreshableLightweightAccessClientInformationView.Designer.cs">
     153      <DependentUpon>RefreshableLightweightAccessClientInformationView.cs</DependentUpon>
     154    </Compile>
     155    <Compile Include="UserViews\LightweightUserView.cs">
     156      <SubType>UserControl</SubType>
     157    </Compile>
     158    <Compile Include="UserViews\LightweightUserView.Designer.cs">
     159      <DependentUpon>LightweightUserView.cs</DependentUpon>
     160    </Compile>
     161    <Compile Include="UserViews\RefreshableLightweightAccessClientView.cs">
     162      <SubType>UserControl</SubType>
     163    </Compile>
     164    <Compile Include="UserViews\RefreshableLightweightAccessClientView.Designer.cs">
     165      <DependentUpon>RefreshableLightweightAccessClientView.cs</DependentUpon>
     166    </Compile>
    149167    <Compile Include="UserViews\RefreshableLightweightUserInformationView.cs">
    150168      <SubType>UserControl</SubType>
     
    152170    <Compile Include="UserViews\RefreshableLightweightUserInformationView.Designer.cs">
    153171      <DependentUpon>RefreshableLightweightUserInformationView.cs</DependentUpon>
    154     </Compile>
    155     <Compile Include="UserViews\LightweightUserView.cs">
    156       <SubType>UserControl</SubType>
    157     </Compile>
    158     <Compile Include="UserViews\LightweightUserView.Designer.cs">
    159       <DependentUpon>LightweightUserView.cs</DependentUpon>
    160     </Compile>
    161     <Compile Include="UserViews\RefreshableLightweightUserView.cs">
    162       <SubType>UserControl</SubType>
    163     </Compile>
    164     <Compile Include="UserViews\RefreshableLightweightUserView.Designer.cs">
    165       <DependentUpon>RefreshableLightweightUserView.cs</DependentUpon>
    166172    </Compile>
    167173    <Compile Include="UserViews\RefreshableView.cs">
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Access.Views/3.3/UserViews/LightweightUserInformationView.cs

    r15583 r16386  
    6565    }
    6666
     67    protected override void SetEnabledStateOfControls() {
     68      base.SetEnabledStateOfControls();
     69      bool enabled = Content != null && !Locked;
     70      //userNameTextBox.ReadOnly = !enabled;
     71      fullNameTextBox.ReadOnly = !enabled;
     72      emailTextBox.ReadOnly = !enabled;
     73      //rolesListView.Enabled = enabled;
     74      //groupsListView.Enabled = enabled;
     75      changePasswordButton.Enabled = enabled;
     76    }
     77
    6778    private void changePasswordButton_Click(object sender, System.EventArgs e) {
    6879      using (ChangePasswordDialog dialog = new ChangePasswordDialog()) {
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Access.Views/3.3/UserViews/LightweightUserView.cs

    r15583 r16386  
    5959      base.SetEnabledStateOfControls();
    6060      this.showDetailsCheckBox.Enabled = false;
     61      bool enabled = Content != null && !Locked;
     62      addButton.Enabled = enabled;
     63      removeButton.Enabled = enabled;
     64      moveDownButton.Enabled = enabled;
     65      moveUpButton.Enabled = enabled;
    6166    }
    6267
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Access.Views/3.3/UserViews/RefreshableLightweightUserInformationView.Designer.cs

    r15583 r16386  
    2020#endregion
    2121
    22 using System;
    2322namespace HeuristicLab.Clients.Access.Views {
    2423  partial class RefreshableLightweightUserInformationView {
     
    3433    protected override void Dispose(bool disposing) {
    3534      if (disposing && (components != null)) {
    36         lightweightUserInformationView.UserInformationChanged -= new EventHandler(lightweightUserInformationView_Changed);
    3735        components.Dispose();
    3836      }
     
    4745    /// </summary>
    4846    private void InitializeComponent() {
     47      components = new System.ComponentModel.Container();
    4948      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RefreshableLightweightUserInformationView));
    5049      this.lightweightUserInformationView = new HeuristicLab.Clients.Access.Views.LightweightUserInformationView();
    51       this.storeButton = new System.Windows.Forms.Button();
     50      this.refreshButton = new System.Windows.Forms.Button();
     51      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    5252      this.SuspendLayout();
    5353      //
    5454      // refreshButton
    5555      //
     56      this.refreshButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh;
    5657      this.refreshButton.Location = new System.Drawing.Point(4, 3);
     58      this.refreshButton.Name = "refreshButton";
     59      this.refreshButton.Size = new System.Drawing.Size(24, 24);
     60      this.refreshButton.TabIndex = 1;
     61      this.toolTip.SetToolTip(this.refreshButton, "Refresh data");
     62      this.refreshButton.UseVisualStyleBackColor = true;
     63      this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
    5764      //
    5865      // lightweightUserInformationView
     
    6976      this.lightweightUserInformationView.TabIndex = 2;
    7077      //
    71       // storeButton
    72       //
    73       this.storeButton.Enabled = false;
    74       this.storeButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb;
    75       this.storeButton.Location = new System.Drawing.Point(34, 3);
    76       this.storeButton.Name = "storeButton";
    77       this.storeButton.Size = new System.Drawing.Size(24, 24);
    78       this.storeButton.TabIndex = 3;
    79       this.storeButton.UseVisualStyleBackColor = true;
    80       this.storeButton.Click += new System.EventHandler(this.storeButton_Click);
    81       //
    8278      // RefreshableLightweightUserInformationView
    8379      //
     
    8581      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    8682      this.Controls.Add(this.lightweightUserInformationView);
    87       this.Controls.Add(this.storeButton);
     83      this.Controls.Add(this.refreshButton);
    8884      this.Name = "RefreshableLightweightUserInformationView";
    8985      this.Size = new System.Drawing.Size(384, 281);
    90       this.Controls.SetChildIndex(this.storeButton, 0);
    9186      this.Controls.SetChildIndex(this.lightweightUserInformationView, 0);
    92       this.Controls.SetChildIndex(this.refreshButton, 0);
     87      this.Controls.SetChildIndex(this.refreshButton, 1);
    9388      this.ResumeLayout(false);
    9489
     
    9893
    9994    private LightweightUserInformationView lightweightUserInformationView;
    100     private System.Windows.Forms.Button storeButton;
    101 
     95    private System.Windows.Forms.ToolTip toolTip;
     96    private System.Windows.Forms.Button refreshButton;
    10297  }
    10398}
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Access.Views/3.3/UserViews/RefreshableLightweightUserInformationView.cs

    r15583 r16386  
    2222using System;
    2323using System.Windows.Forms;
     24using HeuristicLab.MainForm;
     25using HeuristicLab.MainForm.WindowsForms;
    2426
    2527namespace HeuristicLab.Clients.Access.Views {
    26   public partial class RefreshableLightweightUserInformationView : RefreshableView {
     28  [View("RefreshableLightweightUserInformation View")]
     29  [Content(typeof(LightweightUser), false)]
     30  public partial class RefreshableLightweightUserInformationView : AsynchronousContentView {
     31    public new LightweightUser Content {
     32      get { return (LightweightUser)base.Content; }
     33      set { base.Content = value; }
     34    }
     35
    2736    public RefreshableLightweightUserInformationView() {
    2837      InitializeComponent();
     38    }
     39
     40    protected override void OnContentChanged() {
     41      base.OnContentChanged();
     42      lightweightUserInformationView.Content = Content;
     43    }
     44
     45    protected override void SetEnabledStateOfControls() {
     46      base.SetEnabledStateOfControls();
     47      this.Locked = true;
     48      refreshButton.Enabled = Content != null;
     49    }
     50
     51    protected override void DeregisterContentEvents() {
     52      Refreshing -= new EventHandler(Content_Refreshing);
     53      Refreshed -= new EventHandler(Content_Refreshed);
     54      base.DeregisterContentEvents();
     55    }
     56
     57    protected override void RegisterContentEvents() {
     58      base.RegisterContentEvents();
     59      Refreshing += new EventHandler(Content_Refreshing);
     60      Refreshed += new EventHandler(Content_Refreshed);
     61    }
     62
     63    protected void Content_Refreshing(object sender, EventArgs e) {
     64      if (InvokeRequired) {
     65        Invoke(new EventHandler(Content_Refreshing), sender, e);
     66      } else {
     67        Cursor = Cursors.AppStarting;
     68        refreshButton.Enabled = false;
     69
     70        lightweightUserInformationView.Enabled = false;
     71      }
     72    }
     73
     74    protected void Content_Refreshed(object sender, EventArgs e) {
     75      if (InvokeRequired) {
     76        Invoke(new EventHandler(Content_Refreshed), sender, e);
     77      } else {
     78        Cursor = Cursors.Default;
     79        refreshButton.Enabled = true;
     80
     81        lightweightUserInformationView.Enabled = true;
     82        if (!UserInformation.Instance.UserExists) {
     83          MessageBox.Show("Couldn't fetch user information from the server." + Environment.NewLine +
     84            "Please verify that you have an existing user and that your user name and password is correct. ", "HeuristicLab Access Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
     85          lightweightUserInformationView.Content = null;
     86        } else {
     87          lightweightUserInformationView.Content = Content;
     88        }
     89      }
     90    }
     91
     92    void lightweightUserInformationView_Changed(object sender, EventArgs e) {
     93      // nothing to do
    2994    }
    3095
     
    3499    }
    35100
    36     void lightweightUserInformationView_Changed(object sender, EventArgs e) {
    37       if (!storeButton.Enabled) storeButton.Enabled = true;
     101    private void RefreshData() {
     102      ExecuteActionAsync(RefreshUserData, PluginInfrastructure.ErrorHandling.ShowErrorDialog);
    38103    }
    39104
    40     protected override void RefreshData() {
    41       Content.ExecuteActionAsync(RefreshUserData, PluginInfrastructure.ErrorHandling.ShowErrorDialog);
     105    public void ManualRefresh() {
     106      RefreshData();
    42107    }
    43108
    44     protected override void Content_Refreshing(object sender, EventArgs e) {
    45       if (InvokeRequired) {
    46         Invoke(new EventHandler(Content_Refreshing), sender, e);
    47       } else {
    48         base.Content_Refreshing(sender, e);
    49         lightweightUserInformationView.Enabled = false;
    50         storeButton.Enabled = false;
    51       }
     109    protected void refreshButton_Click(object sender, System.EventArgs e) {
     110      RefreshData();
    52111    }
    53112
    54     protected override void Content_Refreshed(object sender, EventArgs e) {
    55       if (InvokeRequired) {
    56         Invoke(new EventHandler(Content_Refreshed), sender, e);
    57       } else {
    58         base.Content_Refreshed(sender, e);
    59         lightweightUserInformationView.Enabled = true;
    60         if (!UserInformation.Instance.UserExists) {
    61           MessageBox.Show("Couldn't fetch user information from the server." + Environment.NewLine +
    62             "Please verify that you have an existing user and that your user name and password is correct. ", "HeuristicLab Access Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
    63           lightweightUserInformationView.Content = null;
    64         } else {
    65           lightweightUserInformationView.Content = UserInformation.Instance.User;
     113    public void ExecuteActionAsync(Action action, Action<Exception> exceptionCallback) {
     114      var call = new Func<Exception>(delegate () {
     115        try {
     116          OnRefreshing();
     117          action();
     118        } catch (Exception ex) {
     119          return ex;
     120        } finally {
     121          OnRefreshed();
    66122        }
    67       }
     123        return null;
     124      });
     125      call.BeginInvoke(delegate (IAsyncResult result) {
     126        Exception ex = call.EndInvoke(result);
     127        if (ex != null) exceptionCallback(ex);
     128      }, null);
    68129    }
    69130
    70     private void storeButton_Click(object sender, EventArgs e) {
    71       AccessClient.Instance.ExecuteActionAsync(new Action(delegate {
    72         AccessClient.CallAccessService(x => x.UpdateLightweightUser(UserInformation.Instance.User));
    73       }), HeuristicLab.PluginInfrastructure.ErrorHandling.ShowErrorDialog);
     131    #region Events
     132    public event EventHandler Refreshing;
     133    private void OnRefreshing() {
     134      EventHandler handler = Refreshing;
     135      if (handler != null) handler(this, EventArgs.Empty);
    74136    }
     137    public event EventHandler Refreshed;
     138    private void OnRefreshed() {
     139      EventHandler handler = Refreshed;
     140      if (handler != null) handler(this, EventArgs.Empty);
     141    }
     142    #endregion
    75143  }
    76144}
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Access.Views/3.3/UserViews/RefreshableView.Designer.cs

    r15583 r16386  
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      components = new System.ComponentModel.Container();
    4748      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RefreshableView));
    4849      this.refreshButton = new System.Windows.Forms.Button();
     50      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    4951      this.SuspendLayout();
    5052      //
     
    5658      this.refreshButton.Size = new System.Drawing.Size(24, 24);
    5759      this.refreshButton.TabIndex = 1;
     60      this.toolTip.SetToolTip(this.refreshButton, "Refresh data");
    5861      this.refreshButton.UseVisualStyleBackColor = true;
    5962      this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
     
    7275    #endregion
    7376
     77    private System.Windows.Forms.ToolTip toolTip;
    7478    protected System.Windows.Forms.Button refreshButton;
    7579  }
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Access.Views/3.3/UserViews/UserInformationDialog.Designer.cs

    r15583 r16386  
    4646    private void InitializeComponent() {
    4747      this.closeButton = new System.Windows.Forms.Button();
    48       this.refreshableLightweightUserInformationView = new HeuristicLab.Clients.Access.Views.RefreshableLightweightUserInformationView();
     48      this.refreshableLightweightUserInformationView = new HeuristicLab.Clients.Access.Views.RefreshableLightweightAccessClientInformationView();
    4949      this.SuspendLayout();
    5050      //
     
    9595    #endregion
    9696
    97     private RefreshableLightweightUserInformationView refreshableLightweightUserInformationView;
     97    private RefreshableLightweightAccessClientInformationView refreshableLightweightUserInformationView;
    9898    private System.Windows.Forms.Button closeButton;
    9999  }
Note: See TracChangeset for help on using the changeset viewer.