protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); Config.EndOfApplication = true; UiUpdater?.Stop(); EnvironmentThread?.Abort(); AnimationThread?.Abort(); }
private void BtnStopClick(object sender, EventArgs e) { EnvironmentThread?.Abort(); AnimationThread?.Abort(); UiUpdater?.Stop(); RefreshInfo(); SetButtonsEnable(false); }
public void GetFlashAnimationSync(Rect bound, Action <List <AnimationTo> > completedEvent) { AnimationThread obj = new AnimationThread(); obj.Paramaters.Add(bound); obj.CompletedEvent = completedEvent; Thread thread = new Thread(new ParameterizedThreadStart(this.GetFlashAnimationBackground)); thread.IsBackground = true; thread.Name = "FlashAnimation"; thread.Start(obj); }
void GetSwingAnimationBackground(object obj) { AnimationThread paramater = (AnimationThread)obj; Rect bound = (Rect)(paramater.Paramaters[0]); int swingTimes = (int)(paramater.Paramaters[1]); double range = (double)(paramater.Paramaters[2]); List <AnimationTo> jumps = this.GetSwing(bound, range, swingTimes); Application.Current.Dispatcher.BeginInvoke((Action)(() => { paramater.CompletedEvent(jumps); })); }
void GetShakeAnimationBackground(object obj) { AnimationThread paramater = (AnimationThread)obj; Rect bound = (Rect)(paramater.Paramaters[0]); int shakeTimes = (int)(paramater.Paramaters[1]); AOrientation orientation = (AOrientation)(paramater.Paramaters[2]); List <AnimationTo> jumps = this.GetShake(bound, orientation, shakeTimes); Application.Current.Dispatcher.BeginInvoke((Action)(() => { paramater.CompletedEvent(jumps); })); }
void GetGoAnimationBackground(object obj) { AnimationThread paramater = (AnimationThread)obj; Rect bound = (Rect)(paramater.Paramaters[0]); Rect screenBound = (Rect)(paramater.Paramaters[1]); ATowardto toward = (ATowardto)(paramater.Paramaters[2]); bool stopInBound = (bool)(paramater.Paramaters[3]); List <AnimationTo> jumps = this.GetGo(bound, screenBound, toward, stopInBound); Application.Current.Dispatcher.BeginInvoke((Action)(() => { paramater.CompletedEvent(jumps); })); }
public void GetSwingAnimationSync(Rect bound, int swingTimes, double range, Action <List <AnimationTo> > completedEvent) { AnimationThread obj = new AnimationThread(); obj.Paramaters.Add(bound); obj.Paramaters.Add(swingTimes); obj.Paramaters.Add(range); obj.CompletedEvent = completedEvent; Thread thread = new Thread(new ParameterizedThreadStart(this.GetSwingAnimationBackground)); thread.IsBackground = true; thread.Name = "SwingAnimation"; thread.Start(obj); }
public void GetShakeAnimationSync(Rect bound, AOrientation orientation, int shakeTimes, Action <List <AnimationTo> > completedEvent) { AnimationThread obj = new AnimationThread(); obj.Paramaters.Add(bound); obj.Paramaters.Add(shakeTimes); obj.Paramaters.Add(orientation); obj.CompletedEvent = completedEvent; Thread thread = new Thread(new ParameterizedThreadStart(this.GetShakeAnimationBackground)); thread.IsBackground = true; thread.Name = "ShakeAnimation"; thread.Start(obj); }
public void GetGoAnimationSync(Rect bound, Rect screenBound, ATowardto toward, bool stopInBound, Action <List <AnimationTo> > completedEvent) { AnimationThread obj = new AnimationThread(); obj.Paramaters.Add(bound); obj.Paramaters.Add(screenBound); obj.Paramaters.Add(toward); obj.Paramaters.Add(stopInBound); obj.CompletedEvent = completedEvent; Thread thread = new Thread(new ParameterizedThreadStart(this.GetGoAnimationBackground)); thread.IsBackground = true; thread.Name = "GoAnimation"; thread.Start(obj); }
void GetFlashAnimationBackground(object obj) { AnimationThread paramater = (AnimationThread)obj; Rect bound = (Rect)(paramater.Paramaters[0]); int times = this.rand.Next(5, 200); List <AnimationTo> result = new List <AnimationTo>(); for (int i = 0; i < times; i++) { AnimationTo at = this.GetRandomPosition(); Rect posRec = new Rect(at.To.X, at.To.Y, bound.Width, bound.Height); result.Add(at); AnimationTo stay = new AnimationTo(this.rand.NextDouble() * 3, at.To); result.Add(stay); } Application.Current.Dispatcher.BeginInvoke((Action)(() => { paramater.CompletedEvent(result); })); }
public void End() { AnimationThread?.Abort(); }