public void InitTouchOperation(Canvas CA_Main, MainPanel.Circle circle) { #region InitVars UC_Circle = circle; CA_MainCanvas = CA_Main; Ani_CWswitch = new DoubleAnimation() { FillBehavior = FillBehavior.HoldEnd, DecelerationRatio = 0.5, }; centerPoint = new Point(403, 267); timer.Interval = TimeSpan.FromMilliseconds(1); timer.Tick += new EventHandler((sender, e) => { counttime++; }); #endregion #region event handlers CA_MainCanvas.PreviewMouseDown += new MouseButtonEventHandler((sender, e) => { PressMouse(e.GetPosition(CA_MainCanvas)); }); CA_MainCanvas.PreviewMouseUp += new MouseButtonEventHandler((sender, e) => { ReleaseMouse(e.GetPosition(CA_MainCanvas)); }); CA_MainCanvas.MouseLeave += (sender, e) => { ReleaseMouse(e.GetPosition(CA_MainCanvas)); }; CA_MainCanvas.PreviewMouseMove += new MouseEventHandler((sender, e) => { MoveMouse(e); }); #endregion }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Window = ((MainPanel.TestWindow)(target)); return; case 2: this.LayoutRoot = ((System.Windows.Controls.Canvas)(target)); return; case 3: this.UC_Circle = ((MainPanel.Circle)(target)); return; case 4: this.CC_SubHost = ((System.Windows.Controls.ContentControl)(target)); return; } this._contentLoaded = true; }