Ejemplo n.º 1
0
        public static ICoreComponent CreateCoreComponent(IGraphUiContainer uiContainer, bool enableGeometricPreview)
        {
            if (null != CoreComponent.Instance)
            {
                throw new InvalidOperationException("'ClassFactory.CreateCoreComponent' called twice!");
            }

            return(CoreComponent.CreateSingleton(uiContainer, enableGeometricPreview));
        }
Ejemplo n.º 2
0
        public static ICoreComponent CreateCoreComponent(IGraphUiContainer uiContainer)
        {
            if (null != CoreComponent.Instance)
            {
                throw new InvalidOperationException("'ClassFactory.CreateCoreComponent' called twice!");
            }

            // This method is called by NUnit test cases, therefore
            // we do not need geometric preview to be enabled.
            return(CoreComponent.CreateSingleton(uiContainer, false));
        }
Ejemplo n.º 3
0
        private CoreComponent(IGraphUiContainer uiContainer, bool enableGeometricPreview)
        {
            // Either create or reuse a session name.
            EstablishSessionName(uiContainer);

            this.uiContainer = uiContainer;
            if (false != enableGeometricPreview)
                this.renderService = new RenderService(this);

            if (this.HostApplication != null)
            {
                object filteredClasses = null;
                Dictionary<string, object> configs = this.HostApplication.Configurations;
                if (configs.TryGetValue(ConfigurationKeys.FilteredClasses, out filteredClasses))
                {
                    this.filteredClasses = ((string)filteredClasses).ToLower();
                    if (!this.filteredClasses.EndsWith(";"))
                        this.filteredClasses += ';';
                }
            }

            this.heartbeat = Heartbeat.GetInstance();
            this.studioSettings = StudioSettings;
        }
Ejemplo n.º 4
0
        private void EstablishSessionName(IGraphUiContainer uiContainer)
        {
            this.LaunchedForRecovery = false;
            this.sessionName = Guid.NewGuid().ToString("D").ToLower();

            // When an instance of DesignScript Studio crashes, its session name
            // will be passed to a new instance of the application through command
            // line argument. See "GraphController.GetBackupFileNameFormat" for
            // more details.
            //
            if (null == uiContainer || (null == uiContainer.HostApplication))
                return;

            Dictionary<string, object> configs = uiContainer.HostApplication.Configurations;
            if (null == configs || (configs.Count <= 0))
                return;

            object value = null;
            if (configs.TryGetValue(CoreStrings.SessionNameKey, out value))
            {
                string session = value as string;
                if (!string.IsNullOrEmpty(session))
                {
                    Guid dummyGuid; // Make sure it is a GUID value.
                    if (Guid.TryParse(session, out dummyGuid))
                    {
                        this.sessionName = session;
                        this.LaunchedForRecovery = true;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        internal static CoreComponent CreateSingleton(IGraphUiContainer uiContainer, bool enableGeometricPreview)
        {
            if (null != coreComponent)
                throw new InvalidOperationException("'CoreComponent.CreateSingleton' called twice");

            CoreComponent.coreComponent = new CoreComponent(uiContainer, enableGeometricPreview);
            return CoreComponent.coreComponent;
        }
Ejemplo n.º 6
0
        public static ICoreComponent CreateCoreComponent(IGraphUiContainer uiContainer, bool enableGeometricPreview)
        {
            if (null != CoreComponent.Instance)
                throw new InvalidOperationException("'ClassFactory.CreateCoreComponent' called twice!");

            return CoreComponent.CreateSingleton(uiContainer, enableGeometricPreview);
        }
Ejemplo n.º 7
0
        public static ICoreComponent CreateCoreComponent(IGraphUiContainer uiContainer)
        {
            if (null != CoreComponent.Instance)
                throw new InvalidOperationException("'ClassFactory.CreateCoreComponent' called twice!");

            // This method is called by NUnit test cases, therefore
            // we do not need geometric preview to be enabled.
            return CoreComponent.CreateSingleton(uiContainer, false);
        }