public Digit nextHigherDigit = null; //Left digit of the current digit. public Digit(int weight,TextBlock textBl,TranslateTransform tf,Digit dig) { this.weight = weight; this.tb = textBl; this.TBRender = tf; this.nextHigherDigit = dig; totalLength = tb.ActualHeight; // Kayisin toplam uzunlugu(Gorunmeyen kısım dahil totalNumberCount = 13; //Kayistaki numaralarin sayisi-Extra olanlar dahil resolutionPerNumber = totalLength / totalNumberCount;//Her bir rakamın kapladığı yükseklik periodKayisLength = 10 * resolutionPerNumber;//Kayistaki bir periyodun uzunluğu(10 rakam) increasePeriodMilestone = -162; decreasePeriodMilestone = -85; }
private void incForUpdated2() { TranslateTransform tfFirst = new TranslateTransform(); TranslateTransform tfSecond = new TranslateTransform(); tb1.RenderTransform = tfFirst; tb2.RenderTransform = tfSecond; Digit digit10 = new Digit(10,tb2, tfSecond, null); Digit digit1 = new Digit(1,tb1, tfFirst, digit10); var timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(250) }; timer.Start(); timer.Tick += (sender, args) => { increaseDigitObj(digit1, TimeSpan.FromMilliseconds(250)); }; }
private void increaseDigitObj(Digit digit, TimeSpan time) { if (digit.increasePeriodCheck()) { TranslateTransform tfSlide = new TranslateTransform(0, digit.TBRender.Y + periodKayisLength); digit.TBRender = tfSlide; digit.tb.RenderTransform = digit.TBRender; if (digit.nextHigherDigit != null) { increaseDigitObj(digit.nextHigherDigit, TimeSpan.FromMilliseconds(100)); } } double newPos = digit.TBRender.Y; newPos = newPos - resolutionPerNumber; DoubleAnimation animationTB1 = new DoubleAnimation(newPos, time); digit.TBRender.BeginAnimation(TranslateTransform.YProperty, animationTB1); }