Пример #1
0
        public void AddItem(PrintItemWrapper item, ValidateSizeOn32BitSystems checkSize = ValidateSizeOn32BitSystems.Required, int indexToInsert = -1)
        {
            if (Is32Bit())
            {
                // Check if the part we are adding is BIG. If it is warn the user and
                // possibly don't add it
                bool warnAboutFileSize  = false;
                long estimatedMemoryUse = 0;
                if (File.Exists(item.FileLocation) &&
                    checkSize == ValidateSizeOn32BitSystems.Required)
                {
                    switch (Path.GetExtension(item.FileLocation).ToUpper())
                    {
                    case ".STL":
                        estimatedMemoryUse = StlProcessing.GetEstimatedMemoryUse(item.FileLocation);
                        break;

                    case ".AMF":
                        estimatedMemoryUse = AmfProcessing.GetEstimatedMemoryUse(item.FileLocation);
                        break;
                    }

                    if (OsInformation.OperatingSystem == OSType.Android)
                    {
                        if (estimatedMemoryUse > 100000000)
                        {
                            warnAboutFileSize = true;
                        }
                    }
                    else
                    {
                        if (estimatedMemoryUse > 500000000)
                        {
                            warnAboutFileSize = true;
                        }
                    }
                }

                if (warnAboutFileSize)
                {
                    partUnderConsideration = item;
                    // Show a dialog and only load the part to the queue if the user clicks yes.
                    UiThread.RunOnIdle((state) =>
                    {
                        string memoryWarningMessage = "Are you sure you want to add this part ({0}) to the Queue?\nThe 3D part you are trying to load may be too complicated and cause performance or stability problems.\n\nConsider reducing the geometry before proceeding.".Localize().FormatWith(item.Name);
                        StyledMessageBox.ShowMessageBox(UserSaidToAllowAddToQueue, memoryWarningMessage, "File May Cause Problems".Localize(), StyledMessageBox.MessageType.YES_NO, "Add To Queue", "Do Not Add");
                        // show a dialog to tell the user there is an update
                    });
                    return;
                }
                else
                {
                    DoAddItem(item, indexToInsert);
                }
            }
            else
            {
                DoAddItem(item, indexToInsert);
            }
        }
Пример #2
0
        public void AddItem(PrintItemWrapper item, int indexToInsert = -1, ValidateSizeOn32BitSystems checkSize = ValidateSizeOn32BitSystems.Required)
        {
            if (Is32Bit)
            {
                // Check if the part we are adding is BIG. If it is warn the user and
                // possibly don't add it
                bool warnAboutFileSize  = false;
                long estimatedMemoryUse = 0;
                if (File.Exists(item.FileLocation) &&
                    checkSize == ValidateSizeOn32BitSystems.Required)
                {
                    estimatedMemoryUse = GetEstimatedMemoryUse(item.FileLocation);

                    // If we have less than 2 gigs memory, warn on smaller file size
                    if (AggContext.PhysicalMemory < 2000000000)
                    {
                        if (estimatedMemoryUse > 100000000)
                        {
                            warnAboutFileSize = true;
                        }
                    }
                    else
                    {
                        if (estimatedMemoryUse > 500000000)
                        {
                            warnAboutFileSize = true;
                        }
                    }
                }

                if (warnAboutFileSize)
                {
                    partUnderConsideration = item;
                    // Show a dialog and only load the part to the queue if the user clicks yes.
                    UiThread.RunOnIdle(() =>
                    {
                        string memoryWarningMessage = "Are you sure you want to add this part ({0}) to the Queue?\nThe 3D part you are trying to load may be too complicated and cause performance or stability problems.\n\nConsider reducing the geometry before proceeding.".Localize().FormatWith(item.Name);
                        StyledMessageBox.ShowMessageBox(
                            UserSaidToAllowAddToQueue, memoryWarningMessage, "File May Cause Problems".Localize(), StyledMessageBox.MessageType.YES_NO, "Add To Queue", "Do Not Add");
                        // show a dialog to tell the user there is an update
                    });
                    return;
                }
                else
                {
                    DoAddItem(item, indexToInsert);
                }
            }
            else
            {
                DoAddItem(item, indexToInsert);
            }
        }
Пример #3
0
		public void AddItem(PrintItemWrapper item, int indexToInsert = -1, ValidateSizeOn32BitSystems checkSize = ValidateSizeOn32BitSystems.Required)
		{
			if (Is32Bit())
			{
				// Check if the part we are adding is BIG. If it is warn the user and
				// possibly don't add it
				bool warnAboutFileSize = false;
				long estimatedMemoryUse = 0;
				if (File.Exists(item.FileLocation)
					&& checkSize == ValidateSizeOn32BitSystems.Required)
				{
					estimatedMemoryUse = MeshFileIo.GetEstimatedMemoryUse(item.FileLocation);

					if (OsInformation.OperatingSystem == OSType.Android)
					{
						if (estimatedMemoryUse > 100000000)
						{
							warnAboutFileSize = true;
						}
					}
					else
					{
						if (estimatedMemoryUse > 500000000)
						{
							warnAboutFileSize = true;
						}
					}
				}

				if (warnAboutFileSize)
				{
					partUnderConsideration = item;
					// Show a dialog and only load the part to the queue if the user clicks yes.
					UiThread.RunOnIdle(() =>
					{
						string memoryWarningMessage = "Are you sure you want to add this part ({0}) to the Queue?\nThe 3D part you are trying to load may be too complicated and cause performance or stability problems.\n\nConsider reducing the geometry before proceeding.".Localize().FormatWith(item.Name);
						StyledMessageBox.ShowMessageBox(UserSaidToAllowAddToQueue, memoryWarningMessage, "File May Cause Problems".Localize(), StyledMessageBox.MessageType.YES_NO, "Add To Queue", "Do Not Add");
						// show a dialog to tell the user there is an update
					});
					return;
				}
				else
				{
					DoAddItem(item, indexToInsert);
					//copyQueueItemToQueueItemFolder(item.FileLocation);
				}
			}
			else
			{
				DoAddItem(item, indexToInsert);
				//copyQueueItemToQueueItemFolder(item.FileLocation);
			}
		}