commit
b708ec16be
4 changed files with 52 additions and 4 deletions
|
|
@ -39,6 +39,7 @@ using MatterHackers.VectorMath;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrintLibrary
|
||||
|
|
@ -552,11 +553,19 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
{
|
||||
libraryDataView.SelectedItems.Sort(SortRowItemsOnIndex);
|
||||
|
||||
// remove them last to first
|
||||
for(int i=libraryDataView.SelectedItems.Count-1; i>=0; i--)
|
||||
if (libraryDataView.SelectedItems.Count == 1)
|
||||
{
|
||||
LibraryRowItem item = libraryDataView.SelectedItems[i];
|
||||
item.RemoveFromCollection();
|
||||
// remove them last to first
|
||||
for (int i = libraryDataView.SelectedItems.Count - 1; i >= 0; i--)
|
||||
{
|
||||
LibraryRowItem item = libraryDataView.SelectedItems[i];
|
||||
item.RemoveFromCollection();
|
||||
}
|
||||
}
|
||||
else if (libraryDataView.SelectedItems.Count > 1)
|
||||
{
|
||||
var indexesToRemove = libraryDataView.SelectedItems.Cast<LibraryRowItemPart>().Select(l => l.ItemIndex).ToArray();
|
||||
libraryDataView.CurrentLibraryProvider.RemoveItems(indexesToRemove);
|
||||
}
|
||||
|
||||
libraryDataView.ClearSelectedItems();
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ using MatterHackers.PolygonMesh.Processors;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
||||
|
|
@ -180,6 +181,16 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
|
||||
public abstract void RemoveItem(int itemIndexToRemove);
|
||||
|
||||
// Base implmentation simply calls RemoveItem
|
||||
public virtual void RemoveItems(int[] indexes)
|
||||
{
|
||||
// Remove items in reverse order
|
||||
foreach (var i in indexes.OrderByDescending(i => i))
|
||||
{
|
||||
RemoveItem(i);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void RenameCollection(int collectionIndexToRename, string newName);
|
||||
|
||||
public abstract void RenameItem(int itemIndexToRename, string newName);
|
||||
|
|
|
|||
|
|
@ -262,6 +262,12 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
|
||||
public override LibraryProvider GetProviderForCollection(PrintItemCollection collection)
|
||||
{
|
||||
LibraryProvider provider = libraryProviders.Values.Where(p => p.ProviderKey == collection.Key).FirstOrDefault();
|
||||
if (provider != null)
|
||||
{
|
||||
return provider;
|
||||
}
|
||||
|
||||
foreach (ILibraryCreator libraryCreator in libraryCreators)
|
||||
{
|
||||
if (collection.Key == libraryCreator.ProviderKey)
|
||||
|
|
|
|||
|
|
@ -157,6 +157,28 @@ namespace MatterHackers.MatterControl.VersionManagement
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides a WebReqeustBase implementation that allows the caller to specify the serialization object used by the WebRequestBase http post
|
||||
/// </summary>
|
||||
/// <typeparam name="RequestType">The type which will be passed to the Request method, stored in a local instance and serialized for the http post</typeparam>
|
||||
public class WebRequest2<RequestType> : WebRequestBase where RequestType : class
|
||||
{
|
||||
private RequestType localRequestValues;
|
||||
|
||||
public void Request(string requestUrl, RequestType requestValues)
|
||||
{
|
||||
this.uri = requestUrl;
|
||||
localRequestValues = requestValues;
|
||||
this.Request();
|
||||
}
|
||||
|
||||
protected override string getJsonToSend()
|
||||
{
|
||||
return JsonConvert.SerializeObject(localRequestValues);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class WebRequestBase
|
||||
{
|
||||
protected Dictionary<string, string> requestValues;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue