Ejemplo n.º 1
0
        public Page(IDictionary <string, string> initParams)
        {
            UseLayoutRounding = true;

            MEFHost.Instance.RegisterExtensionAssemblyFromType <Page>();

            // this needs to be initialized first since subsequent calls
            // rely on having serializable settings already available
            DynamicGeometry.Settings.Instance = new IsolatedStorageBasedSettings();

            drawingHost = new DrawingHost();
            AddBehaviors();
            this.Content = drawingHost;

            InitParams = initParams;
            var settings = Application.Current.Host.Settings;

            if (Application.Current.IsRunningOutOfBrowser)
            {
                settings.EnableAutoZoom = false;
            }

            //settings.EnableGPUAcceleration = true;
            //settings.EnableRedrawRegions = true;
            //settings.EnableCacheVisualization = true;
            //settings.EnableFrameRateCounter = true;

            PageSettings = new Settings(this);
            if (initParams.ContainsKey("ShowToolbar"))
            {
                PageSettings.ShowToolbar = bool.Parse(initParams["ShowToolbar"]);
            }

            drawingHost.ReadyForInteraction += drawingHost_ReadyForInteraction;
            drawingHost.UnhandledException  += drawingHost_UnhandledException;

            InitializeToolbar();

            this.KeyDown += Page_KeyDown;
            DownloadDemoFile();
            IsolatedStorage.LoadAllTools();
            IsolatedStorage.RegisterToolStorage();
        }
Ejemplo n.º 2
0
        public Page(IDictionary <string, string> initParams)
        {
            System.Windows.Threading.SmartDispatcher.Initialize();
            initParseWorker();

            UseLayoutRounding = true;

            MEFHost.Instance.RegisterExtensionAssemblyFromType <Page>();

            // this needs to be initialized first since subsequent calls
            // rely on having serializable settings already available
            DynamicGeometry.Settings.Instance = new IsolatedStorageBasedSettings();

            drawingHost = new DrawingHost();
            AddBehaviors();
            this.Content = drawingHost;

            drawingHost.AIDebugWindow.MakeUIDebugPublisher();
            UIDebugPublisher = GeometryTutorLib.UIDebugPublisher.getInstance();
            ProblemDrawer.create(drawingHost);

            InitParams = initParams;
            var settings = Application.Current.Host.Settings;

            if (Application.Current.IsRunningOutOfBrowser)
            {
                settings.EnableAutoZoom = false;
            }

            //settings.EnableGPUAcceleration = true;
            //settings.EnableRedrawRegions = true;
            //settings.EnableCacheVisualization = true;
            //settings.EnableFrameRateCounter = true;

            PageSettings = new Settings(this);
            if (initParams.ContainsKey("ShowToolbar"))
            {
                PageSettings.ShowToolbar = bool.Parse(initParams["ShowToolbar"]);
            }

            drawingHost.ReadyForInteraction += drawingHost_ReadyForInteraction;
            drawingHost.UnhandledException  += drawingHost_UnhandledException;

            InitializeToolbar();

            this.KeyDown += Page_KeyDown;
            DownloadDemoFile();
            IsolatedStorage.LoadAllTools();
            IsolatedStorage.RegisterToolStorage();

            if (isolatedSettings.Contains("UserParseGroup"))
            {
                List <ParseGroup> userParseGroups = (List <ParseGroup>)isolatedSettings["UserParseGroup"];
                foreach (ParseGroup pg in userParseGroups)
                {
                    ParseGroup.AddParseGroup(pg.Name, pg.Assumptions);
                    UIDebugPublisher.publishString(pg.Name);
                }
            }

            parseOptionsWindow         = new ParseOptionsWindow();
            parseOptionsWindow.Closed += new EventHandler(ParseOptionsWindow_Closed);
            manageGivensWindow         = new ManageGivensWindow()
            {
                drawingHost = drawingHost
            };
            problemCharacteristicsWindow         = new ProblemCharacteristicsWindow(manageGivensWindow);
            problemCharacteristicsWindow.Closed += new EventHandler(ProblemCharacteristicsWindow_Closed);
            enterSolutionWindow = new EnterSolutionWindow()
            {
                drawingHost = drawingHost
            };
            bookProblemWindow         = new BookProblemWindow();
            bookProblemWindow.Closed += new EventHandler(DrawProblemWindow_Close);
            synthProblemWindow        = new SynthesizeProblemWindow();
        }