示例#1
0
        /// <summary>
        ///     Returns the selected list items in a array.
        /// </summary>
        /// <returns>Array with the selected items.</returns>
        public object[] GetSelectedItems()
        {
            var items = new object[SelectedItems.Count];

            SelectedItems.CopyTo(items, 0);
            return(items);
        }
示例#2
0
        public object[] imethod_3()
        {
            var array = new object[SelectedItems.Count];

            SelectedItems.CopyTo(array, 0);
            return(array);
        }
示例#3
0
        void ListBoxEx_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var newList = new object[SelectedItems.Count];

            SelectedItems.CopyTo(newList, 0);
            SelectedItemsList = newList;
        }
示例#4
0
        /// <summary>
        /// Called by the FileManager control to execute a command.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <see cref="EPiServer.Templates.Advanced.FileManager.Core.FileManagerCommandEventArgs"/> instance containing the event data.</param>
        protected virtual void ExecuteCommand(object sender, FileManagerCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case FileManagerCommandName.LoadView:
                // Loading a new view so the state of the old view should be cleared.
                LoadView((string)e.CommandArguments, true);
                break;

            case FileManagerCommandName.SelectFolder:
                CurrentVirtualPath = (string)e.CommandArguments;
                ClearFileVersionSelection();
                break;

            case FileManagerCommandName.CopySelection:
                PasteBuffer.Clear();
                SelectedItems.CopyTo(PasteBuffer);
                PasteMode = PasteMode.Copy;
                break;

            case FileManagerCommandName.CutSelection:
                PasteBuffer.Clear();
                SelectedItems.CopyTo(PasteBuffer);
                PasteMode = PasteMode.Cut;
                break;

            case FileManagerCommandName.PasteItems:
                FileSystemUtility.PasteFiles(PasteBuffer, CurrentVirtualDirectory, PasteMode);
                // Reset the paste buffer
                PasteBuffer.Clear();
                PasteMode = PasteMode.Copy;
                break;

            case FileManagerCommandName.DeleteSelection:
                FileSystemUtility.DeleteItems(SelectedItems);
                SelectedItems.Clear();
                ClearFileVersionSelection();
                break;

            case FileManagerCommandName.DeleteVersion:
                FileSystemUtility.DeleteVersion(SingleSelectedFile as IVersioningFile, SelectedFileVersionId);
                ClearFileVersionSelection();
                break;

            case FileManagerCommandName.RestoreVersion:
                FileSystemUtility.RestoreVersion(SingleSelectedFile as IVersioningFile, SelectedFileVersionId);
                ClearFileVersionSelection();
                break;

            case FileManagerCommandName.CheckoutSelection:
                FileSystemUtility.CheckoutItems(SelectedItems);
                ClearFileVersionSelection();
                break;

            case FileManagerCommandName.UndoCheckoutSelection:
                FileSystemUtility.UndoCheckoutItems(SelectedItems);
                ClearFileVersionSelection();
                break;
            }
        }
示例#5
0
 private void UpdateFromSelectedItems()
 {
     foreach (object item in ItemsCollection)
     {
         bool value = SelectedItems.Contains(item);
         _ignoreSelectedMemberPathValuesChanged++;
         SetSelectedMemberPathValue(item, value);
         _ignoreSelectedMemberPathValuesChanged--;
         SelectorItem selectorItem = base.ItemContainerGenerator.ContainerFromItem(item) as SelectorItem;
         if (selectorItem != null)
         {
             selectorItem.IsSelected = value;
         }
     }
     UpdateSelectedItem();
     UpdateSelectedValue();
     _internalSelectedItems = new object[SelectedItems.Count];
     SelectedItems.CopyTo(_internalSelectedItems, 0);
 }
示例#6
0
        private void SetItems()
        {
            string[] backup = null;
            if (SelectedItems.Count > 0)
            {
                backup = new string[SelectedItems.Count];
                SelectedItems.CopyTo(backup, 0);
            }
            Items.Clear();
            var wherePhraseStr = (Super == null ? null : String.Join(" AND ", Super.WherePhrase));
            var values         = Controller.FetchColumnValueMultipleValue(BindedTag, wherePhraseStr).Select(_ => _.Key).OrderBy(_ => Yomigana.GetFirst(_)).ToArray();

            Items.Add("全て(" + values.Count() + ")");
            Items.AddRange(values);
            if (backup != null)
            {
                foreach (var str in backup)
                {
                    SelectedItems.Add(str);
                }
            }
        }
示例#7
0
        protected virtual void ListBox_DragDrop(object sender, DragEventArgs e)
        {
            int last = SelectedItems[SelectedItems.Count - 1].Index;

            ListViewItem[] list = new ListViewItem[SelectedItems.Count];
            SelectedItems.CopyTo(list, 0);
            List <ListViewItem> li = list.ToList();



            if (targetItem.Index > last)
            {
                li.Reverse();
                // list.Reverse();
                //MessageBox.Show(list.Length.ToString());
            }

            foreach (ListViewItem lvi in li)
            {
                if (targetItem != null)
                {
                    if (targetItem.Index != lvi.Index)
                    {
                        MoveItem(targetItem.Index, lvi);
                    }
                }
                else
                {
                    MoveItem(this.Items.Count, lvi);
                }
            }
            TotalClipboard.Clear();
            //  tool.Show();
            // tool.Show();

            //   BoxChanged(this, EventArgs.Empty);
            tmrLVScroll.Enabled = false;
        }