示例#1
0
        private void Delete_Execute(object sender, ExecutedRoutedEventArgs e)
        {
            var items = GroupSelector.GetSelectedItems()
                        .ToArray();

            if (items.Length > 0)
            {
                foreach (var item in items)
                {
                    IRenderer targetRenderer = null;

                    if (item is IRenderer renderer)
                    {
                        targetRenderer = renderer;
                    }

                    if (item is ComponentElement element)
                    {
                        targetRenderer = item.GetRenderer();
                    }

                    if (targetRenderer != null)
                    {
                        DeleteLayer(targetRenderer);
                    }
                }

                GroupSelector.UnselectAll();
            }
        }
示例#2
0
 private void GroupSelector_SelectedItemChanged(object sender, EventArgs e)
 {
     propertyGrid.SelectedObjects = GroupSelector.GetSelectedItems()
                                    .Where(obj => obj is IRenderer)
                                    .Select(r => (DependencyObject)(r as IRenderer).Model)
                                    .ToArray();
 }
示例#3
0
        private void DeleteLayer(IRenderer renderer)
        {
            var element = renderer.Element;
            var parent  = renderer.RendererParent.Element;

            // Check Selected Parent
            if (RendererTreeHelper
                .FindParents <IRenderer>(renderer)
                .Count(r => GroupSelector.IsSelected(r as FrameworkElement)) > 0)
            {
                return;
            }

            // * Task *
            if (renderer is IRendererLayout lRenderer)
            {
                TaskManager?.Push(
                    new LayoutTaskData(
                        RendererTaskType.Remove,
                        lRenderer,
                        () => RemoveElement(parent, element, true),
                        () => AddElement(parent, element, true),
                        () => RemoveElement(parent, element)));
            }
            else if (renderer is IRendererElement eRenderer)
            {
                TaskManager?.Push(
                    new ElementTaskData(
                        RendererTaskType.Remove,
                        eRenderer,
                        () => RemoveElement(parent, element, true),
                        () => AddElement(parent, element, true),
                        () => RemoveElement(parent, element)));
            }
        }
示例#4
0
        /// <summary>
        /// Removes the supplied group from a workspace.
        /// </summary>
        /// <param name="eddsWorkspaceArtifactID"></param>
        /// <param name="group"></param>
        /// <returns></returns>
        public bool RemoveGroupFromWorkspace(Int32 eddsWorkspaceArtifactID, kCura.Relativity.Client.DTOs.Group group)
        {
            bool          success = false;
            GroupSelector groupSelector;

            using (var permissionManager = _helper.GetServicesManager().CreateProxy <IPermissionManager>(API.ExecutionIdentity.System))
            {
                groupSelector = permissionManager.GetWorkspaceGroupSelectorAsync(eddsWorkspaceArtifactID).Result;
            }
            GroupRef groupRef = groupSelector.EnabledGroups.FirstOrDefault(x => x.Name == group.Name);

            if (groupRef != null)
            {
                GroupSelector modifyGroupSelector = new GroupSelector()
                {
                    LastModified = groupSelector.LastModified
                };
                modifyGroupSelector.DisabledGroups.Add(groupRef);
                using (var permissionManager = _helper.GetServicesManager().CreateProxy <IPermissionManager>(API.ExecutionIdentity.System))
                {
                    permissionManager.AddRemoveWorkspaceGroupsAsync(eddsWorkspaceArtifactID, modifyGroupSelector).Wait();
                }
                success = true;
            }

            return(success);
        }
示例#5
0
    /// <summary>
    /// Prints out the object permissions for one of the groups inside a given workspace
    /// </summary>
    /// <param name="mgr">Object that implements IPermissionManager</param>
    /// <param name="workspaceId">Artifact ID of the workspace whose permissions we want to read</param>
    /// <returns></returns>
    public static async Task PrintGroupPermissions(IPermissionManager mgr, int workspaceId)
    {
        // get an enabled group
        GroupSelector sel = await mgr.GetWorkspaceGroupSelectorAsync(workspaceId);

        if (sel.EnabledGroups.Count > 0)
        {
            GroupRef firstGroup = sel.EnabledGroups.FirstOrDefault();
            // get the permissions associated with said group
            GroupPermissions permissions = await mgr.GetWorkspaceGroupPermissionsAsync(workspaceId, firstGroup);

            // print out Object Permissions
            Console.WriteLine("Permissions for members of {0}", firstGroup.Name);
            foreach (ObjectPermission objPerm in permissions.ObjectPermissions)
            {
                Console.WriteLine("Object Name: {0}", objPerm.Name);
                // we could print out others, but let's just print out if group
                // members can edit the object (true/false)
                Console.WriteLine("Can Edit: {0}", objPerm.EditSelected);
                Console.WriteLine();
            }
        }
        else
        {
            Console.WriteLine("No groups enabled for this workspace ({0})", workspaceId);
        }
    }
示例#6
0
        private void InitializeSelector()
        {
            this.AddSelectedHandler(OnSelected);
            this.AddUnselectedHandler(OnUnselected);

            if (!DesignTime.IsLocked(this))
            {
                GroupSelector.Select(this, true);
            }
        }
示例#7
0
        private void MoveThumb_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Keyboard.Focus(Storyboard);

            if (!GroupSelector.IsSelected(this))
            {
                cancelNextInvert = true;
                Select();
            }
        }
示例#8
0
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);

            GroupSelector.UnselectAll();

            if (this.Storyboard != null)
            {
                Keyboard.Focus(this.Storyboard);
            }
        }
示例#9
0
        public void Select()
        {
            // Design Mode Change
            if (GroupSelector.IsSelected(this))
            {
                InvertDesignMode();
            }

            // Select
            GroupSelector.Select(this, true,
                                 multiSelect: Keyboard.IsKeyDown(Key.LeftShift));
        }
示例#10
0
        /// <summary>
        /// 선택된 레이어를 가져옵니다.
        /// </summary>
        /// <returns></returns>
        protected StoryboardLayer GetSelectedLayer()
        {
            var items = GroupSelector.GetSelectedItems();

            if (items?.Count() == 1)
            {
                object item = items.First();

                if (item is StoryboardLayer layer)
                {
                    return(layer);
                }
            }

            return(null);
        }
示例#11
0
    /// <summary>
    /// Prints out the enabled and disabled groups for a given workspace
    /// </summary>
    /// <param name="mgr">Object that implements IPermissionManager</param>
    /// <param name="workspaceId">Artifact ID of the workspace whose permissions we want to read</param>
    /// <returns></returns>
    public static async Task ReadGroupsAsync(IPermissionManager mgr, int workspaceId)
    {
        GroupSelector sel = await mgr.GetWorkspaceGroupSelectorAsync(workspaceId);

        Console.WriteLine("Enabled groups:");
        foreach (GroupRef group in sel.EnabledGroups)
        {
            Console.WriteLine(group.Name);
        }
        Console.WriteLine("------");
        Console.WriteLine("Disabled Groups:");
        foreach (GroupRef group in sel.DisabledGroups)
        {
            Console.WriteLine(group.Name);
        }
    }
示例#12
0
        private void ESC_Execute(object sender, ExecutedRoutedEventArgs e)
        {
            // Component Box
            if (IsComponentBoxOpen)
            {
                CloseComponentBox();
                return;
            }

            // Selected Group
            if (GroupSelector.GetSelectedItemCount() > 1)
            {
                GroupSelector.UnselectAll();
                return;
            }

            // Selected Item
            var layer = GetSelectedLayer();

            if (layer == null)
            {
                GroupSelector.UnselectAll();
                return;
            }

            var prevLayer = layer.AdornedElement
                            .FindVisualParents <FrameworkElement>()
                            .Select(element => (StoryboardLayer)element.GetRenderer())
                            .Skip(1)
                            .FirstOrDefault(adorner => adorner != null && adorner is SelectionLayer);

            if (prevLayer != null)
            {
                GroupSelector.Select(prevLayer, true);
            }
            else
            {
                GroupSelector.UnselectAll();
            }
        }
示例#13
0
        /// <summary>
        /// Parent의 자식으로 등록된 Element를 삭제하고 <see cref="IRenderer"/> 및 레이어를 삭제합니다.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="element"></param>
        public void RemoveElement(FrameworkElement parent, FrameworkElement element, bool pushTask = false)
        {
            IRenderer parentRenderer = parent.GetRenderer();
            IRenderer childRenderer  = element.GetRenderer();

            // Selection Check
            if (GroupSelector.IsSelected(childRenderer as FrameworkElement))
            {
                GroupSelector.Select(childRenderer as SelectionLayer, false);
            }

            // Remove On AdornerLayer
            element.RemoveAdorner((Adorner)childRenderer);

            if (!pushTask)
            {
                // Dispose
                DestroyElement(parent, element);
            }

            if (parent.DataContext != null && parent.DataContext is DependencyObject dataContext)
            {
                // Remove On PObject Parent
                ObjectContentHelper.GetContent(
                    dataContext,
                    pi => pi.SetValue(dataContext, null),          // Single Content
                    list => list.SafeRemove(element.DataContext)); // List Content
            }

            // Remove On WPF Parent
            ObjectContentHelper.GetContent(
                parent,
                pi => pi.SetValue(parent, null),     // Single Content
                list => list.SafeRemove(element));   // List Content

            RemoveElementCore(childRenderer);

            // Notice child removed
            parentRenderer?.RemoveChild(childRenderer);
        }
示例#14
0
        /// <summary>
        /// Funzione di inizializzazione del behavior
        /// </summary>
        private void Init()
        {
            //se l'item source non è nullo
            if (ItemsSource != null)
            {
                //rimuovo ogni elemento dalla lista locale degli elementi gestiti
                for (int i = elements.Count - 1; i >= 0; i--)
                {
                    removeItem(elements[i]);
                }

                //se l'itemsource implementa l' INotifyCollectionChanged
                INotifyCollectionChanged iNot = ItemsSource as INotifyCollectionChanged;
                if (iNot != null)
                {
                    //Mi aggancio all'evento di collection changed per gestire l'aggiunta o la rimozione di elementi
                    iNot.CollectionChanged += Mod_CollectionChanged;
                }

                //splitto il path per recuperare l'eventuale proprietà di raggruppamento
                groupSel = GroupSelector?.Split('.');

                //Per ogni oggetto di tipo ISelectable dell'itemssource
                //aggiunto l'elemento alla lista locale di oggetti da gestire
                foreach (ISelectable item in ItemsSource)
                {
                    addItem(item);
                }

                //mi aggancio all'evento di check della checkbox e all'evento di uncheck della checkbox
                AssociatedObject.Checked   += CheckedHandler;
                AssociatedObject.Unchecked += UncheckedHandler;

                //Resync global selected flag
                ResyncSelectionFlag();
            }

            init = true;
        }
示例#15
0
        public static bool RemoveGroupFromWorkspace(IPermissionManager permissionManager, Int32 eddsWorkspaceArtifactID, kCura.Relativity.Client.DTOs.Group group)
        {
            bool success = false;

            GroupSelector groupSelector = permissionManager.GetWorkspaceGroupSelectorAsync(eddsWorkspaceArtifactID).Result;
            GroupRef      groupRef      = groupSelector.EnabledGroups.FirstOrDefault(x => x.Name == group.Name);

            if (groupRef != null)
            {
                GroupSelector modifyGroupSelector = new GroupSelector()
                {
                    LastModified = groupSelector.LastModified
                };
                modifyGroupSelector.DisabledGroups.Add(groupRef);
                Task task = permissionManager.AddRemoveWorkspaceGroupsAsync(eddsWorkspaceArtifactID, modifyGroupSelector);
                task.ConfigureAwait(false);
                task.Wait();
                success = true;
            }

            return(success);
        }
示例#16
0
        public void SelectAllies()
        {
            GroupSelector.SelectOnlyAllies();

            SelectGroup();
        }
示例#17
0
        /// <summary>
        /// <para>Adds members to a group.</para>
        /// <para>The members are added immediately. However the granting of group-owned
        /// resources may take additional time. Use the <see
        /// cref="Dropbox.Api.Team.Routes.TeamRoutes.GroupsJobStatusGetAsync" /> to determine
        /// whether this process has completed.</para>
        /// <para>Permission : Team member management</para>
        /// </summary>
        /// <param name="group">Group to which users will be added.</param>
        /// <param name="members">List of users to be added to the group.</param>
        /// <returns>The task that represents the asynchronous send operation. The TResult
        /// parameter contains the response from the server.</returns>
        /// <exception cref="Dropbox.Api.ApiException{GroupMembersAddError}">Thrown if there is
        /// an error processing the request; This will contain a <see
        /// cref="GroupMembersAddError"/>.</exception>
        public t.Task<GroupMembersChangeResult> GroupsMembersAddAsync(GroupSelector @group,
                                                                      col.IEnumerable<MemberAccess> members)
        {
            var groupMembersAddArg = new GroupMembersAddArg(@group,
                                                            members);

            return this.GroupsMembersAddAsync(groupMembersAddArg);
        }
示例#18
0
        public void SelectEitherGroup(BattleTargetGroup defaultSelection)
        {
            GroupSelector.SelectEitherGroup(defaultSelection);

            SelectGroup();
        }
示例#19
0
        public void SelectEnemies()
        {
            GroupSelector.SelectOnlyEnemies();

            SelectGroup();
        }
示例#20
0
        /// <summary>
        /// <para>Begins an asynchronous send to the groups members remove route.</para>
        /// </summary>
        /// <param name="group">The group</param>
        /// <param name="users">The users</param>
        /// <param name="callback">The method to be called when the asynchronous send is
        /// completed.</param>
        /// <param name="callbackState">A user provided object that distinguished this send
        /// from other send requests.</param>
        /// <returns>An object that represents the asynchronous send request.</returns>
        public sys.IAsyncResult BeginGroupsMembersRemove(GroupSelector @group,
                                                         col.IEnumerable<UserSelectorArg> users,
                                                         sys.AsyncCallback callback,
                                                         object callbackState = null)
        {
            var groupMembersRemoveArg = new GroupMembersRemoveArg(@group,
                                                                  users);

            return this.BeginGroupsMembersRemove(groupMembersRemoveArg, callback, callbackState);
        }
示例#21
0
        /// <summary>
        /// <para>Removes members from a group.</para>
        /// <para>The members are removed immediately. However the revoking of group-owned
        /// resources may take additional time. Use the <see
        /// cref="Dropbox.Api.Team.Routes.TeamRoutes.GroupsJobStatusGetAsync" /> to determine
        /// whether this process has completed.</para>
        /// <para>Permission : Team member management</para>
        /// </summary>
        /// <param name="group">The group</param>
        /// <param name="users">The users</param>
        /// <returns>The task that represents the asynchronous send operation. The TResult
        /// parameter contains the response from the server.</returns>
        /// <exception cref="Dropbox.Api.ApiException{GroupMembersRemoveError}">Thrown if there
        /// is an error processing the request; This will contain a <see
        /// cref="GroupMembersRemoveError"/>.</exception>
        public t.Task<GroupMembersChangeResult> GroupsMembersRemoveAsync(GroupSelector @group,
                                                                         col.IEnumerable<UserSelectorArg> users)
        {
            var groupMembersRemoveArg = new GroupMembersRemoveArg(@group,
                                                                  users);

            return this.GroupsMembersRemoveAsync(groupMembersRemoveArg);
        }
示例#22
0
        /// <summary>
        /// <para>Begins an asynchronous send to the groups members set access type
        /// route.</para>
        /// </summary>
        /// <param name="group">Specify a group.</param>
        /// <param name="user">Identity of a user that is a member of <paramref name="@group"
        /// />.</param>
        /// <param name="accessType">New group access type the user will have.</param>
        /// <param name="callback">The method to be called when the asynchronous send is
        /// completed.</param>
        /// <param name="callbackState">A user provided object that distinguished this send
        /// from other send requests.</param>
        /// <returns>An object that represents the asynchronous send request.</returns>
        public sys.IAsyncResult BeginGroupsMembersSetAccessType(GroupSelector @group,
                                                                UserSelectorArg user,
                                                                GroupAccessType accessType,
                                                                sys.AsyncCallback callback,
                                                                object callbackState = null)
        {
            var groupMembersSetAccessTypeArg = new GroupMembersSetAccessTypeArg(@group,
                                                                                user,
                                                                                accessType);

            return this.BeginGroupsMembersSetAccessType(groupMembersSetAccessTypeArg, callback, callbackState);
        }
示例#23
0
        /// <summary>
        /// <para>Sets a member's access type in a group.</para>
        /// <para>Permission : Team member management</para>
        /// </summary>
        /// <param name="group">Specify a group.</param>
        /// <param name="user">Identity of a user that is a member of <paramref name="@group"
        /// />.</param>
        /// <param name="accessType">New group access type the user will have.</param>
        /// <returns>The task that represents the asynchronous send operation. The TResult
        /// parameter contains the response from the server.</returns>
        /// <exception cref="Dropbox.Api.ApiException{GroupMemberSelectorError}">Thrown if
        /// there is an error processing the request; This will contain a <see
        /// cref="GroupMemberSelectorError"/>.</exception>
        public t.Task<col.List<GroupsGetInfoItem>> GroupsMembersSetAccessTypeAsync(GroupSelector @group,
                                                                                   UserSelectorArg user,
                                                                                   GroupAccessType accessType)
        {
            var groupMembersSetAccessTypeArg = new GroupMembersSetAccessTypeArg(@group,
                                                                                user,
                                                                                accessType);

            return this.GroupsMembersSetAccessTypeAsync(groupMembersSetAccessTypeArg);
        }
示例#24
0
 /// <summary>
 /// <para>Deletes a group.</para>
 /// <para>The group is deleted immediately. However the revoking of group-owned
 /// resources may take additional time. Use the <see
 /// cref="Dropbox.Api.Team.Routes.TeamRoutes.GroupsJobStatusGetAsync" /> to determine
 /// whether this process has completed.</para>
 /// <para>Permission : Team member management</para>
 /// </summary>
 /// <param name="groupSelector">The request parameters</param>
 /// <returns>The task that represents the asynchronous send operation. The TResult
 /// parameter contains the response from the server.</returns>
 /// <exception cref="Dropbox.Api.ApiException{GroupDeleteError}">Thrown if there is an
 /// error processing the request; This will contain a <see
 /// cref="GroupDeleteError"/>.</exception>
 public t.Task<Dropbox.Api.Async.LaunchEmptyResult> GroupsDeleteAsync(GroupSelector groupSelector)
 {
     return this.Transport.SendRpcRequestAsync<GroupSelector, Dropbox.Api.Async.LaunchEmptyResult, GroupDeleteError>(groupSelector, "api", "/team/groups/delete", Dropbox.Api.Team.GroupSelector.Encoder, Dropbox.Api.Async.LaunchEmptyResult.Decoder, Dropbox.Api.Team.GroupDeleteError.Decoder);
 }
示例#25
0
        /// <summary>
        /// <para>Begins an asynchronous send to the groups delete route.</para>
        /// </summary>
        /// <param name="groupSelector">The request parameters.</param>
        /// <param name="callback">The method to be called when the asynchronous send is
        /// completed.</param>
        /// <param name="state">A user provided object that distinguished this send from other
        /// send requests.</param>
        /// <returns>An object that represents the asynchronous send request.</returns>
        public sys.IAsyncResult BeginGroupsDelete(GroupSelector groupSelector, sys.AsyncCallback callback, object state = null)
        {
            var task = this.GroupsDeleteAsync(groupSelector);

            return enc.Util.ToApm(task, callback, state);
        }
示例#26
0
        /// <summary>
        /// <para>Updates a group's name and/or external ID.</para>
        /// <para>Permission : Team member management</para>
        /// </summary>
        /// <param name="group">Specify a group.</param>
        /// <param name="newGroupName">Optional argument. Set group name to this if
        /// provided.</param>
        /// <param name="newGroupExternalId">Optional argument. New group external ID. If the
        /// argument is None, the group's external_id won't be updated. If the argument is
        /// empty string, the group's external id will be cleared.</param>
        /// <returns>The task that represents the asynchronous send operation. The TResult
        /// parameter contains the response from the server.</returns>
        /// <exception cref="Dropbox.Api.ApiException{GroupUpdateError}">Thrown if there is an
        /// error processing the request; This will contain a <see
        /// cref="GroupUpdateError"/>.</exception>
        public t.Task<GroupFullInfo> GroupsUpdateAsync(GroupSelector @group,
                                                       string newGroupName = null,
                                                       string newGroupExternalId = null)
        {
            var groupUpdateArgs = new GroupUpdateArgs(@group,
                                                      newGroupName,
                                                      newGroupExternalId);

            return this.GroupsUpdateAsync(groupUpdateArgs);
        }
示例#27
0
        /// <summary>
        /// <para>Begins an asynchronous send to the groups update route.</para>
        /// </summary>
        /// <param name="group">Specify a group.</param>
        /// <param name="newGroupName">Optional argument. Set group name to this if
        /// provided.</param>
        /// <param name="newGroupExternalId">Optional argument. New group external ID. If the
        /// argument is None, the group's external_id won't be updated. If the argument is
        /// empty string, the group's external id will be cleared.</param>
        /// <param name="callback">The method to be called when the asynchronous send is
        /// completed.</param>
        /// <param name="callbackState">A user provided object that distinguished this send
        /// from other send requests.</param>
        /// <returns>An object that represents the asynchronous send request.</returns>
        public sys.IAsyncResult BeginGroupsUpdate(GroupSelector @group,
                                                  string newGroupName = null,
                                                  string newGroupExternalId = null,
                                                  sys.AsyncCallback callback = null,
                                                  object callbackState = null)
        {
            var groupUpdateArgs = new GroupUpdateArgs(@group,
                                                      newGroupName,
                                                      newGroupExternalId);

            return this.BeginGroupsUpdate(groupUpdateArgs, callback, callbackState);
        }
示例#28
0
        /// <summary>
        /// <para>Begins an asynchronous send to the groups members add route.</para>
        /// </summary>
        /// <param name="group">Group to which users will be added.</param>
        /// <param name="members">List of users to be added to the group.</param>
        /// <param name="callback">The method to be called when the asynchronous send is
        /// completed.</param>
        /// <param name="callbackState">A user provided object that distinguished this send
        /// from other send requests.</param>
        /// <returns>An object that represents the asynchronous send request.</returns>
        public sys.IAsyncResult BeginGroupsMembersAdd(GroupSelector @group,
                                                      col.IEnumerable<MemberAccess> members,
                                                      sys.AsyncCallback callback,
                                                      object callbackState = null)
        {
            var groupMembersAddArg = new GroupMembersAddArg(@group,
                                                            members);

            return this.BeginGroupsMembersAdd(groupMembersAddArg, callback, callbackState);
        }