private void AddAllItems()
        {
            topToBottomItemList.RemoveAllChildren();

            var provider = this.CurrentLibraryProvider;

            if (provider != null && provider.ProviderKey != "ProviderSelectorKey")
            {
                PrintItemCollection parent    = new PrintItemCollection("..", provider.ProviderKey);
                LibraryRowItem      queueItem = new LibraryRowItemCollection(parent, provider, -1, this, provider.ParentLibraryProvider, GetThumbnailWidget(provider.ParentLibraryProvider, parent, LibraryProvider.UpFolderImage));
                AddListItemToTopToBottom(queueItem);
            }

            for (int i = 0; i < provider.CollectionCount; i++)
            {
                PrintItemCollection item      = provider.GetCollectionItem(i);
                LibraryRowItem      queueItem = new LibraryRowItemCollection(item, provider, i, this, null, GetThumbnailWidget(null, item, provider.GetCollectionFolderImage(i)));
                AddListItemToTopToBottom(queueItem);
            }

            for (int i = 0; i < provider.ItemCount; i++)
            {
                GuiWidget      thumbnailWidget = provider.GetItemThumbnail(i);
                LibraryRowItem queueItem       = new LibraryRowItemPart(provider, i, this, thumbnailWidget);

                AddListItemToTopToBottom(queueItem);
            }
        }
Exemple #2
0
        private void AddAllItems()
        {
            topToBottomItemList.RemoveAllChildren();

            if (LibraryDataView.CurrentLibraryProvider.ParentLibraryProvider != null)
            {
                PrintItemCollection parent    = new PrintItemCollection("..", LibraryDataView.CurrentLibraryProvider.ProviderKey);
                LibraryRowItem      queueItem = new LibraryRowItemCollection(parent, this, LibraryDataView.CurrentLibraryProvider.ParentLibraryProvider, GetThumbnailWidget(true, LibraryDataView.CurrentLibraryProvider.ParentLibraryProvider, parent));
                AddListItemToTopToBottom(queueItem);
            }

            for (int i = 0; i < LibraryDataView.CurrentLibraryProvider.CollectionCount; i++)
            {
                PrintItemCollection item      = LibraryDataView.CurrentLibraryProvider.GetCollectionItem(i);
                LibraryRowItem      queueItem = new LibraryRowItemCollection(item, this, null, GetThumbnailWidget(false, null, item));
                AddListItemToTopToBottom(queueItem);
            }

            for (int i = 0; i < LibraryDataView.CurrentLibraryProvider.ItemCount; i++)
            {
                PrintItemWrapper item            = LibraryDataView.CurrentLibraryProvider.GetPrintItemWrapper(i);
                GuiWidget        thumbnailWidget = LibraryDataView.CurrentLibraryProvider.GetItemThumbnail(i);
                LibraryRowItem   queueItem       = new LibraryRowItemPart(item, this, thumbnailWidget);
                AddListItemToTopToBottom(queueItem);
            }
        }
        private void AddAllItems(object inData = null)
        {
            // Clear SelectedItems when the list is rebuilt to prevent duplicate entries
            this.SelectedItems.Clear();

            topToBottomItemList.RemoveAllChildren();

            var provider = this.CurrentLibraryProvider;

            if (provider != null)
            {
                if (provider.ProviderKey != LibraryProviderSelector.ProviderKeyName)
                {
                    // Create logical "up folder" entry
                    PrintItemCollection parent    = new PrintItemCollection("..", provider.ProviderKey);
                    LibraryRowItem      queueItem = new LibraryRowItemCollection(parent, provider, -1, this, provider.ParentLibraryProvider, GetThumbnailWidget(provider.ParentLibraryProvider, parent, LibraryProvider.UpFolderImage), "Back".Localize());
                    queueItem.IsViewHelperItem = true;
                    AddListItemToTopToBottom(queueItem);
                }

                for (int i = 0; i < provider.CollectionCount; i++)
                {
                    PrintItemCollection item      = provider.GetCollectionItem(i);
                    LibraryRowItem      queueItem = new LibraryRowItemCollection(item, provider, i, this, null, GetThumbnailWidget(null, item, provider.GetCollectionFolderImage(i)), "Open".Localize());
                    AddListItemToTopToBottom(queueItem);
                }

                for (int i = 0; i < provider.ItemCount; i++)
                {
                    GuiWidget      thumbnailWidget = provider.GetItemThumbnail(i);
                    LibraryRowItem queueItem       = new LibraryRowItemPart(provider, i, this, thumbnailWidget);

                    AddListItemToTopToBottom(queueItem);
                }
            }

            LastScrollPosition scrollPosition = inData as LastScrollPosition;

            if (scrollPosition != null)
            {
                this.TopLeftOffset = scrollPosition.topLeftScrollPosition;
            }
        }
Exemple #4
0
        private void renameFromLibraryButton_Click(IEnumerable <QueueRowItem> s, object p)
        {
            if (libraryDataView.SelectedItems.Count == 1)
            {
                if (renameItemWindow == null)
                {
                    LibraryRowItem           rowItem        = libraryDataView.SelectedItems[0];
                    LibraryRowItemPart       partItem       = rowItem as LibraryRowItemPart;
                    LibraryRowItemCollection collectionItem = rowItem as LibraryRowItemCollection;

                    string currentName = libraryDataView.SelectedItems[0].ItemName;

                    renameItemWindow = new RenameItemWindow(currentName, (returnInfo) =>
                    {
                        if (partItem != null)
                        {
                            libraryDataView.CurrentLibraryProvider.RenameItem(partItem.ItemIndex, returnInfo.newName);
                        }
                        else if (collectionItem != null)
                        {
                            libraryDataView.CurrentLibraryProvider.RenameCollection(collectionItem.CollectionIndex, returnInfo.newName);
                        }

                        libraryDataView.ClearSelectedItems();
                    });

                    renameItemWindow.Closed += (sender2, e2) => { renameItemWindow = null; };
                }
                else
                {
                    renameItemWindow.BringToFront();
                }

                /*
                 * LibraryDataView.CurrentLibraryProvider.RenameCollection(collectionIndex, newName);
                 *
                 * LibraryRowItem libraryItem = libraryDataView.SelectedItems[0];
                 * libraryItem.RenameThisInPrintLibrary(newName.Data);
                 *
                 */
            }
        }
		private void AddAllItems()
		{
			topToBottomItemList.RemoveAllChildren();

			var provider = this.CurrentLibraryProvider;

			if (provider != null && provider.ProviderKey != "ProviderSelectorKey")
			{
				PrintItemCollection parent = new PrintItemCollection("..", provider.ProviderKey);
				LibraryRowItem queueItem = new LibraryRowItemCollection(parent, provider, -1, this, provider.ParentLibraryProvider, GetThumbnailWidget(provider.ParentLibraryProvider, parent, LibraryProvider.UpFolderImage));
				AddListItemToTopToBottom(queueItem);
			}

			for (int i = 0; i < provider.CollectionCount; i++)
			{
				PrintItemCollection item = provider.GetCollectionItem(i);
				LibraryRowItem queueItem = new LibraryRowItemCollection(item, provider, i, this, null, GetThumbnailWidget(null, item, provider.GetCollectionFolderImage(i)));
				AddListItemToTopToBottom(queueItem);
			}

			for (int i = 0; i < provider.ItemCount; i++)
			{
				GuiWidget thumbnailWidget = provider.GetItemThumbnail(i);
				LibraryRowItem queueItem = new LibraryRowItemPart(provider, i, this, thumbnailWidget);

				AddListItemToTopToBottom(queueItem);
			}
		}
        private void CreateEditBarButtons()
        {
            itemOperationButtons                 = new FlowLayoutWidget();
            itemOperationButtons.Visible         = false;
            itemOperationButtons.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
            itemOperationButtons.HAnchor         = HAnchor.Max_FitToChildren_ParentWidth;
            double oldWidth = editButtonFactory.FixedWidth;

            editButtonFactory.FixedWidth = 0;

            Button exportItemButton = editButtonFactory.Generate("Export".Localize());

            exportItemButton.Name   = "Library Export Button";
            exportItemButton.Margin = new BorderDouble(3, 0);
            exportItemButton.Click += exportButton_Click;
            editButtonsEnableData.Add(new ButtonEnableData(false, false, false));
            itemOperationButtons.AddChild(exportItemButton);

            Button editItemButton = editButtonFactory.Generate("Edit".Localize());

            editItemButton.Name   = "Library Edit Item Button";
            editItemButton.Margin = new BorderDouble(3, 0);
            editItemButton.Click += editButton_Click;
            editButtonsEnableData.Add(new ButtonEnableData(false, false, false));
            itemOperationButtons.AddChild(editItemButton);

            // add the remove button
            {
                Button removeFromLibraryButton = editButtonFactory.Generate("Remove".Localize());
                removeFromLibraryButton.Name   = "Library Remove Item Button";
                removeFromLibraryButton.Margin = new BorderDouble(3, 0);
                removeFromLibraryButton.Click += deleteFromLibraryButton_Click;
                editButtonsEnableData.Add(new ButtonEnableData(true, false, true));
                itemOperationButtons.AddChild(removeFromLibraryButton);
            }



            // add the share button
            {
                Button shareFromLibraryButton = editButtonFactory.Generate("Share".Localize());
                shareFromLibraryButton.ToolTipText = "Share designs from your Cloud Library".Localize();
                shareFromLibraryButton.Margin      = new BorderDouble(3, 0);
                shareFromLibraryButton.Click      += shareFromLibraryButton_Click;
                editButtonsEnableData.Add(new ButtonEnableData(false, false, false, true));
                itemOperationButtons.AddChild(shareFromLibraryButton);
            }



            // add a rename button
            {
                Button renameFromLibraryButton = editButtonFactory.Generate("Rename".Localize());
                renameFromLibraryButton.Name   = "Rename From Library Button";
                renameFromLibraryButton.Margin = new BorderDouble(3, 0);
                editButtonsEnableData.Add(new ButtonEnableData(false, false, true));
                itemOperationButtons.AddChild(renameFromLibraryButton);

                renameFromLibraryButton.Click += (sender, e) =>
                {
                    if (libraryDataView.SelectedItems.Count == 1)
                    {
                        if (renameItemWindow == null)
                        {
                            LibraryRowItem           rowItem        = libraryDataView.SelectedItems[0];
                            LibraryRowItemPart       partItem       = rowItem as LibraryRowItemPart;
                            LibraryRowItemCollection collectionItem = rowItem as LibraryRowItemCollection;

                            string currentName = libraryDataView.SelectedItems[0].ItemName;

                            renameItemWindow = new RenameItemWindow(currentName, (returnInfo) =>
                            {
                                if (partItem != null)
                                {
                                    libraryDataView.CurrentLibraryProvider.RenameItem(partItem.ItemIndex, returnInfo.newName);
                                }
                                else if (collectionItem != null)
                                {
                                    libraryDataView.CurrentLibraryProvider.RenameCollection(collectionItem.CollectionIndex, returnInfo.newName);
                                }

                                libraryDataView.ClearSelectedItems();
                            });

                            renameItemWindow.Closed += (sender2, e2) => { renameItemWindow = null; };
                        }
                        else
                        {
                            renameItemWindow.BringToFront();
                        }

                        /*
                         * LibraryDataView.CurrentLibraryProvider.RenameCollection(collectionIndex, newName);
                         *
                         * LibraryRowItem libraryItem = libraryDataView.SelectedItems[0];
                         * libraryItem.RenameThisInPrintLibrary(newName.Data);
                         *
                         */
                    }
                };
            }

            Button addToQueueButton = editButtonFactory.Generate("Add to Queue".Localize());

            addToQueueButton.Name   = "Library Add To Queue Button";
            addToQueueButton.Margin = new BorderDouble(3, 0);
            addToQueueButton.Click += addToQueueButton_Click;
            editButtonsEnableData.Add(new ButtonEnableData(true, true, false));
            itemOperationButtons.AddChild(addToQueueButton);

            editButtonFactory.FixedWidth = oldWidth;
        }
		private void AddAllItems(object inData = null)
		{
			// Clear SelectedItems when the list is rebuilt to prevent duplicate entries
			this.SelectedItems.Clear();

			topToBottomItemList.RemoveAllChildren();

			var provider = this.CurrentLibraryProvider;
			if (provider != null)
			{
				if (provider.ProviderKey != LibraryProviderSelector.ProviderKeyName)
				{
					// Create logical "up folder" entry
					PrintItemCollection parent = new PrintItemCollection("..", provider.ProviderKey);
					LibraryRowItem queueItem = new LibraryRowItemCollection(parent, provider, -1, this, provider.ParentLibraryProvider, GetThumbnailWidget(provider.ParentLibraryProvider, parent, LibraryProvider.UpFolderImage), "Back".Localize());
					queueItem.IsViewHelperItem = true;
					AddListItemToTopToBottom(queueItem);
				}

				for (int i = 0; i < provider.CollectionCount; i++)
				{
					PrintItemCollection item = provider.GetCollectionItem(i);
					LibraryRowItem queueItem = new LibraryRowItemCollection(item, provider, i, this, null, GetThumbnailWidget(null, item, provider.GetCollectionFolderImage(i)), "Open".Localize());
					AddListItemToTopToBottom(queueItem);
				}

				for (int i = 0; i < provider.ItemCount; i++)
				{
					GuiWidget thumbnailWidget = provider.GetItemThumbnail(i);
					LibraryRowItem queueItem = new LibraryRowItemPart(provider, i, this, thumbnailWidget);

					AddListItemToTopToBottom(queueItem);
				}
			}

			LastScrollPosition scrollPosition = inData as LastScrollPosition;
			if (scrollPosition != null)
			{
				this.TopLeftOffset = scrollPosition.topLeftScrollPosition;
			}
		}
		private void AddAllItems()
		{
			topToBottomItemList.RemoveAllChildren();

			if (LibraryDataView.CurrentLibraryProvider.ParentLibraryProvider != null)
			{
				PrintItemCollection parent = new PrintItemCollection("..", LibraryDataView.CurrentLibraryProvider.ProviderKey);
				LibraryRowItem queueItem = new LibraryRowItemCollection(parent, this, LibraryDataView.CurrentLibraryProvider.ParentLibraryProvider, GetThumbnailWidget(true, LibraryDataView.CurrentLibraryProvider.ParentLibraryProvider, parent));
				AddListItemToTopToBottom(queueItem);
			}

			for (int i = 0; i < LibraryDataView.CurrentLibraryProvider.CollectionCount; i++)
			{
				PrintItemCollection item = LibraryDataView.CurrentLibraryProvider.GetCollectionItem(i);
				LibraryRowItem queueItem = new LibraryRowItemCollection(item, this, null, GetThumbnailWidget(false, null, item));
				AddListItemToTopToBottom(queueItem);
			}

			for (int i = 0; i < LibraryDataView.CurrentLibraryProvider.ItemCount; i++)
			{
				PrintItemWrapper item = LibraryDataView.CurrentLibraryProvider.GetPrintItemWrapper(i);
				GuiWidget thumbnailWidget = LibraryDataView.CurrentLibraryProvider.GetItemThumbnail(i);
				LibraryRowItem queueItem = new LibraryRowItemPart(item, this, thumbnailWidget);
				AddListItemToTopToBottom(queueItem);
			}
		}