{"id":297,"date":"2013-07-08T06:06:40","date_gmt":"2013-07-08T06:06:40","guid":{"rendered":"http:\/\/www.mahmuttalhakoz.com\/blog\/?p=297"},"modified":"2013-07-08T10:24:23","modified_gmt":"2013-07-08T10:24:23","slug":"c-ile-geri-sayim-sayaci","status":"publish","type":"post","link":"https:\/\/www.mahmuttalhakoz.com\/blog\/index.php\/2013\/07\/08\/c-ile-geri-sayim-sayaci\/","title":{"rendered":"c# ile Geri Sayim Sayaci"},"content":{"rendered":"<p><a href=\"https:\/\/www.mahmuttalhakoz.com\/blog\/wp-content\/uploads\/2013\/07\/geri-sayim-sayaci1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mahmuttalhakoz.com\/blog\/wp-content\/uploads\/2013\/07\/geri-sayim-sayaci1.jpg\" alt=\"Geri Sayim Sayaci\" width=\"298\" height=\"59\" class=\"aligncenter size-full wp-image-305\" \/><\/a><\/p>\n<p>Belirlenen tarihe geri sayim islemini, uygulamalar icin yapacagiz. Kod blogumuza gecmeden once yaptigimiz islem ve yapmamiz gerekenlere kisaca deginelim. Timer1&#8217;in &#8220;Interval&#8221; ozelligini &#8220;1000&#8221; olarak degistiriyoruz. Bunun anlami Timer&#8217;in saniyede bir kere  calismasidir. Ayrica asagida gordugunuz if kontrolleri de sayacin -(negatif) bir deger almamasi icindir.  <\/p>\n<p>Asagidaki kodlar 30 Eylul tarihine geri sayim yapmaktadir. Biz yil bazinda bir kisitlama getirmedigimiz icin 30 Eylul 2013&#8217;u gectikten sonra 30 Eylul 2014&#8217;e devam edecektir. Eger kendimiz baska bir tarihe geri sayim yaptirtmak istersek asagidaki kod blogunu kendimize gore duzenlemeliyiz;<\/p>\n<p><code><br \/>\n            DateTime dt = new DateTime(2013, 09, 30, 00, 00, 00);\/\/YIL,AY,GUN,SAAT,DAKIKA,SANIYE seklinde<br \/>\n<\/code><\/p>\n<p>Kod blogumuz su sekilde;<\/p>\n<p><code><br \/>\n        private void btnBaslat_Click(object sender, EventArgs e)<br \/>\n         {<br \/>\n            if (timer1.Enabled)<br \/>\n            {<br \/>\n                timer1.Stop();<br \/>\n                btnBaslat.Text = \"Baslat\";<br \/>\n            }<br \/>\n            else<br \/>\n            {<br \/>\n                timer1.Start();<br \/>\n                btnBaslat.Text = \"Durdur\";<br \/>\n            }<br \/>\n            SayaciGetir();<br \/>\n        }<\/p>\n<p>        public void SayaciGetir()<br \/>\n        {<br \/>\n            DateTime dt = new DateTime(2013, 09, 30, 00, 00, 00);<br \/>\n            long tic = dt.Ticks;<br \/>\n            gun = dt.Day - DateTime.Now.Day;<br \/>\n            saat = dt.Hour - DateTime.Now.Hour;<br \/>\n            dakika = dt.Minute - DateTime.Now.Minute;<br \/>\n            saniye = dt.Second - DateTime.Now.Second;<br \/>\n            ay = dt.Month - DateTime.Now.Month;<br \/>\n            if (gun < 0)\n                gun += 30;\n            if (saat < 0)\n                saat += 24;\n            if (dakika < 0)\n                dakika += 60;\n            if (saniye < 0)\n                saniye += 60;\n            if (ay < 0)\n                ay += 12;\n\n            lblGun.Text = gun.ToString(\"00\") + \" gun \";\n            lblSaat.Text = saat.ToString(\"00\") + \" saat \";\n            lblDakika.Text = dakika.ToString(\"00\") + \" dakika \";\n            lblSaniye.Text = saniye.ToString(\"00\") + \" saniye kaldi\";\n            lblAy.Text = ay.ToString(\"00\") + \" ay \";\n        }\n        int gun, saat, dakika, saniye,ay;\n        private void timer1_Tick(object sender, EventArgs e)\n        {\n            SayaciGetir();\n        }\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Belirlenen tarihe geri sayim islemini, uygulamalar icin yapacagiz. Kod blogumuza gecmeden once yaptigimiz islem ve yapmamiz gerekenlere kisaca deginelim. Timer1&#8217;in &#8220;Interval&#8221; ozelligini &#8220;1000&#8221; olarak degistiriyoruz.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[139,137,138],"class_list":["post-297","post","type-post","status-publish","format-standard","hentry","category-csharp","tag-c-belirli-tarihe-geri-sayim","tag-c-geri-sayim-sayaci","tag-c-ile-geri-sayim"],"_links":{"self":[{"href":"https:\/\/www.mahmuttalhakoz.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/297"}],"collection":[{"href":"https:\/\/www.mahmuttalhakoz.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mahmuttalhakoz.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mahmuttalhakoz.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mahmuttalhakoz.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=297"}],"version-history":[{"count":7,"href":"https:\/\/www.mahmuttalhakoz.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/297\/revisions"}],"predecessor-version":[{"id":309,"href":"https:\/\/www.mahmuttalhakoz.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/297\/revisions\/309"}],"wp:attachment":[{"href":"https:\/\/www.mahmuttalhakoz.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mahmuttalhakoz.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mahmuttalhakoz.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}