public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/NewToon;component/MainPage.xaml", System.UriKind.Relative)); this.guiUserControl = ((System.Windows.Controls.UserControl)(this.FindName("guiUserControl"))); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.WorkspaceView = ((ToonGui.Workspace)(this.FindName("WorkspaceView"))); this.ToolBarView = ((ToonGui.ToolBar)(this.FindName("ToolBarView"))); }
public void Initialize(Workspace ws) { WorkspaceController = ws.WorkspaceController; bmiAnimate.Tag = new ToolAnimate(ws); bmiPivot.Tag = new ToolPivot(ws); bmiSelect.Tag = new ToolSelect(ws); bmiPencil.Tag = new ToolPencil(ws); bmiInvisibleInk.Tag = new ToolInvisibleInk(ws); bmiBucket.Tag = new ToolBucket(ws); bmiDropper.Tag = new ToolDropper(ws); bmiPenknife.Tag = new ToolPenknife(ws); bmiText.Tag = new ToolText(ws); bmiHand.Tag = new ToolHand(ws); bmiMagnify.Tag = new ToolMagnify(ws); bmiShape.Tag = "ToolShape"; // NOTE: this is special see ToolIsCheckedConverter bmiShape_Rectangle.Tag = new ToolRectangle(ws); bmiShape_Triangle.Tag = new ToolTriangle(ws); bmiShape_Ellipse.Tag = new ToolEllipse(ws); bmiShape_Star.Tag = new ToolStar(ws); bmiShape_SpeechBubble.Tag = new ToolSpeechBubble(ws); bmiShape_Pen.Tag = new ToolPen(ws); lastShapeTool = bmiShape_Rectangle.Tag as ToolShape; GuiCouplingProvider.ActiveTool = bmiPencil.Tag as ToolPencil; // TODO: The user can still manually switch to another tool by simply clicking // the tool. We should disable a lot of tools as well as other features (Playing Senario) ViewModelLocator.AppVMLocator.PlayBackMenuVM.PropertyChanged += new PropertyChangedEventHandler((s, e) => { if (e.PropertyName == "IsPlaying" && ViewModelLocator.AppVMLocator.PlayBackMenuVM.IsPlaying) { // When it's in Playing Mode, the current tool should switch to Animate Tool // (if is not already), and the Animate Selection Box should be hidden (NOT deselected). if (GuiCouplingProvider.ActiveTool.ToolType != TnToolType.Pivot) { bmiTool_Click(bmiPivot, null); } } }); }