Made the GetPrintItemWrapperAsync take an optional ReportProgressRatio.

Made it possible to show the wrapper loading progress.
Made the ray trace images more white.
This commit is contained in:
Lars Brubaker 2015-07-14 16:16:58 -07:00
parent f0e59e1a9c
commit d4b471842b
8 changed files with 26 additions and 7 deletions

View file

@ -323,7 +323,7 @@ namespace MatterHackers.RayTracer
scene = new Scene(); scene = new Scene();
scene.camera = new TrackBallCamera(trackballTumbleWidget); scene.camera = new TrackBallCamera(trackballTumbleWidget);
//scene.background = new Background(new RGBA_Floats(0.5, .5, .5), 0.4); //scene.background = new Background(new RGBA_Floats(0.5, .5, .5), 0.4);
scene.background = new Background(new RGBA_Floats(0, 0, 0, 0), 0.4); scene.background = new Background(new RGBA_Floats(1, 1, 1, 0), 0.6);
AddTestMesh(loadedMeshGroups); AddTestMesh(loadedMeshGroups);

View file

@ -261,7 +261,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
{ {
if (SelectedIndex >= 0) if (SelectedIndex >= 0)
{ {
return LibraryDataView.CurrentLibraryProvider.GetPrintItemWrapper(SelectedIndex); return LibraryDataView.CurrentLibraryProvider.GetPrintItemWrapperAsync(SelectedIndex).Result;
} }
else else
{ {

View file

@ -213,6 +213,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
mainContainer.AddChild(rightButtonOverlay); mainContainer.AddChild(rightButtonOverlay);
} }
this.AddChild(mainContainer); this.AddChild(mainContainer);
AddHandlers(); AddHandlers();
} }

View file

@ -62,6 +62,8 @@ namespace MatterHackers.MatterControl.PrintLibrary
this.itemIndex = itemIndex; this.itemIndex = itemIndex;
CreateGuiElements(); CreateGuiElements();
AddLoadingProgressBar();
} }
public override bool Protected public override bool Protected
@ -76,12 +78,28 @@ namespace MatterHackers.MatterControl.PrintLibrary
{ {
if (printItemInstance == null) if (printItemInstance == null)
{ {
printItemInstance = await libraryProvider.GetPrintItemWrapperAsync(this.itemIndex); printItemInstance = await libraryProvider.GetPrintItemWrapperAsync(this.itemIndex, ReportProgressRatio);
} }
return printItemInstance; return printItemInstance;
} }
void ReportProgressRatio(double progress0To1, string processingState, out bool continueProcessing)
{
continueProcessing = true;
processingProgressControl.RatioComplete = progress0To1;
}
ProgressBar processingProgressControl;
private void AddLoadingProgressBar()
{
processingProgressControl = new ProgressBar(ActiveTheme.Instance.SecondaryAccentColor, 10, 5);
processingProgressControl.BorderColor = new RGBA_Bytes();
processingProgressControl.VAnchor = VAnchor.ParentBottom;
processingProgressControl.HAnchor = HAnchor.ParentLeftRight;
this.AddChild(processingProgressControl);
}
public async override void AddToQueue() public async override void AddToQueue()
{ {
// create a new item that will be only in the queue // create a new item that will be only in the queue

View file

@ -107,7 +107,7 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
public abstract PrintItemCollection GetCollectionItem(int collectionIndex); public abstract PrintItemCollection GetCollectionItem(int collectionIndex);
public abstract Task<PrintItemWrapper> GetPrintItemWrapperAsync(int itemIndex); public abstract Task<PrintItemWrapper> GetPrintItemWrapperAsync(int itemIndex, ReportProgressRatio reportProgress = null);
public abstract LibraryProvider GetProviderForItem(PrintItemCollection collection); public abstract LibraryProvider GetProviderForItem(PrintItemCollection collection);

View file

@ -177,7 +177,7 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
return Path.GetFileName(currentDirectoryFiles[itemIndex]); return Path.GetFileName(currentDirectoryFiles[itemIndex]);
} }
public async override Task<PrintItemWrapper> GetPrintItemWrapperAsync(int itemIndex) public async override Task<PrintItemWrapper> GetPrintItemWrapperAsync(int itemIndex, ReportProgressRatio reportProgress = null)
{ {
string fileName = currentDirectoryFiles[itemIndex]; string fileName = currentDirectoryFiles[itemIndex];

View file

@ -214,7 +214,7 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
return new PrintItemCollection(provider.Name, provider.ProviderKey); return new PrintItemCollection(provider.Name, provider.ProviderKey);
} }
public async override Task<PrintItemWrapper> GetPrintItemWrapperAsync(int itemIndex) public async override Task<PrintItemWrapper> GetPrintItemWrapperAsync(int itemIndex, ReportProgressRatio reportProgress = null)
{ {
throw new NotImplementedException("Print items are not allowed at the root level"); throw new NotImplementedException("Print items are not allowed at the root level");
} }

View file

@ -306,7 +306,7 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
return childCollections[collectionIndex]; return childCollections[collectionIndex];
} }
public async override Task<PrintItemWrapper> GetPrintItemWrapperAsync(int index) public async override Task<PrintItemWrapper> GetPrintItemWrapperAsync(int index, ReportProgressRatio reportProgress = null)
{ {
if (index >= 0 && index < printItems.Count) if (index >= 0 && index < printItems.Count)
{ {