Exemplo n.º 1
0
        public void InitializeToolbar()
        {
            ShowToolbarButtonText = IsolatedStorage.GetSetting("ShowToolbarText", true);

            CommandNew      = new Command(New, GetImageFromResource("New.png"), "New", "Drawing");
            CommandOpen     = new Command(Open, GetImageFromResource("Open.png"), "Open", "Drawing");
            CommandSave     = new Command(Save, GetImageFromResource("Save.png"), "Save", "Drawing");
            CommandPrint    = new Command(Print, GetImageFromResource("Print.png"), "Print", "Drawing");
            CommandSamples  = new Command(Samples, GetImageFromResource("Samples.png"), "Samples", "Drawing");
            CommandSettings = new Command(OpenSettings, GetImageFromResource("Repair.png"), "Settings", "Drawing");
            CommandHomepage = new Command(Homepage, GetImageFromResource("Homepage.png"), "Homepage", "Drawing");

            drawingHost.DrawingControl.CommandUndo.Icon = GetImageFromResource("Undo.png");
            drawingHost.DrawingControl.CommandRedo.Icon = GetImageFromResource("Redo.png");

            drawingHost.AddToolbarButton(drawingHost.CommandToggleGrid);
            drawingHost.AddToolbarButton(CommandNew);
            drawingHost.AddToolbarButton(CommandOpen);
            drawingHost.AddToolbarButton(CommandSave);
            drawingHost.AddToolbarButton(CommandPrint);
            drawingHost.AddToolbarButton(drawingHost.DrawingControl.CommandUndo);
            drawingHost.AddToolbarButton(drawingHost.DrawingControl.CommandRedo);
            drawingHost.AddToolbarButton(CommandSamples);
            drawingHost.AddToolbarButton(CommandSettings);
            drawingHost.AddToolbarButton(drawingHost.CommandShowFigureExplorer);
            drawingHost.AddToolbarButton(CommandHomepage);
            drawingHost.AddToolbarButton(drawingHost.CommandToggleOrtho);
            drawingHost.AddToolbarButton(drawingHost.CommandToggleSnapToGrid);
            drawingHost.AddToolbarButton(drawingHost.CommandToggleSnapToPoint);
            drawingHost.AddToolbarButton(drawingHost.CommandToggleSnapToCenter);
            drawingHost.AddToolbarButton(drawingHost.CommandToggleLabelNewPoints);
            drawingHost.AddToolbarButton(drawingHost.CommandTogglePolar);

            drawingHost.Ribbon.GetPanel("Drawing").HeaderContent.Icon = GetImageFromResource("SaveFormDesign.png");
        }
Exemplo n.º 2
0
        public void InitializeToolbar()
        {
            ShowToolbarButtonText = IsolatedStorage.GetSetting("ShowToolbarText", true);

            CommandNew                             = new Command(New, GetImageFromResource("New.png"), "New", "Drawing");
            CommandOpen                            = new Command(Open, GetImageFromResource("Open.png"), "Open", "Drawing");
            CommandSave                            = new Command(Save, GetImageFromResource("Save.png"), "Save", "Drawing");
            CommandPrint                           = new Command(Print, GetImageFromResource("Print.png"), "Print", "Drawing");
            CommandSamples                         = new Command(Samples, GetImageFromResource("Samples.png"), "Samples", "Drawing");
            CommandSettings                        = new Command(OpenSettings, GetImageFromResource("Repair.png"), "Settings", "Drawing");
            CommandHomepage                        = new Command(Homepage, GetImageFromResource("Homepage.png"), "Homepage", "Drawing");
            CommandParse                           = new Command(ParseToAst, GetImageFromResource("Parse.png"), "Parse", "Parsing");
            CommandParseOptions                    = new Command(DisplayParseOptions, GetImageFromResource("ParseOptions.png"), "Def and Theorem Options", "Parsing");
            CommandProblemCharacteristics          = new Command(DisplayProblemCharacteristics, GetImageFromResource("ParseOptions.png"), "Desired Problem Characteristics", "Parsing");
            CommandEnterSolution                   = new Command(DisplayEnterSolution, GetImageFromResource("Parse.png"), "Enter Solution", "Parsing");
            CommandManageGivens                    = new Command(DisplayManageGivens, GetImageFromResource("ParseOptions.png"), "Manage Givens", "Parsing");
            CommandStartRegionShading              = new Command(StartRegionShading, GetImageFromResource("Play.png"), "Start Shading", "Regions");
            CommandMakeBookProblem                 = new Command(DrawBookProblem, GetImageFromResource("Draw.png"), "Book Problem", "Parsing");
            CommandSynthProblem                    = new Command(SynthesizeProblem, GetImageFromResource("Draw.png"), "Synthesize Problem", "Parsing");
            CommandClearRegionShading              = new Command(ClearRegionShading, GetImageFromResource("Trash.png"), "Clear Shading", "Regions");
            CommandClearRegionShading.Icon.Opacity = 0.2;

            drawingHost.DrawingControl.CommandUndo.Icon = GetImageFromResource("Undo.png");
            drawingHost.DrawingControl.CommandRedo.Icon = GetImageFromResource("Redo.png");

            drawingHost.AddToolbarButton(drawingHost.CommandToggleGrid);
            drawingHost.AddToolbarButton(CommandNew);
            drawingHost.AddToolbarButton(CommandOpen);
            drawingHost.AddToolbarButton(CommandSave);
            drawingHost.AddToolbarButton(CommandPrint);
            drawingHost.AddToolbarButton(drawingHost.DrawingControl.CommandUndo);
            drawingHost.AddToolbarButton(drawingHost.DrawingControl.CommandRedo);
            drawingHost.AddToolbarButton(CommandSamples);
            drawingHost.AddToolbarButton(CommandSettings);
            drawingHost.AddToolbarButton(drawingHost.CommandShowFigureExplorer);
            drawingHost.AddToolbarButton(CommandHomepage);
            drawingHost.AddToolbarButton(drawingHost.CommandToggleOrtho);
            drawingHost.AddToolbarButton(drawingHost.CommandToggleSnapToGrid);
            drawingHost.AddToolbarButton(drawingHost.CommandToggleSnapToPoint);
            drawingHost.AddToolbarButton(drawingHost.CommandToggleSnapToCenter);
            drawingHost.AddToolbarButton(drawingHost.CommandToggleLabelNewPoints);
            drawingHost.AddToolbarButton(drawingHost.CommandTogglePolar);

            drawingHost.AddToolbarButton(CommandParse);
            drawingHost.AddToolbarButton(drawingHost.CommandShowAIDebugWindow);
            drawingHost.AddToolbarButton(CommandParseOptions);
            //drawingHost.AddToolbarButton(CommandProblemCharacteristics);
            drawingHost.AddToolbarButton(CommandManageGivens);
            drawingHost.AddToolbarButton(CommandEnterSolution);
            drawingHost.AddToolbarButton(CommandMakeBookProblem);
            drawingHost.AddToolbarButton(CommandSynthProblem);
            drawingHost.AddToolbarButton(CommandStartRegionShading);
            drawingHost.AddToolbarButton(CommandClearRegionShading);

            drawingHost.Ribbon.GetPanel("Drawing").HeaderContent.Icon = GetImageFromResource("SaveFormDesign.png");
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
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();
        }
Exemplo n.º 5
0
 public override void RenameTool(UserDefinedTool behavior, string newName)
 {
     IsolatedStorage.SaveTool(behavior.RootElement);
 }
Exemplo n.º 6
0
 public override void RemoveTool(UserDefinedTool behavior)
 {
     IsolatedStorage.RemoveTool(behavior.RootElement);
 }
Exemplo n.º 7
0
 public override void AddTool(UserDefinedTool newBehavior)
 {
     IsolatedStorage.AddTool(newBehavior.RootElement);
 }