Ejemplo n.º 1
0
 private void add_Click(object sender, System.EventArgs e)
 {
     bool SharingIsDisabled = ifWebService.GetDisableSharingPolicy(currentUser.UserID, currentiFolder.ID, currentiFolder.OwnerID, currentiFolder.DomainID);
        if( SharingIsDisabled == true)
        {
     Picker picker = new Picker();
     picker.LoadPath = loadPath;
     picker.iFolderWebService = ifWebService;
     picker.Ht = userIDHT;
     picker.CurrentUser = currentUser;
     picker.DomainID = currentiFolder.DomainID;
     if (ownerLvi != null)
     {
      picker.CurrentOwner = newOwnerLvi == null ? ((ShareListMember)ownerLvi.Tag).iFolderUser : ((ShareListMember)newOwnerLvi.Tag).iFolderUser;
     }
     picker.CreateControl();
     DialogResult result = picker.ShowDialog();
     if (result == DialogResult.OK)
     {
      Cursor.Current = Cursors.WaitCursor;
      shareWith.SelectedItems.Clear();
      apply.Enabled = true;
      foreach (ListViewItem lvi in picker.AddedUsers)
      {
       iFolderUser user = picker.GetiFolderUserFromListViewItem(lvi);
       ListViewItem lvitem;
       lock (userIDHT)
       {
        lvitem = (ListViewItem)userIDHT[user.UserID];
       }
       if (lvitem == null)
       {
                     user.Rights = "ReadOnly";
        user.State = inviting;
        addiFolderUserToListView(user);
       }
      }
      foreach (iFolderUser ifUser in picker.RemovedList)
      {
       lock (subscrHT)
       {
        ListViewItem lvi = (ListViewItem)subscrHT[ifUser.ID];
        if (lvi != null)
        {
     if (removedList == null)
     {
      removedList = new ArrayList();
     }
     removedList.Add(lvi.Tag);
     lvi.Remove();
     subscrHT.Remove(ifUser.ID);
        }
        else
        {
     lock (userIDHT)
     {
      lvi = (ListViewItem)userIDHT[ifUser.UserID];
      if (lvi != null)
      {
       lvi.Remove();
      }
     }
        }
       }
       lock (userIDHT)
       {
        userIDHT.Remove(ifUser.UserID);
       }
      }
      Cursor.Current = Cursors.Default;
     }
        }
        else
        {
     MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("DisableSharingError"), resourceManager.GetString("PolicyViolation"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Information);
     mmb.ShowDialog();
        }
 }
Ejemplo n.º 2
0
 private void add_Click(object sender, System.EventArgs e)
 {
     Picker picker = new Picker();
        picker.LoadPath = loadPath;
        picker.iFolderWebService = ifWebService;
        picker.Ht = userIDHT;
        picker.CurrentUser = currentUser;
        picker.DomainID = currentiFolder.DomainID;
        if (ownerLvi != null)
        {
     picker.CurrentOwner = newOwnerLvi == null ? ((ShareListMember)ownerLvi.Tag).iFolderUser : ((ShareListMember)newOwnerLvi.Tag).iFolderUser;
        }
        picker.CreateControl();
        DialogResult result = picker.ShowDialog();
        if (result == DialogResult.OK)
        {
     Cursor.Current = Cursors.WaitCursor;
     shareWith.SelectedItems.Clear();
     apply.Enabled = true;
     foreach (ListViewItem lvi in picker.AddedUsers)
     {
      iFolderUser user = picker.GetiFolderUserFromListViewItem(lvi);
      ListViewItem lvitem;
      lock (userIDHT)
      {
       lvitem = (ListViewItem)userIDHT[user.UserID];
      }
      if (lvitem == null)
      {
       user.Rights = "ReadWrite";
       user.State = inviting;
       addiFolderUserToListView(user);
      }
     }
     foreach (iFolderUser ifUser in picker.RemovedList)
     {
      lock (subscrHT)
      {
       ListViewItem lvi = (ListViewItem)subscrHT[ifUser.ID];
       if (lvi != null)
       {
        if (removedList == null)
        {
     removedList = new ArrayList();
        }
        removedList.Add(lvi.Tag);
        lvi.Remove();
        subscrHT.Remove(ifUser.ID);
       }
       else
       {
        lock (userIDHT)
        {
     lvi = (ListViewItem)userIDHT[ifUser.UserID];
     if (lvi != null)
     {
      lvi.Remove();
     }
        }
       }
      }
      lock (userIDHT)
      {
       userIDHT.Remove(ifUser.UserID);
      }
     }
     Cursor.Current = Cursors.Default;
        }
 }