Exemplo n.º 1
0
        protected override void OnEnvironmentClose()
        {
            Application.UserInterfaceManager.UserInteractionDisabled = true;
            var loadingBar = new LoadingBar("Closing Export Environment...");

            loadingBar.SetProgress(new ProgressUpdate("Saving Robot Data...", 3, 5));
            loadingBar.Show();
            RobotDataManager.SaveRobotData(OpenAssemblyDocument);
            loadingBar.Close();
            Application.UserInterfaceManager.UserInteractionDisabled = false;

            if (!RobotDataManager.wasForceQuit)
            {
                var exportResult = MessageBox.Show(new Form {
                    TopMost = true
                },
                                                   "The robot configuration has been saved to your assembly document.\nWould you like to export your robot to Synthesis?",
                                                   "Robot Configuration Complete",
                                                   MessageBoxButtons.YesNo);

                if (exportResult == DialogResult.Yes)
                {
                    UnsupportedComponentsForm.CheckUnsupportedComponents(RobotDataManager.RobotBaseNode.ListAllNodes());
                    if (ExportForm.PromptExportSettings(RobotDataManager))
                    {
                        if (RobotDataManager.ExportRobot())
                        {
                            AnalyticsUtils.LogEvent("Export", "Succeeded");
                            if (Instance.AddInSettingsManager.OpenSynthesis)
                            {
                                SynthesisUtils.OpenSynthesis(RobotDataManager.RobotName);
                            }
                        }
                        else
                        {
                            AnalyticsUtils.LogEvent("Export", "Cancelled");
                        }
                    }
                }
            }

            // Re-enable disabled components
            if (disabledAssemblyOccurrences != null)
            {
                InventorUtils.EnableComponents(disabledAssemblyOccurrences);
            }
            disabledAssemblyOccurrences = null;

            advancedJointEditor.DestroyDockableWindow();
            guideManager.DestroyDockableWindow();
            jointViewKey.DestroyDockableWindow();
            AnalyticsUtils.EndSession();
        }