Made the button options bar hide and show again with edit.
Improved what call back function take Killed dead code
This commit is contained in:
parent
40220aa8f2
commit
888bb86b6d
7 changed files with 41 additions and 110 deletions
|
|
@ -47,10 +47,10 @@ namespace MatterHackers.MatterControl.CustomWidgets.LibrarySelector
|
|||
public FolderBreadCrumbWidget(Action<LibraryProvider> SwitchToLibraryProvider, LibraryProvider currentLibraryProvider)
|
||||
{
|
||||
this.SwitchToLibraryProvider = SwitchToLibraryProvider;
|
||||
UiThread.RunOnIdle(() => SetBreadCrumbs(null, new LibraryDataViewEventArgs(currentLibraryProvider)));
|
||||
UiThread.RunOnIdle(() => SetBreadCrumbs(currentLibraryProvider));
|
||||
}
|
||||
|
||||
public void SetBreadCrumbs(object sender, LibraryDataViewEventArgs currentLibraryProviderEvent)
|
||||
public void SetBreadCrumbs(LibraryProvider currentLibraryProvider)
|
||||
{
|
||||
navigationButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
navigationButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
|
|
@ -59,17 +59,12 @@ namespace MatterHackers.MatterControl.CustomWidgets.LibrarySelector
|
|||
navigationButtonFactory.Margin = new BorderDouble(10, 0);
|
||||
|
||||
this.CloseAndRemoveAllChildren();
|
||||
LibraryProvider currentProvider = null;
|
||||
if (currentLibraryProviderEvent != null)
|
||||
{
|
||||
currentProvider = currentLibraryProviderEvent.LibraryProvider;
|
||||
}
|
||||
|
||||
List<LibraryProvider> parentProviderList = new List<LibraryProvider>();
|
||||
while (currentProvider != null)
|
||||
while (currentLibraryProvider != null)
|
||||
{
|
||||
parentProviderList.Add(currentProvider);
|
||||
currentProvider = currentProvider.ParentLibraryProvider;
|
||||
parentProviderList.Add(currentLibraryProvider);
|
||||
currentLibraryProvider = currentLibraryProvider.ParentLibraryProvider;
|
||||
}
|
||||
|
||||
bool first = true;
|
||||
|
|
|
|||
|
|
@ -231,22 +231,8 @@ namespace MatterHackers.MatterControl.CustomWidgets.LibrarySelector
|
|||
AddHandlers();
|
||||
}
|
||||
|
||||
#region Abstract Functions
|
||||
|
||||
public abstract void AddToQueue();
|
||||
|
||||
public abstract void Edit();
|
||||
|
||||
public abstract void Export();
|
||||
|
||||
public abstract void RemoveFromCollection();
|
||||
|
||||
protected abstract SlideWidget GetItemActionButtons();
|
||||
|
||||
protected abstract void RemoveThisFromPrintLibrary();
|
||||
|
||||
#endregion Abstract Functions
|
||||
|
||||
private void AddHandlers()
|
||||
{
|
||||
MouseEnterBounds += (sender, e) =>
|
||||
|
|
@ -68,41 +68,6 @@ namespace MatterHackers.MatterControl.CustomWidgets.LibrarySelector
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
public override void Export()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void Edit()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private static readonly string collectionNotEmtyMessage = "The folder '{0}' is not empty.\n\nWould you like to delete it anyway?".Localize();
|
||||
private static readonly string collectionNotEmtyTitle = "Delete folder?".Localize();
|
||||
private static readonly string deleteNow = "Delete".Localize();
|
||||
private static readonly string doNotDelete = "Cancel".Localize();
|
||||
|
||||
public override void RemoveFromCollection()
|
||||
{
|
||||
int collectionItemCollectionCount = libraryDataView.CurrentLibraryProvider.GetCollectionChildCollectionCount(CollectionIndex);
|
||||
int collectionItemItemCount = libraryDataView.CurrentLibraryProvider.GetCollectionItemCount(CollectionIndex);
|
||||
|
||||
if (collectionItemCollectionCount > 0 || collectionItemItemCount > 0)
|
||||
{
|
||||
string message = collectionNotEmtyMessage.FormatWith(libraryDataView.CurrentLibraryProvider.GetCollectionItem(CollectionIndex).Name);
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
// Let the user know this collection is not empty and check if they want to delete it.
|
||||
StyledMessageBox.ShowMessageBox(ProcessDialogResponse, message, collectionNotEmtyTitle, StyledMessageBox.MessageType.YES_NO, deleteNow, doNotDelete);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
libraryDataView.CurrentLibraryProvider.RemoveCollection(CollectionIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessDialogResponse(bool messageBoxResponse)
|
||||
{
|
||||
if (messageBoxResponse)
|
||||
|
|
@ -111,43 +76,6 @@ namespace MatterHackers.MatterControl.CustomWidgets.LibrarySelector
|
|||
}
|
||||
}
|
||||
|
||||
public override void AddToQueue()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private ConditionalClickWidget primaryClickContainer;
|
||||
|
||||
protected override SlideWidget GetItemActionButtons()
|
||||
{
|
||||
SlideWidget buttonContainer = new SlideWidget();
|
||||
buttonContainer.VAnchor = VAnchor.ParentBottomTop;
|
||||
|
||||
FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
|
||||
buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop;
|
||||
|
||||
TextWidget openLabel = new TextWidget("Open".Localize());
|
||||
openLabel.TextColor = RGBA_Bytes.White;
|
||||
openLabel.VAnchor = VAnchor.ParentCenter;
|
||||
openLabel.HAnchor = HAnchor.ParentCenter;
|
||||
|
||||
FatFlatClickWidget openButton = new FatFlatClickWidget(openLabel);
|
||||
openButton.VAnchor = VAnchor.ParentBottomTop;
|
||||
openButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
|
||||
openButton.Width = 100;
|
||||
openButton.Click += (sender, e) =>
|
||||
{
|
||||
ChangeCollection();
|
||||
};
|
||||
|
||||
buttonFlowContainer.AddChild(openButton);
|
||||
|
||||
buttonContainer.AddChild(buttonFlowContainer);
|
||||
buttonContainer.Width = 100;
|
||||
|
||||
return buttonContainer;
|
||||
}
|
||||
|
||||
private void ChangeCollection()
|
||||
{
|
||||
if (parentProvider == null)
|
||||
|
|
@ -181,18 +109,34 @@ namespace MatterHackers.MatterControl.CustomWidgets.LibrarySelector
|
|||
this.Margin = new BorderDouble(6, 0, 6, 6);
|
||||
}
|
||||
|
||||
private void onAddLinkClick(object sender, EventArgs e)
|
||||
protected override SlideWidget GetItemActionButtons()
|
||||
{
|
||||
}
|
||||
SlideWidget buttonContainer = new SlideWidget();
|
||||
buttonContainer.VAnchor = VAnchor.ParentBottomTop;
|
||||
|
||||
protected override void RemoveThisFromPrintLibrary()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
|
||||
buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop;
|
||||
|
||||
private void onRemoveLinkClick(object sender, EventArgs e)
|
||||
{
|
||||
UiThread.RunOnIdle(RemoveThisFromPrintLibrary);
|
||||
TextWidget openLabel = new TextWidget("Open".Localize());
|
||||
openLabel.TextColor = RGBA_Bytes.White;
|
||||
openLabel.VAnchor = VAnchor.ParentCenter;
|
||||
openLabel.HAnchor = HAnchor.ParentCenter;
|
||||
|
||||
FatFlatClickWidget openButton = new FatFlatClickWidget(openLabel);
|
||||
openButton.VAnchor = VAnchor.ParentBottomTop;
|
||||
openButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
|
||||
openButton.Width = 100;
|
||||
openButton.Click += (sender, e) =>
|
||||
{
|
||||
ChangeCollection();
|
||||
};
|
||||
|
||||
buttonFlowContainer.AddChild(openButton);
|
||||
|
||||
buttonContainer.AddChild(buttonFlowContainer);
|
||||
buttonContainer.Width = 100;
|
||||
|
||||
return buttonContainer;
|
||||
}
|
||||
|
||||
private void onThemeChanged(object sender, EventArgs e)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue