private void AddLine(string s) { ColorAnimation animation = new ColorAnimation(Colors.Red, Colors.Black, new Duration(TimeSpan.FromSeconds(5))); var run = new Run(s); var paragraph = new Paragraph(run); paragraph.Foreground = new SolidColorBrush(Colors.Black); DisplayArea.Document.Blocks.Add(paragraph); paragraph.Foreground.ApplyAnimationClock(SolidColorBrush.ColorProperty, animation.CreateClock()); DisplayArea.ScrollToEnd(); }
public DwellTimeButton() { InitializeComponent(); _isClicked = false; _buttonList.Add(this); _timer = new DispatcherTimer(); _timer.Interval = new TimeSpan(0, 0, 0, 0, 10); _timer.Tick += _timer_Tick; #region MOUSE EVENTS _mouseEnterArgs = new MouseEventArgs(Mouse.PrimaryDevice, 0); _mouseEnterArgs.RoutedEvent = Mouse.MouseEnterEvent; _mouseLeaveArgs = new MouseEventArgs(Mouse.PrimaryDevice, 0); _mouseLeaveArgs.RoutedEvent = Mouse.MouseLeaveEvent; #endregion #region ANIMATION COLORS _redBrush = (Color)ColorConverter.ConvertFromString("#fe2712"); _greenBrush = (Color)ColorConverter.ConvertFromString("#ffffff"); #endregion #region COLOR ANIMATION _animatedBrush = new SolidColorBrush { Color = _greenBrush }; _enterColorAnimation = new ColorAnimation { To = _redBrush, Duration = TimeSpan.FromMilliseconds(_DWELL_TIME) }; _enterClock = _enterColorAnimation.CreateClock(); _enterClock.CurrentTimeInvalidated += new EventHandler(EnterClockCurrentTimeInvalidated); _leavecolorAnimation = new ColorAnimation { Duration = TimeSpan.FromMilliseconds(_DWELL_TIME / 2) }; _leaveClock = _leavecolorAnimation.CreateClock(); #endregion _dwelltime = _DWELL_TIME; //set the value for the dwell time Background = whiteBackground(); }
public void OnReaderConnect(object Capture, string ReaderSerialNumber) { this.Dispatcher.Invoke(() => { ColorAnimation animation = new ColorAnimation(); animation.From = (this.UIStatus.Foreground as SolidColorBrush).Color; animation.To = Colors.Blue; animation.Duration = new Duration(TimeSpan.FromMilliseconds(450)); animation.EasingFunction = new PowerEase() { Power = 5, EasingMode = EasingMode.EaseInOut }; this.ClockHide = animation.CreateClock(); this.UIStatus.Foreground.ApplyAnimationClock(SolidColorBrush.ColorProperty, ClockHide); }); }
public void Verify(DPFP.Sample Sample) { DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); // Check quality of the sample and start verification if it's good // TODO: move to a separate task if (features != null) { // Compare the feature set with our template DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); try { Verificator.Verify(features, this.curTemplate, ref result); if (result.Verified) { this.Dispatcher.Invoke(() => { if (this.ClockShow != null) { this.ClockShow.Controller.Pause(); } ColorAnimation animation = new ColorAnimation(); animation.From = (this.UIFinger_Printer.Foreground as SolidColorBrush).Color; animation.To = Colors.Green; animation.Duration = new Duration(TimeSpan.FromMilliseconds(450)); animation.EasingFunction = new PowerEase() { Power = 5, EasingMode = EasingMode.EaseInOut }; this.ClockHide = animation.CreateClock(); this.UIFinger_Printer.Foreground.ApplyAnimationClock(SolidColorBrush.ColorProperty, ClockHide); flagFinger = true; }); this.Stop(); } else { } } catch (Exception) { } } }
public void OnReaderDisconnect(object Capture, string ReaderSerialNumber) { this.Dispatcher.Invoke(() => { if (this.ClockHide != null) { this.ClockHide.Controller.Pause(); } ColorAnimation animation = new ColorAnimation(); animation.From = (this.UIFinger_Printer.Foreground as SolidColorBrush).Color; animation.To = Colors.Black; animation.Duration = new Duration(TimeSpan.FromMilliseconds(450)); animation.EasingFunction = new PowerEase() { Power = 5, EasingMode = EasingMode.EaseInOut }; this.ClockShow = animation.CreateClock(); this.UIFinger_Printer.Foreground.ApplyAnimationClock(SolidColorBrush.ColorProperty, ClockShow); }); }
private void ColorAnimationCompleted(object sender = null, EventArgs e = null) { if (this.oldAnimation != null) { this.oldAnimation.Completed -= this.ColorAnimationCompleted; this.oldAnimation = null; } var colorAnimation = new ColorAnimation(DefaultColors[this.actualColor], new Duration(TimeSpan.FromSeconds(2)), FillBehavior.HoldEnd); colorAnimation.Completed += this.ColorAnimationCompleted; this.arc.Stroke.ApplyAnimationClock(SolidColorBrush.ColorProperty, colorAnimation.CreateClock(), HandoffBehavior.Compose); this.oldAnimation = colorAnimation; if (this.actualColor == DefaultColors.Count - 1) { this.actualColor = 0; } else { this.actualColor++; } }
private void Parse(DPFP.Sample Sample) { //MessageBox.Show("OK"); DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment); // Check quality of the sample and add to enroller if it's good if (features != null) { try { try { Enroller.AddFeatures(features); // Add feature set to template. } catch { } } finally { UpdateStatus(); // Check if template has been created. switch (Enroller.TemplateStatus) { case DPFP.Processing.Enrollment.Status.Ready: // report success and stop capturing Stop(); this.Dispatcher.Invoke(() => { if (this.ClockHide != null) { this.ClockHide.Controller.Pause(); } ColorAnimation animation = new ColorAnimation(); animation.From = (this.UIStatus.Foreground as SolidColorBrush).Color; animation.To = Colors.Red; animation.Duration = new Duration(TimeSpan.FromMilliseconds(450)); animation.EasingFunction = new PowerEase() { Power = 5, EasingMode = EasingMode.EaseInOut }; this.ClockShow = animation.CreateClock(); this.UIStatus.Foreground.ApplyAnimationClock(SolidColorBrush.ColorProperty, ClockShow); }); if (OnTemplateEvent != null) { OnTemplateEvent(this, Enroller.Template); } break; case DPFP.Processing.Enrollment.Status.Failed: // report failure and restart capturing Enroller.Clear(); Stop(); this.Dispatcher.Invoke(() => { this.UITime.Text = "Try again ..."; this.UITime.FontSize = 15.333; this.UITime.FontWeight = FontWeights.Normal; this.UITime.Foreground = new SolidColorBrush(Colors.White); }); Start(); break; } } } }
public void Verify(DPFP.Sample Sample) { DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); // Check quality of the sample and start verification if it's good // TODO: move to a separate task if (features != null) { // Compare the feature set with our template DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); Verificator.Verify(features, Template, ref result); if (result.Verified) { this.Dispatcher.Invoke(() => { if (this.ClockShow != null) { this.ClockShow.Controller.Pause(); } ColorAnimation animation = new ColorAnimation(); animation.From = (this.UIFinger_Printer.Foreground as SolidColorBrush).Color; animation.To = Colors.Green; animation.Duration = new Duration(TimeSpan.FromMilliseconds(450)); animation.EasingFunction = new PowerEase() { Power = 5, EasingMode = EasingMode.EaseInOut }; animation.Completed += (s, e) => { App.curUser = UserData.Info(this.cacheName); App.curUserID = App.curUser.ID; if (this.UIAutoLogin.IsChecked.Value) { App.cache.hashUserName = App.getHash(App.curUserID); App.cache.userName = Encrypt.EncryptString(this.UITxtName.Text.Trim(), FunctionStatics.getCPUID()); AltaCache.Write(App.CacheName, App.cache); } else { App.cache.userName = string.Empty; App.cache.hashUserName = string.Empty; } this.UIFullName.Text = App.curUser.Full_Name; this.UILoginFinger.Animation_Translate_Frame(double.NaN, double.NaN, 400, double.NaN, 500); this.UILoginSusscess.Animation_Translate_Frame(-400, double.NaN, 0, double.NaN, 500, () => { LoadData(); }); }; this.ClockHide = animation.CreateClock(); this.UIFinger_Printer.Foreground.ApplyAnimationClock(SolidColorBrush.ColorProperty, ClockHide); this.UIFinger_Status.Text = string.Empty; }); this.Stop(); } else { this.Dispatcher.Invoke(() => { this.UIFinger_Status.Text = "Try again ..."; }); } } }