Checking for nulls

This commit is contained in:
Lars Brubaker 2015-09-14 09:57:48 -07:00
parent 063c7d1649
commit d6326709c3
2 changed files with 12 additions and 9 deletions

View file

@ -379,15 +379,18 @@ namespace MatterHackers.MatterControl.PrintLibrary
{
var printItemWrapper = await this.GetPrintItemWrapperAsync();
string pathAndFile = printItemWrapper.FileLocation;
if (File.Exists(pathAndFile))
if (printItemWrapper != null)
{
OpenPartViewWindow(openMode);
}
else
{
string message = String.Format("Cannot find\n'{0}'.\nWould you like to remove it from the library?", pathAndFile);
StyledMessageBox.ShowMessageBox(null, message, "Item not found", StyledMessageBox.MessageType.YES_NO);
string pathAndFile = printItemWrapper.FileLocation;
if (File.Exists(pathAndFile))
{
OpenPartViewWindow(openMode);
}
else
{
string message = String.Format("Cannot find\n'{0}'.\nWould you like to remove it from the library?", pathAndFile);
StyledMessageBox.ShowMessageBox(null, message, "Item not found", StyledMessageBox.MessageType.YES_NO);
}
}
}

View file

@ -535,7 +535,7 @@ namespace MatterHackers.MatterControl
if (ShowMemoryUsed)
{
long memory = GC.GetTotalMemory(false);
this.Title = "Allocated = {0:n0} : {1:000}ms, d{2} Size = {3}x{4}, onIdle = {5:00}:{6:00}, drawCount = {7}".FormatWith(memory, millisecondTimer.GetAverage(), drawCount++, this.Width, this.Height, UiThread.CountExpired, UiThread.Count, GuiWidget.DrawCount);
this.Title = "Allocated = {0:n0} : {1:000}ms, d{2} Size = {3}x{4}, onIdle = {5:00}:{6:00}, widgetsDrawn = {7}".FormatWith(memory, millisecondTimer.GetAverage(), drawCount++, this.Width, this.Height, UiThread.CountExpired, UiThread.Count, GuiWidget.DrawCount);
if (DoCGCollectEveryDraw)
{
GC.Collect();