Add share button to library.
This commit is contained in:
parent
20618e3835
commit
bcb3b44d89
8 changed files with 112 additions and 2 deletions
|
|
@ -49,12 +49,14 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
internal bool multipleItems;
|
||||
internal bool protectedItems;
|
||||
internal bool collectionItems;
|
||||
internal bool shareItems;
|
||||
|
||||
internal ButtonEnableData(bool multipleItems, bool protectedItems, bool collectionItems)
|
||||
internal ButtonEnableData(bool multipleItems, bool protectedItems, bool collectionItems, bool shareItems = false)
|
||||
{
|
||||
this.multipleItems = multipleItems;
|
||||
this.protectedItems = protectedItems;
|
||||
this.collectionItems = collectionItems;
|
||||
this.shareItems = shareItems;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -349,6 +351,19 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
itemOperationButtons.AddChild(removeFromLibraryButton);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// add the share button
|
||||
{
|
||||
Button shareFromLibraryButton = editButtonFactory.Generate("Share".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());
|
||||
|
|
@ -529,6 +544,14 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
}
|
||||
}
|
||||
|
||||
if (editButtonsEnableData[buttonIndex].shareItems)
|
||||
{
|
||||
if (!libraryDataView.CurrentLibraryProvider.CanShare)
|
||||
{
|
||||
enabledStateToSet = false;
|
||||
}
|
||||
}
|
||||
|
||||
button.Enabled = enabledStateToSet;
|
||||
}
|
||||
}
|
||||
|
|
@ -571,6 +594,19 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
libraryDataView.ClearSelectedItems();
|
||||
}
|
||||
|
||||
private void shareFromLibraryButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (libraryDataView.SelectedItems.Count == 1)
|
||||
{
|
||||
LibraryRowItem rowItem = libraryDataView.SelectedItems[0];
|
||||
LibraryRowItemPart partItem = rowItem as LibraryRowItemPart;
|
||||
if (partItem != null)
|
||||
{
|
||||
libraryDataView.CurrentLibraryProvider.ShareItem(partItem.ItemIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void exportButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Open export options
|
||||
|
|
|
|||
|
|
@ -163,6 +163,8 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
|
||||
public abstract int ItemCount { get; }
|
||||
|
||||
public abstract bool CanShare { get; }
|
||||
|
||||
public abstract string ProviderKey { get; }
|
||||
|
||||
public abstract void AddCollectionToLibrary(string collectionName);
|
||||
|
|
@ -194,6 +196,7 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
public abstract void RenameCollection(int collectionIndexToRename, string newName);
|
||||
|
||||
public abstract void RenameItem(int itemIndexToRename, string newName);
|
||||
public abstract void ShareItem(int itemIndexToShare);
|
||||
|
||||
#endregion Abstract Methods
|
||||
|
||||
|
|
|
|||
|
|
@ -123,6 +123,13 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
}
|
||||
}
|
||||
|
||||
public override void ShareItem(int itemIndexToShare)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool CanShare { get { return false; } }
|
||||
|
||||
public override int ItemCount
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -103,6 +103,11 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void ShareItem(int itemIndexToShare)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static string StaticProviderKey
|
||||
{
|
||||
get
|
||||
|
|
@ -119,6 +124,8 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
}
|
||||
}
|
||||
|
||||
public override bool CanShare { get { return false; } }
|
||||
|
||||
public override int ItemCount
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -113,6 +113,11 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void ShareItem(int itemIndexToShare)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static string StaticProviderKey
|
||||
{
|
||||
get
|
||||
|
|
@ -121,6 +126,8 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
}
|
||||
}
|
||||
|
||||
public override bool CanShare { get { return false; } }
|
||||
|
||||
public override int CollectionCount
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -164,6 +164,13 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool CanShare { get { return false; } }
|
||||
|
||||
public override void ShareItem(int itemIndexToShare)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void CloudSyncStatusChanged(object sender, EventArgs eventArgs)
|
||||
{
|
||||
var e = eventArgs as ApplicationController.CloudSyncEventArgs;
|
||||
|
|
|
|||
|
|
@ -136,6 +136,8 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
}
|
||||
}
|
||||
|
||||
public override bool CanShare { get { return false; } }
|
||||
|
||||
public override int CollectionCount
|
||||
{
|
||||
get
|
||||
|
|
@ -365,6 +367,11 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
LoadLibraryItems();
|
||||
}
|
||||
|
||||
public override void ShareItem(int itemIndexToShare)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected static void SaveToLibraryFolder(PrintItemWrapper printItemWrapper, List<MeshGroup> meshGroups, bool AbsolutePositioned)
|
||||
{
|
||||
string[] metaData = { "Created By", "MatterControl" };
|
||||
|
|
|
|||
|
|
@ -3745,3 +3745,39 @@ Translated:Add a new Material Preset
|
|||
English:Import an existing Material Preset
|
||||
Translated:Import an existing Material Preset
|
||||
|
||||
English:Share Library Item
|
||||
Translated:Share Library Item
|
||||
|
||||
English:Share Options
|
||||
Translated:Share Options
|
||||
|
||||
English:Your Share Code:
|
||||
Translated:Your Share Code:
|
||||
|
||||
English:Anyone with this code will have access
|
||||
Translated:Anyone with this code will have access
|
||||
|
||||
English:Share with someone
|
||||
Translated:Share with someone
|
||||
|
||||
English:read-only
|
||||
Translated:read-only
|
||||
|
||||
English:Generate Share Code
|
||||
Translated:Generate Share Code
|
||||
|
||||
English:Please wait. Retrieving share code...
|
||||
Translated:Please wait. Retrieving share code...
|
||||
|
||||
English:Provide this code to grant someone read-only access.
|
||||
Translated:Provide this code to grant someone read-only access.
|
||||
|
||||
English:Please wait. Sending invite...
|
||||
Translated:Please wait. Sending invite...
|
||||
|
||||
English:Invite sent!
|
||||
Translated:Invite sent!
|
||||
|
||||
English:Your invite has been sent!
|
||||
Translated:Your invite has been sent!
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue