Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8141


Ignore:
Timestamp:
06/27/12 20:17:54 (12 years ago)
Author:
jkarder
Message:

#1648: fixed Control.Enabled state handling

Location:
trunk/sources
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Access.Administration/3.3/Views/RefreshableRoleListView.cs

    r8042 r8141  
    5050        base.Content_Refreshed(sender, e);
    5151        roleListView.Enabled = true;
    52         storeButton.Enabled = true;
    5352        roleListView.Content = Content.Roles;
    5453        if (Content.Roles != null) {
     54          storeButton.Enabled = true;
    5555          Content.Roles.ItemsRemoved += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<Role>>(Roles_ItemsRemoved);
    5656        }
  • trunk/sources/HeuristicLab.Clients.Access.Administration/3.3/Views/RefreshableUserGroupListView.cs

    r8042 r8141  
    5050        base.Content_Refreshed(sender, e);
    5151        userGroupListView.Enabled = true;
    52         storeButton.Enabled = true;
    5352        userGroupListView.Content = Content.Groups;
    5453        if (Content.Groups != null) {
     54          storeButton.Enabled = true;
    5555          Content.Groups.ItemsRemoved += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<UserGroup>>(Groups_ItemsRemoved);
    5656        }
  • trunk/sources/HeuristicLab.Clients.Access.Administration/3.3/Views/RefreshableUserListView.cs

    r8042 r8141  
    5050        base.Content_Refreshed(sender, e);
    5151        userListView.Enabled = true;
    52         storeButton.Enabled = true;
    5352        userListView.Content = Content.Users;
    5453        if (Content.Users != null) {
     54          storeButton.Enabled = true;
    5555          Content.Users.ItemsRemoved += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<User>>(Users_ItemsRemoved);
    5656        }
  • trunk/sources/HeuristicLab.Clients.Access.Administration/3.3/Views/UserGroupView.Designer.cs

    r8042 r8141  
    8686      // storeButton
    8787      //
     88      this.storeButton.Enabled = false;
    8889      this.storeButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb;
    8990      this.storeButton.Location = new System.Drawing.Point(31, 58);
  • trunk/sources/HeuristicLab.Clients.Access.Administration/3.3/Views/UserGroupView.cs

    r8042 r8141  
    3838    }
    3939
     40    protected override void RegisterContentEvents() {
     41      base.RegisterContentEvents();
     42      Access.AccessClient.Instance.Refreshing += new EventHandler(Content_Refreshing);
     43      refreshableLightweightUserView.StorableStateChanged += new EventHandler(refreshableLightweightUserView_StorableStateChanged);
     44    }
     45
     46    protected override void DeregisterContentEvents() {
     47      Access.AccessClient.Instance.Refreshing -= new EventHandler(Content_Refreshing);
     48      refreshableLightweightUserView.StorableStateChanged -= new EventHandler(refreshableLightweightUserView_StorableStateChanged);
     49      base.DeregisterContentEvents();
     50    }
     51
    4052    protected override void OnContentChanged() {
    4153      base.OnContentChanged();
     
    5163        idTextBox.Text = Content.Id.ToString();
    5264
    53         refreshableLightweightUserView.Content = Access.AccessClient.Instance;
    54         refreshableLightweightUserView.FetchSelectedUsers = new Func<List<Guid>>(delegate { return AccessAdministrationClient.CallAccessService<List<Guid>>(s => s.GetUserGroupIdsOfGroup(Content.Id)); });
     65        refreshableLightweightUserView.Content = Content.Id != Guid.Empty ? Access.AccessClient.Instance : null;
     66        refreshableLightweightUserView.FetchSelectedUsers = Content.Id != Guid.Empty ? new Func<List<Guid>>(delegate { return AccessAdministrationClient.CallAccessService<List<Guid>>(s => s.GetUserGroupIdsOfGroup(Content.Id)); }) : null;
    5567      }
    5668    }
     
    7789      AccessAdministrationClient.Instance.ExecuteActionAsync(deleteAction, PluginInfrastructure.ErrorHandling.ShowErrorDialog);
    7890    }
     91
     92    private void Content_Refreshing(object sender, EventArgs e) {
     93      storeButton.Enabled = false;
     94    }
     95
     96    private void refreshableLightweightUserView_StorableStateChanged(object sender, EventArgs e) {
     97      storeButton.Enabled = true;
     98    }
    7999  }
    80100}
  • trunk/sources/HeuristicLab.Clients.Access.Administration/3.3/Views/UserView.cs

    r8042 r8141  
    5757        lastActivityTextBox.Text = Content.LastActivityDate.ToString();
    5858        lastLoginTextBox.Text = Content.LastLoginDate.ToString();
    59         refreshableRoleSelectionListView.Content = AccessAdministrationClient.Instance;
     59        refreshableRoleSelectionListView.Content = Content.Id != Guid.Empty ? AccessAdministrationClient.Instance : null;
    6060        refreshableRoleSelectionListView.CurrentUser = Content;
    6161      }
  • trunk/sources/HeuristicLab.Clients.Access.Views/3.3/UserViews/RefreshableLightweightUserView.cs

    r8042 r8141  
    7676
    7777      lightweightUserView.Content = new ItemList<UserGroupBase>(Content.UsersAndGroups.Where(x => selectedUsers.Contains(x.Id)));
     78      if (lightweightUserView.Content != null) OnStorableStateChanged();
    7879    }
    7980
     
    112113    }
    113114
     115    public event EventHandler StorableStateChanged;
     116    protected virtual void OnStorableStateChanged() {
     117      if (InvokeRequired)
     118        Invoke((MethodInvoker)OnStorableStateChanged);
     119      else {
     120        EventHandler handler = StorableStateChanged;
     121        if (handler != null)
     122          handler(this, EventArgs.Empty);
     123      }
     124    }
     125
    114126    private void lightweightUserView_SelectedUsersChanged(object sender, EventArgs e) {
    115127      OnSelectedUsersChanged();
Note: See TracChangeset for help on using the changeset viewer.