Bilgisayar Kapatma Programı Yapımı

HAKOPS

Kıdemli Üye
11 Tem 2011
4,199
6
Izmir
Bu derste kodlarını verdiğim programla bilgisayarınızı otomatik olarak kapatabileceksiniz.

rq2j.jpg


Kod:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication32
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private **** button1_Click(object sender, EventArgs e)
        {
            
            if (comboBox1.Text == "10 dak")
            {
                System.Diagnostics.Process.Start("shutdown", "-f -s -t 600");
            }
            else if (comboBox1.Text == "15 dak")
            {
                System.Diagnostics.Process.Start("shutdown", "-f -s -t 900");
            }
            else if (comboBox1.Text == "30 dak")
            {
                System.Diagnostics.Process.Start("shutdown", "-f -s -t 1800");
            }
            else if (comboBox1.Text == "1 saat")
            {
                System.Diagnostics.Process.Start("shutdown", "-f -s -t 3600");
            }
            else if (comboBox1.Text == "2 saat")
            {
                System.Diagnostics.Process.Start("shutdown", "-f -s -t 7200");
            }
            else if (comboBox1.Text == "5 saat")
            {
                System.Diagnostics.Process.Start("shutdown", "-f -s -t 18000");
            }
            else if (comboBox1.Text == "10 saat")
            {
                System.Diagnostics.Process.Start("shutdown", "-f -s -t 36000");
            }
            else if (comboBox1.Text == "15 saat")
            {
                System.Diagnostics.Process.Start("shutdown", "-f -s -t 54000");
            }
            else if (comboBox1.Text == "24 saat")
            {
                System.Diagnostics.Process.Start("shutdown", "-f -s -t 86400");
            }
            
            else
            {
                MessageBox.Show("Kapanma zamanını belirleyiniz");
            }
        }

        

        private **** button2_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("shutdown", "-a");
        }
    }
}
 

korewenk34

Üye
15 Tem 2009
164
0
Aslında switch case ilen daha ilerletile bilir listeleme biçimi yerine direk kullanıcıdan istenilebilir.
Paylaşım için teşekürler..
 
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.