21 Ekim 2014 Salı
GÖREV PLANLAMA PROGRAM ÖRNEĞİ
ANAFORM KODLARI:
Option Explicit On Option Strict On Imports System.Globalization Public Class Anafrm Private Declare Function SetProcessWorkingSetSize Lib "kernel32.dll" (ByVal process As IntPtr, ByVal minimumWorkingSetSize As Integer, ByVal maximumWorkingSetSize As Integer) As Integer Dim izinVer As Boolean = False #Region " BUTON STİLİ... " Private Sub btnTakvim_MouseMove(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles btnTakvim.MouseMove btnTakvim.ForeColor = Color.Red End Sub Private Sub btnTakvim_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTakvim.MouseLeave btnTakvim.ForeColor = Color.Black End Sub Private Sub btnGorevler_MouseMove(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles btnGorevler.MouseMove btnGorevler.ForeColor = Color.Red End Sub Private Sub btnGorevler_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGorevler.MouseLeave btnGorevler.ForeColor = Color.Black End Sub Private Sub btnAyarlar_MouseMove(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles btnAyarlar.MouseMove btnAyarlar.ForeColor = Color.Red End Sub Private Sub btnAyarlar_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAyarlar.MouseLeave btnAyarlar.ForeColor = Color.Black End Sub Private Sub btnYardim_MouseMove(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles btnYardim.MouseMove btnYardim.ForeColor = Color.Red End Sub Private Sub btnYardim_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnYardim.MouseLeave btnYardim.ForeColor = Color.Black End Sub #End Region Private Sub BellegeGom() GC.Collect() GC.WaitForPendingFinalizers() If (Environment.OSVersion.Platform = PlatformID.Win32NT) Then SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1) End If End Sub Private Sub GrupAyariGuncelle() lblSifreNotu.Visible = False If (Not SifreAyarla()) And (My.Settings.SifreTipi <> 0) Then lblSifreNotu.Visible = True End If End Sub Public Sub GorevYukle() Dim HerGorev As Task Dim Item As ListViewItem Dim I As Integer = 0 LWgorevler.Items.Clear() If Gorevler Is Nothing Then Exit Sub For Each HerGorev In Gorevler If (HerGorev.Tip = 0) Or (HerGorev.Tip = 1) Then Takvim.AddBoldedDate(HerGorev.BitimTarihi) End If Item = LWgorevler.Items.Add(HerGorev.isim) Item.Tag = I If HerGorev.Etkin = False Then Item.ForeColor = Color.Gray End If Item.Checked = HerGorev.Etkin Item.SubItems.Add(ZamanDizesi(HerGorev.Tip, HerGorev.BitimTarihi)) Item.SubItems.Add(EylemicinDize(HerGorev.GorevTipi, HerGorev.EylemTipi)) I += 1 Next Takvim.UpdateBoldedDates() Takvim_DateSelected(Nothing, Nothing) End Sub Public Sub GrupDegisti(ByRef Grup As GroupBox) If ((My.Settings.SifreTipi = 1) And (Not izinVer)) Or ((My.Settings.SifreTipi = 2) And (Not izinVer) And (Grup Is grpAyarlar)) Then GrbTakvim.Visible = False grpGorevler.Visible = False grpAyarlar.Visible = False grpYardim.Visible = False grpSifreYoksa.Visible = True Else If Grup.Visible = False Then GrbTakvim.Visible = False grpGorevler.Visible = False grpAyarlar.Visible = False grpYardim.Visible = False grpSifreYoksa.Visible = False Grup.Visible = True End If End If End Sub Private Sub Anafrm_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed BellegeGom() End Sub Private Sub Anafrm_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed Dispose(True) 'End End Sub Private Sub Anafrm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If (My.Settings.SifreTipi = 0) Or (Not SifreAyarla()) Then RadioBtnSifresiz.Checked = True lblYanSifre.Visible = False txtYanSifre.Visible = False btnSifreDogrula.Visible = False LblSifreKontrol.Visible = False izinVer = True Else lblYanSifre.Visible = True txtYanSifre.Visible = True btnSifreDogrula.Visible = True LblSifreKontrol.Visible = True btnEkle.Enabled = False EkleBtn.Enabled = False LblSifreKontrol.ForeColor = Color.DarkRed If My.Settings.SifreTipi = 1 Then RadioBtnSifreli.Checked = True LblSifreKontrol.Text = "Şifre olmadan Göremez ve Görev düzenleyemezsiniz." Else RadioBtnSifreDegis.Checked = True LblSifreKontrol.Text = "Şifre olmadan Görev düzenleyemezsiniz." End If End If btnTakvim.ForeColor = Color.Gray btnGorevler.ForeColor = Color.Gray btnAyarlar.ForeColor = Color.Gray btnYardim.ForeColor = Color.Gray GrupDegisti(GrbTakvim) GrupAyariGuncelle() End Sub Private Sub btnTakvim_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTakvim.Click GrupDegisti(GrbTakvim) End Sub Private Sub btnGorevler_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGorevler.Click GrupDegisti(grpGorevler) End Sub Private Sub GorevLW_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles GorevLW.ItemCheck If e.NewValue = CheckState.Checked Then Gorevler(CInt(GorevLW.Items(e.Index).Tag)).Etkin = True GorevLW.Items(e.Index).ForeColor = Color.Black Else Gorevler(CInt(GorevLW.Items(e.Index).Tag)).Etkin = False GorevLW.Items(e.Index).ForeColor = Color.Gray End If GorevGuncelle() End Sub Private Sub LWgorevler_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LWgorevler.SelectedIndexChanged If (My.Settings.SifreTipi = 2) And (Not izinVer) Then btnKaldir.Enabled = False btnDuzenle.Enabled = False Else If LWgorevler.SelectedItems.Count = 0 Then If Not btnKaldir.Enabled = False Then btnKaldir.Enabled = False If Not btnDuzenle.Enabled = False Then btnDuzenle.Enabled = False btnGit.Enabled = False Else If Not btnKaldir.Enabled = True Then btnKaldir.Enabled = True If Not btnDuzenle.Enabled = True Then btnDuzenle.Enabled = True If (Gorevler(CInt(LWgorevler.Items(LWgorevler.SelectedItems(0).Index).Tag)).Tip = 0) Or (Gorevler(CInt(LWgorevler.Items(LWgorevler.SelectedItems(0).Index).Tag)).Tip = 1) Then btnGit.Enabled = True Else btnGit.Enabled = False End If End If End If End Sub Private Sub Takvim_DateSelected(ByVal sender As Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles Takvim.DateSelected Dim HerGorev As Task Dim Oge As ListViewItem Dim I As Integer = 0 GorevLW.Items.Clear() If Gorevler Is Nothing Then Exit Sub For Each HerGorev In Gorevler If ((HerGorev.Tip = 0) Or (HerGorev.Tip = 1)) And (HerGorev.BitimTarihi.Year = Takvim.SelectionRange.Start.Year) And (HerGorev.BitimTarihi.Month = Takvim.SelectionRange.Start.Month) And (HerGorev.BitimTarihi.Day = Takvim.SelectionRange.Start.Day) Then Oge = GorevLW.Items.Add(HerGorev.isim) Oge.Tag = I If HerGorev.Etkin = False Then Oge.ForeColor = Color.Gray End If Oge.Checked = HerGorev.Etkin Oge.SubItems.Add(EylemicinDize(HerGorev.GorevTipi, HerGorev.EylemTipi)) End If I += 1 Next If GorevLW.SelectedItems.Count = 0 Then If Not KaldirBtn.Enabled = False Then KaldirBtn.Enabled = False If Not DuzenleBtn.Enabled = False Then DuzenleBtn.Enabled = False Else If Not KaldirBtn.Enabled = True Then KaldirBtn.Enabled = True If Not DuzenleBtn.Enabled = True Then DuzenleBtn.Enabled = True End If End Sub Private Sub GorevLW_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GorevLW.SelectedIndexChanged If (My.Settings.SifreTipi = 2) And (Not izinVer) Then KaldirBtn.Enabled = False DuzenleBtn.Enabled = False Else If GorevLW.SelectedItems.Count = 0 Then If Not KaldirBtn.Enabled = False Then KaldirBtn.Enabled = False If Not DuzenleBtn.Enabled = False Then DuzenleBtn.Enabled = False Else If Not KaldirBtn.Enabled = True Then KaldirBtn.Enabled = True If Not DuzenleBtn.Enabled = True Then DuzenleBtn.Enabled = True End If End If End Sub Private Sub EkleBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EkleBtn.Click Dim YeniGorevEkle As New GorevEklefrm YeniGorevEkle.dtpTarih.Value = Takvim.SelectionRange.Start YeniGorevEkle.ShowDialog(Me) End Sub Private Sub btnEkle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEkle.Click Dim YeniGorevEkle As New GorevEklefrm YeniGorevEkle.ShowDialog(Me) End Sub Private Sub LWgorevler_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles LWgorevler.ItemCheck If e.NewValue = CheckState.Checked Then Gorevler(CInt(LWgorevler.Items(e.Index).Tag)).Etkin = True LWgorevler.Items(e.Index).ForeColor = Color.Black Else Gorevler(CInt(LWgorevler.Items(e.Index).Tag)).Etkin = False LWgorevler.Items(e.Index).ForeColor = Color.Gray End If GorevGuncelle() End Sub Private Sub KaldirBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KaldirBtn.Click If GorevLW.SelectedItems.Count = 0 Then Exit Sub If MsgBox("Görevi kaldırmak istediğinizden emin misiniz '" & Gorevler(CInt(GorevLW.SelectedItems(0).Tag)).isim & "'?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question, "Görev Zamanla") = MsgBoxResult.Yes Then GorevKaldir(CInt(GorevLW.Items(GorevLW.SelectedItems(0).Index).Tag)) GorevGuncelle() GorevYukle() End If End Sub Private Sub btnKaldir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKaldir.Click If LWgorevler.SelectedItems.Count = 0 Then Exit Sub If MsgBox("Görevi kaldırmak istediğinizden emin misiniz '" & Gorevler(CInt(LWgorevler.SelectedItems(0).Tag)).isim & "'?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question, "Görev Zamanla") = MsgBoxResult.Yes Then GorevKaldir(CInt(LWgorevler.Items(LWgorevler.SelectedItems(0).Index).Tag)) GorevGuncelle() GorevYukle() End If End Sub Private Sub btnDuzenle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDuzenle.Click Dim YeniGorevEkle As GorevEklefrm If LWgorevler.SelectedItems.Count > 0 Then YeniGorevEkle = New GorevEklefrm YeniGorevEkle.Duzenle(CInt(LWgorevler.Items(LWgorevler.SelectedItems(0).Index).Tag)) YeniGorevEkle.ShowDialog(Me) End If End Sub Private Sub DuzenleBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DuzenleBtn.Click Dim YeniGorevEkle As GorevEklefrm If GorevLW.SelectedItems.Count > 0 Then YeniGorevEkle = New GorevEklefrm YeniGorevEkle.Duzenle(CInt(GorevLW.Items(GorevLW.SelectedItems(0).Index).Tag)) YeniGorevEkle.ShowDialog(Me) End If End Sub Private Sub btnAyarlar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAyarlar.Click GrupDegisti(grpAyarlar) End Sub Private Sub btnSifreAyarla_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSifreAyarla.Click SifreHataUyarisiVer.Clear() If TxtSifre.Text = TxtSifreTekrari.Text Then If TxtSifre.Text <> "" Then SifreyiAyarla(TxtSifre.Text) izinVer = True GrupAyariGuncelle() MsgBox("Parola kurulmuştur. Şifrenizi unutmayın!" & vbCrLf & "Şifreniz : " & TxtSifre.Text, MsgBoxStyle.Information, "Görev Zamanla") Else SifreHataUyarisiVer.SetError(TxtSifre, "Lütfen bir şifre girin.") End If Else SifreHataUyarisiVer.SetError(TxtSifreTekrari, "aynı şifreleri yazmanız gerekir.") End If End Sub Private Sub RadioBtnSifresiz_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioBtnSifresiz.CheckedChanged If RadioBtnSifresiz.Checked And Me.Visible = True Then My.Settings.SifreTipi = 0 SifreyiAyarla("") GrupAyariGuncelle() End If End Sub Private Sub RadioBtnSifreli_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioBtnSifreli.CheckedChanged If RadioBtnSifreli.Checked And Me.Visible = True Then My.Settings.SifreTipi = 1 GrupAyariGuncelle() End If End Sub Private Sub RadioBtnSifreDegis_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioBtnSifreDegis.CheckedChanged If RadioBtnSifreDegis.Checked And Me.Visible = True Then My.Settings.SifreTipi = 2 GrupAyariGuncelle() End If End Sub Private Sub btnDogrulama_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSifreDogrula.Click If SifreDogrula(txtYanSifre.Text) Then txtYanSifre.Enabled = False btnSifreDogrula.Enabled = False LblSifreKontrol.Visible = True LblSifreKontrol.ForeColor = Color.DarkGreen LblSifreKontrol.Text = "Görüntüleyebilir ve görevleri düzenleyebilirsiniz." izinVer = True btnEkle.Enabled = True EkleBtn.Enabled = True LWgorevler_SelectedIndexChanged(Nothing, Nothing) GorevLW_SelectedIndexChanged(Nothing, Nothing) GrupDegisti(GrbTakvim) Else LblSifreKontrol.Text = "Yanlış şifre." End If End Sub Private Sub chkBaslarken_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkBaslarken.CheckedChanged Dim StartupKey As Microsoft.Win32.RegistryKey My.Settings.Baslangicta = chkBaslarken.Checked StartupKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True) If chkBaslarken.Checked Then StartupKey.SetValue("GörevZamanla", Application.ExecutablePath & " -startup") Else StartupKey.DeleteValue("GörevZamanla", False) End If End Sub Private Sub btnYardim_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnYardim.Click GrupDegisti(grpYardim) End Sub Private Sub btnYedekOlustur_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnYedekOlustur.Click If YedekAlSaveFileDlg.ShowDialog = Windows.Forms.DialogResult.OK Then My.Computer.FileSystem.CopyFile(System.AppDomain.CurrentDomain.BaseDirectory() & "Görevler.dat", YedekAlSaveFileDlg.FileName, True) MsgBox("Görevler yedeklenmiş.", MsgBoxStyle.Information, "Görev Zamanla") End If End Sub Private Sub btnYedektenYukle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnYedektenYukle.Click If YedektenYukleSaveFileDlg.ShowDialog = Windows.Forms.DialogResult.OK Then If MsgBox("yedeği geri yüklemek istediğinizden emin misiniz?" & vbCrLf & "Bu varolan görevler üzerine yazılır.", MsgBoxStyle.Exclamation Or MsgBoxStyle.YesNo, "Görev Zamanla") = MsgBoxResult.Yes Then My.Computer.FileSystem.CopyFile(YedektenYukleSaveFileDlg.FileName, System.AppDomain.CurrentDomain.BaseDirectory() & "Görevler.dat", True) Gorevler = Nothing GorevleriOku() GorevYukle() MsgBox("Görev yedeklemesi restore edilmiştir.", MsgBoxStyle.Information, "Görev Zamanla") End If End If End Sub Private Sub btnGit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGit.Click If LWgorevler.SelectedItems.Count > 0 Then Takvim.SetDate(Gorevler(CInt(LWgorevler.Items(LWgorevler.SelectedItems(0).Index).Tag)).BitimTarihi) Takvim_DateSelected(Nothing, Nothing) GrupDegisti(GrbTakvim) End If End Sub End Class
Görev Ekleme Formu
Option Explicit On Option Strict On Public Class GorevEklefrm Dim Kapatizini As Boolean = False Dim DuzenleModu As Boolean = False Dim GorevID As Integer Public Sub Duzenle(ByVal GorevIndex As Integer) DuzenleModu = True GorevID = GorevIndex cmbTip.SelectedIndex = 0 cmbGorevTipi.SelectedIndex = 0 cmbEylemTipi.SelectedIndex = 0 cmbSes.SelectedIndex = 0 With Gorevler(GorevIndex) Me.Text = "GörevZamanla - Görev Düzenle" lblBaslik.Text = "Görev Düzenle" cmbTip.SelectedIndex = .Tip Select Case .Tip Case 0 dtpTarih.Value = .BitimTarihi mtbTarih.Text = .BitimTarihi.ToString("HH:mm") Case 1 dtpTarih.Value = .BitimTarihi Case 2 mtbTarih.Text = .BitimTarihi.ToString("HH:mm") End Select cmbGorevTipi.SelectedIndex = .GorevTipi Select Case .GorevTipi Case 0 cmbEylemTipi.SelectedIndex = .EylemTipi Case 1 txtKomutlar.Text = .EylemDizesi Case 2 cmbSurecListesi.Text = .EylemDizesi Case 3 If .EylemTipi = 0 Then rdbBalon.Checked = True Else rdbMsjKutusu.Checked = True End If txtMesaj.Text = .EylemDizesi Case 4 Select Case .EylemTipi Case 0 rdbKopya.Checked = True txtilk.Text = .EylemDizesi.Split("|".ToCharArray)(0) txtikinci.Text = .EylemDizesi.Split("|".ToCharArray)(1) Case 1 rdbAddegis.Checked = True txtilk.Text = .EylemDizesi.Split("|".ToCharArray)(0) txtikinci.Text = .EylemDizesi.Split("|".ToCharArray)(1) Case 2 rdbSil.Checked = True txtilk.Text = .EylemDizesi End Select End Select txtAdi.Text = .isim If .Ses_Etkin = False Then cmbSes.SelectedIndex = 0 Else Select Case .SesDosyasi Case "1" cmbSes.SelectedIndex = 1 Case "2" cmbSes.SelectedIndex = 2 Case "3" cmbSes.SelectedIndex = 3 Case "4" cmbSes.SelectedIndex = 4 Case Else cmbSes.SelectedIndex = 5 End Select End If chkOnay.Checked = .Bilgi_iste If .Bilgi_iste Then txtOnayMsj.Text = .Bilgi_iste_Msj End If chkOtomatikOnayla.Checked = CBool(IIf(.OtomatikOnayla = 0, False, True)) If .OtomatikOnayla <> 0 Then nudOtoOnay.Value = .OtomatikOnayla chkEtkin.Checked = .Etkin chkBirKez.Checked = .bir_kez chkConfirm_CheckedChanged(Nothing, Nothing) End With End Sub Private Sub GorevEklefrm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If Not Kapatizini Then If MsgBox("Sihirbazı kapatmak" & vbCrLf & "istiyormusunuz?", MsgBoxStyle.Question Or MsgBoxStyle.YesNo, "Görev Zamanla") = MsgBoxResult.No Then e.Cancel = True End If End If End Sub Private Sub GorevEklefrm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not DuzenleModu Then chkOnay.Checked = False chkConfirm_CheckedChanged(Nothing, Nothing) cmbTip.SelectedIndex = 0 cmbGorevTipi.SelectedIndex = 0 cmbEylemTipi.SelectedIndex = 0 cmbSes.SelectedIndex = 0 End If btnYenile_Click(Nothing, Nothing) End Sub Private Sub cmbGorevTipi_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbGorevTipi.SelectedIndexChanged pnlEylem0.Visible = False pnlEylem1.Visible = False pnlEylem2.Visible = False pnlEylem3.Visible = False pnlEylem4.Visible = False Select Case cmbGorevTipi.SelectedIndex Case 0 pnlEylem0.Visible = True Case 1 pnlEylem1.Visible = True Case 2 pnlEylem2.Visible = True Case 3 pnlEylem3.Visible = True Case 4 pnlEylem4.Visible = True End Select End Sub Private Sub cmbTip_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbTip.SelectedIndexChanged Select Case cmbTip.SelectedIndex Case 0 dtpTarih.Enabled = True mtbTarih.Enabled = True Case 1 dtpTarih.Enabled = True mtbTarih.Enabled = False Case 2 dtpTarih.Enabled = False mtbTarih.Enabled = True Case 3 dtpTarih.Enabled = False mtbTarih.Enabled = False End Select End Sub Private Sub btnileri_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnileri.Click Dim Ses_Etkin As Boolean Dim SesDosyasi As String = "" Dim EylemTipi As Integer Dim EylemDizesi As String = "" Dim BitimTarihi As Date Dim I As Integer SifreHataUyarisi.Clear() If pnlZaman.Visible = True Then If (cmbTip.SelectedIndex = 0) Or (cmbTip.SelectedIndex = 2) Then If (mtbTarih.Text Like "* *") Or (mtbTarih.Text Like "*:") Or (mtbTarih.Text Like ":*") Then SifreHataUyarisi.SetError(mtbTarih, "Yanlış zaman biçimi.") ElseIf (CInt(mtbTarih.Text.Split(":".ToCharArray)(0)) >= 0) And (CInt(mtbTarih.Text.Split(":".ToCharArray)(0)) <= 23) And (CInt(mtbTarih.Text.Split(":".ToCharArray)(1)) >= 0) And (CInt(mtbTarih.Text.Split(":".ToCharArray)(1)) <= 59) Then pnlEylem.Visible = True pnlZaman.Visible = False btnGeri.Enabled = True lblEylem.ForeColor = Color.Gray Else SifreHataUyarisi.SetError(mtbTarih, "Yanlış zaman biçimi.") End If Else pnlEylem.Visible = True pnlZaman.Visible = False btnGeri.Enabled = True lblEylem.ForeColor = Color.Gray End If ElseIf pnlEylem.Visible = True Then Select Case cmbGorevTipi.SelectedIndex Case 1 If txtKomutlar.Text = "" Then SifreHataUyarisi.SetError(txtKomutlar, "Dosyasının yolunu giriniz.") Exit Sub End If Case 2 If cmbSurecListesi.Text = "" Then SifreHataUyarisi.SetError(cmbSurecListesi, "Bir işlem adını giriniz.") Exit Sub End If Case 3 If txtMesaj.Text = "" Then SifreHataUyarisi.SetError(txtMesaj, "İleti gövdesini giriniz.") Exit Sub End If Case 4 If txtilk.Text = "" Then SifreHataUyarisi.SetError(txtilk, "Bir dosya adı girmelisiniz.") If Not rdbSil.Checked Then If txtikinci.Text = "" Then SifreHataUyarisi.SetError(txtikinci, "Bir dosya adı girmelisiniz.") End If End If Exit Sub End If If Not rdbSil.Checked Then If txtikinci.Text = "" Then SifreHataUyarisi.SetError(txtikinci, "Bir dosya adı girmelisiniz.") Exit Sub End If End If End Select pnlEylem.Visible = False pnlSecenek.Visible = True btnileri.Text = "Son" lblSecenek.ForeColor = Color.Gray Else If (cmbSes.SelectedIndex = 5) And (txtSes.Text = "") Then SifreHataUyarisi.SetError(txtSes, "Bir ses dosyası seçiniz.") Exit Sub End If If chkOnay.Checked And (txtOnayMsj.Text = "") Then SifreHataUyarisi.SetError(txtOnayMsj, "Buraya bir mesaj yazın.") Exit Sub End If If txtAdi.Text = "" Then SifreHataUyarisi.SetError(txtAdi, "Görev adını giriniz.") Exit Sub End If If Gorevler Is Nothing Then GoTo Ok For I = 0 To (Gorevler.Length - 1) If (Gorevler(I).isim = txtAdi.Text) Then If (Not DuzenleModu) Or (DuzenleModu And (I <> GorevID)) Then SifreHataUyarisi.SetError(txtAdi, "Görev adı benzersiz olmalıdır.") Exit Sub End If End If Next Ok: Select Case cmbTip.SelectedIndex Case 0 BitimTarihi = CDate(dtpTarih.Value.ToString("\#%M/dd/yyyy ") & CDate(mtbTarih.Text).ToString("HH:mm:00 tt") & dtpTarih.Value.ToString("\#")) Case 1 BitimTarihi = dtpTarih.Value Case 2 BitimTarihi = CDate(mtbTarih.Text) End Select Ses_Etkin = True Select Case cmbSes.SelectedIndex Case 0 Ses_Etkin = False Case 1 SesDosyasi = "1" Case 2 SesDosyasi = "2" Case 3 SesDosyasi = "3" Case 4 SesDosyasi = "4" Case 5 SesDosyasi = txtSes.Text End Select Select Case cmbGorevTipi.SelectedIndex Case 0 EylemTipi = cmbEylemTipi.SelectedIndex Case 3 If rdbBalon.Checked Then EylemTipi = 0 Else EylemTipi = 1 End If Case 4 If rdbKopya.Checked Then EylemTipi = 0 If rdbAddegis.Checked Then EylemTipi = 1 If rdbSil.Checked Then EylemTipi = 2 End Select Select Case cmbGorevTipi.SelectedIndex Case 1 EylemDizesi = txtKomutlar.Text Case 2 EylemDizesi = cmbSurecListesi.Text Case 3 EylemDizesi = txtMesaj.Text Case 4 Select Case EylemTipi Case 0 EylemDizesi = txtilk.Text & "|" & txtikinci.Text Case 1 EylemDizesi = txtilk.Text & "|" & txtikinci.Text Case 2 EylemDizesi = txtilk.Text End Select End Select If Not DuzenleModu Then YeniGorevEkle(txtAdi.Text, cmbTip.SelectedIndex, BitimTarihi, chkEtkin.Checked, chkBirKez.Checked, Ses_Etkin, SesDosyasi, chkOnay.Checked, txtOnayMsj.Text, CInt(IIf(chkOtomatikOnayla.Checked, nudOtoOnay.Value, 0)), cmbGorevTipi.SelectedIndex, EylemTipi, EylemDizesi) Else GorevDuzenle(GorevID, txtAdi.Text, cmbTip.SelectedIndex, BitimTarihi, chkEtkin.Checked, chkBirKez.Checked, Ses_Etkin, SesDosyasi, chkOnay.Checked, txtOnayMsj.Text, CInt(IIf(chkOtomatikOnayla.Checked, nudOtoOnay.Value, 0)), cmbGorevTipi.SelectedIndex, EylemTipi, EylemDizesi) End If GorevGuncelle() If Anafrm.Visible = True Then Anafrm.GorevYukle() Kapatizini = True Close() End If End Sub Private Sub cmdRunGozat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRunGozat.Click OpenFileDlg.Filter = "Tüm Dosyalar (*.*)|*.*" If OpenFileDlg.ShowDialog = Windows.Forms.DialogResult.OK Then If txtKomutlar.Text = "" Then txtKomutlar.Text = OpenFileDlg.FileName Else txtKomutlar.Text &= vbCrLf & OpenFileDlg.FileName End If End If End Sub Private Sub btnYenile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnYenile.Click Dim Processes() As System.Diagnostics.Process = Diagnostics.Process.GetProcesses Dim Process As System.Diagnostics.Process cmbSurecListesi.Items.Clear() For Each Process In Processes cmbSurecListesi.Items.Add(Process.ProcessName) Next End Sub Private Sub rdbKopya_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbKopya.CheckedChanged, rdbBalon.CheckedChanged lblilk.Text = "Bu dosyayı kopyalayın:" txtilk.Enabled = True btnilkGozat.Enabled = True lblikinci.Text = "Kopyala:" txtikinci.Enabled = True btnilkGozat.Enabled = True End Sub Private Sub rdbAddegis_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbAddegis.CheckedChanged lblilk.Text = "Bu dosyayı yeniden adlandırın:" txtilk.Enabled = True btnilkGozat.Enabled = True lblikinci.Text = "Yeniden adlandırın:" txtikinci.Enabled = True btnilkGozat.Enabled = True End Sub Private Sub rdbSil_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbSil.CheckedChanged lblilk.Text = "Bu dosyayı silin:" txtilk.Enabled = True btnSecondBrowse.Enabled = False lblikinci.Text = "" txtikinci.Enabled = False btnilkGozat.Enabled = True End Sub Private Sub btnFirstBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirstBrowse.Click, btnilkGozat.Click OpenFileDlg.Filter = "Tüm Dosyalar (*.*)|*.*" If OpenFileDlg.ShowDialog = Windows.Forms.DialogResult.OK Then txtilk.Text = OpenFileDlg.FileName SaveFileDlg.FileName = OpenFileDlg.FileName End If End Sub Private Sub btnSecondBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSecondBrowse.Click ', btnilkGozat.Click If SaveFileDlg.ShowDialog = Windows.Forms.DialogResult.OK Then txtikinci.Text = SaveFileDlg.FileName End Sub Private Sub btnSoundBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSesGozat.Click OpenFileDlg.Filter = "Wav Dosyalar (*.wav)|*.wav|Tüm Dosyalar (*.*)|*.*" If OpenFileDlg.ShowDialog = Windows.Forms.DialogResult.OK Then txtSes.Text = OpenFileDlg.FileName End Sub Private Sub cmbSound_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbSes.SelectedIndexChanged If cmbSes.SelectedIndex = 5 Then txtSes.Enabled = True btnSesGozat.Enabled = True Else txtSes.Enabled = False btnSesGozat.Enabled = False End If End Sub Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGeri.Click If pnlEylem.Visible = True Then pnlEylem.Visible = False pnlZaman.Visible = True btnGeri.Enabled = False lblEylem.ForeColor = Color.Black Else pnlSecenek.Visible = False pnlEylem.Visible = True btnileri.Text = "İleri >" lblSecenek.ForeColor = Color.Black End If End Sub Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKapat.Click Me.Close() End Sub Private Sub btnPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOnizleme.Click Try Select Case cmbSes.SelectedIndex Case 0 My.Computer.Audio.Stop() Case 1 My.Computer.Audio.Play(System.AppDomain.CurrentDomain.BaseDirectory() & "sound\1.wav") Case 2 My.Computer.Audio.Play(System.AppDomain.CurrentDomain.BaseDirectory() & "sound\2.wav") Case 3 My.Computer.Audio.Play(System.AppDomain.CurrentDomain.BaseDirectory() & "sound\3.wav") Case 4 My.Computer.Audio.Play(System.AppDomain.CurrentDomain.BaseDirectory() & "sound\4.wav") Case 5 My.Computer.Audio.Play(txtSes.Text) End Select Catch End Try End Sub Private Sub chkConfirm_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkOnay.CheckedChanged chkOtomatikOnayla.Enabled = chkOnay.Checked nudOtoOnay.Enabled = chkOnay.Checked End Sub End Class
Onaylama Formu
Option Explicit On Option Strict On Public Class Onaylafrm Dim GorevID As Integer Dim GeriSay As Integer Public Sub Init(ByVal ilkGörevID As Integer) GorevID = ilkGörevID lblOnayBaslik.Text = "Çalıştırmak istediğinizden emin misiniz '" & Gorevler(GorevID).isim & _ "' (" & EylemicinDize(Gorevler(GorevID).GorevTipi, Gorevler(GorevID).EylemTipi) & ")?" lblMesajOnay.Text = Gorevler(GorevID).Bilgi_iste_Msj If Gorevler(GorevID).OtomatikOnayla = 0 Then lblOtokapa.Visible = False Else GeriSay = Gorevler(GorevID).OtomatikOnayla lblOtokapa.Text = GeriSay & " Saniye içinde otomatik onaylanacak..." TimerOtoOnayla.Enabled = True End If End Sub Private Sub TimerOtoOnayla_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerOtoOnayla.Tick GeriSay -= 1 lblOtokapa.Text = GeriSay & "Saniye içinde onayla..." If GeriSay = 0 Then GorevBaslat(GorevID, False) Me.Close() End If End Sub Private Sub btnHayir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHayir.Click Me.Close() End Sub Private Sub btnEvet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEvet.Click GorevBaslat(GorevID, False) Me.Close() End Sub End Class
Parola Formu
Option Explicit On Option Strict On Public Class Parolafrm Dim GorevModuEkle As Boolean Public Sub Init(ByVal GorevEkle As Boolean) GorevModuEkle = GorevEkle If GorevEkle Then lblSifre.Text = "Görev eklemek için şifre girmeniz gerekir:" Else lblSifre.Text = "Çıkmak için doğru parolayı girin:" End If End Sub Private Sub btnTamam_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTamam.Click Dim YeniGorevEkle As GorevEklefrm If SifreDogrula(txtSifre.Text) Then If GorevModuEkle Then YeniGorevEkle = New GorevEklefrm YeniGorevEkle.Show() Me.Close() Else Application.Exit() End If Else MsgBox("Yanlış şifre.", MsgBoxStyle.Critical, "Görev zamanlayıcı") End If End Sub Private Sub btniptal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btniptal.Click Me.Close() End Sub End Class
Tray Formu
Option Explicit On Option Strict On Public Class Trayfrm Private Sub AnaFormuGoster() Dim SifreTipi As Integer = My.Settings.SifreTipi If Anafrm.Visible = False Then Anafrm.chkBaslarken.Checked = My.Settings.Baslangicta Select Case SifreTipi Case 0 Anafrm.RadioBtnSifresiz.Checked = True Case 1 Anafrm.RadioBtnSifreli.Checked = True Case 2 Anafrm.RadioBtnSifreDegis.Checked = True End Select Anafrm.Show() Anafrm.GorevYukle() Else Anafrm.Activate() End If End Sub Private Sub frmTray_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown Dim I As Integer Dim StartupKey As Microsoft.Win32.RegistryKey Me.Visible = False StartupKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True) If My.Settings.Baslangicta = True Then StartupKey.SetValue("GörevZamanla", Application.ExecutablePath & " -startup") Else StartupKey.DeleteValue("GörevZamanla", False) End If Tray_NotifyIcon.BalloonTipIcon = ToolTipIcon.Info Tray_NotifyIcon.Icon = Me.Icon My.Application.ChangeCulture("en-US") GorevleriOku() If Command() = "-startup" Then For I = 0 To (Gorevler.Length - 1) If Gorevler(I).Tip = 3 Then If Gorevler(I).Etkin Then GorevBaslat(I) ElseIf Gorevler(I).Tip = 1 Then If (Gorevler(I).BitimTarihi.Year = Date.Now.Year) And (Gorevler(I).BitimTarihi.Month = Date.Now.Month) And (Gorevler(I).BitimTarihi.Day = Date.Now.Day) Then If Gorevler(I).Etkin Then GorevBaslat(I) End If End If Next Else AnaFormuGoster() End If GorevTimer.Enabled = True End Sub Private Sub Tray_NotifyIcon_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Tray_NotifyIcon.DoubleClick AnaFormuGoster() End Sub Private Sub GorevTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GorevTimer.Tick Dim I As Integer Dim Now As Date = Date.Now Tray_NotifyIcon.Visible = True If Gorevler Is Nothing Then Exit Sub For I = 0 To (Gorevler.Length - 1) If Gorevler(I).Tip = 0 Then If (Gorevler(I).BitimTarihi.Year = Date.Now.Year) And _ (Gorevler(I).BitimTarihi.Month = Date.Now.Month) And _ (Gorevler(I).BitimTarihi.Day = Date.Now.Day) And _ (Gorevler(I).BitimTarihi.Hour = Date.Now.Hour) And _ (Gorevler(I).BitimTarihi.Minute = Date.Now.Minute) Then If Gorevler(I).Etkin Then GorevBaslat(I) End If ElseIf Gorevler(I).Tip = 2 Then If (Gorevler(I).BitimTarihi.Hour = Date.Now.Hour) And (Gorevler(I).BitimTarihi.Minute = Date.Now.Minute) Then If Gorevler(I).Etkin Then GorevBaslat(I) End If End If Next End Sub Private Sub mnuGoster_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuGoster.Click AnaFormuGoster() End Sub Private Sub mnuGorevEkle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuGorevEkle.Click Dim YeniGorevEkle As GorevEklefrm If (My.Settings.SifreTipi = 0) Or (Not SifreAyarla()) Then YeniGorevEkle = New GorevEklefrm YeniGorevEkle.ShowDialog(Me) Else Parolafrm.Show() Parolafrm.Init(True) End If End Sub Private Sub mnuAyarlar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAyarlar.Click AnaFormuGoster() Anafrm.GrupDegisti(Anafrm.grpAyarlar) End Sub Private Sub mnuCik_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuCik.Click If (My.Settings.SifreTipi = 0) Or (Not SifreAyarla()) Then Application.Exit() Else Parolafrm.Show() Parolafrm.Init(False) End If End Sub End Class
Moduller
Imports System Imports System.Runtime.InteropServices Module ModulAPI ' Sabitler Const SE_PRIVILEGE_ENABLED As Integer = &H2 Const TOKEN_QUERY As Integer = &H8 Const TOKEN_ADJUST_PRIVILEGES As Integer = &H20 Const SE_SHUTDOWN_NAME As String = "SeShutdownPrivilege" ' Windows sabitleri Const EWX_LOGOFF As Integer = &H0 Const EWX_SHUTDOWN As Integer = &H1 Const EWX_REBOOT As Integer = &H2 Const EWX_FORCE As Integer = &H4 Const EWX_POWEROFF As Integer = &H8 Const EWX_FORCEIFHUNG As Integer = &H10 'Yapı
_ Friend Structure Luid Public Count As Integer Public Luid As Long Public Attr As Integer End Structure ' Kilit Çalışma istasyonu
_ Function LockWorkStation() As Boolean End Function ' Süreçleri Aç
_ Function GetCurrentProcess() As IntPtr End Function ' Jeton Sürecini aç
_ Function OpenProcessToken(ByVal h As IntPtr, ByVal acc As Integer, ByRef phtok As IntPtr) As Boolean End Function
_ Friend Function LookupPrivilegeValue(ByVal host As String, ByVal name As String, ByRef pluid As Long) As Boolean End Function 'Jeton yetkilerin ayarlayın
_ Friend Function AdjustTokenPrivileges(ByVal htok As IntPtr, ByVal disall As Boolean, ByRef newst As Luid, ByVal len As Integer, ByVal prev As IntPtr, ByVal relen As IntPtr) As Boolean End Function ' Windowstan çık
_ Friend Function ExitWindowsEx(ByVal flg As Integer, ByVal rea As Integer) As Boolean End Function ' Windows alt yordamlarından çık Private Sub WindowstanCik(ByVal flg As Integer) Dim tp As Luid Dim hproc As IntPtr = GetCurrentProcess() Dim htok As IntPtr = IntPtr.Zero OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, htok) tp.Count = 1 tp.Luid = 0 tp.Attr = SE_PRIVILEGE_ENABLED LookupPrivilegeValue(Nothing, SE_SHUTDOWN_NAME, tp.Luid) AdjustTokenPrivileges(htok, False, tp, 0, IntPtr.Zero, IntPtr.Zero) ExitWindowsEx(flg, 0) End Sub ' Kapat Public Sub WinKapat() WindowstanCik(EWX_SHUTDOWN) End Sub ' Yeniden Başlat Public Sub WinYenidenBaslat() WindowstanCik(EWX_REBOOT Or EWX_FORCE) End Sub ' oturumu Kapat Public Sub WinOturumKapat() WindowstanCik(EWX_LOGOFF) End Sub '^Kilitle Public Sub WinKilitle() LockWorkStation() End Sub End Module
Option Explicit On Option Strict On Module mdlTasks Public Structure Task Dim isim As String Dim Tip As Integer '0 - Belirli tarih. '1 - açtıktan sonra Belirli tarih. '2 - Her gün, bu sefer. '3 - Her gün, açıldığında. Dim BitimTarihi As Date Dim Etkin As Boolean Dim bir_kez As Boolean Dim Ses_Etkin As Boolean Dim SesDosyasi As String Dim Bilgi_iste As Boolean Dim Bilgi_iste_Msj As String Dim OtomatikOnayla As Integer Dim GorevTipi As Integer '0 - Aksiyon '1 - DOS Komutları '2 - Close işlemi. '3 - Mesaj '4 - Dosyalar: Kopyala, Reisim, silin. Dim EylemTipi As Integer '0 '0 - Kapatma. '1 - Yeniden. '2 - Oturumu Kapat. ' 3 ' 0 - Balon. '1 - MessageBox. ' 4 : Dim EylemDizesi As String '1: DOS komut / s. '2 : Süreç Adı. '3 : Mesaj Metni. '4: Dosya Adı '1 - Yeniden adlandır. '2 - Sil. End Structure Public Gorevler() As Task Public Function YeniGorevEkle(ByVal isim As String, ByVal Tip As Integer, ByVal BitimTarihi As Date, ByVal Etkin As Boolean, ByVal bir_kez As Boolean, ByVal Ses_Etkin As Boolean, ByVal SesDosyasi As String, ByVal Bilgi_iste As Boolean, ByVal Bilgi_iste_Msj As String, ByVal OtomatikOnayla As Integer, ByVal GorevTipi As Integer, ByVal EylemTipi As Integer, ByVal EylemDizesi As String) As Task Dim Position As Integer If Gorevler Is Nothing Then Position = 0 ReDim Gorevler(Position) Else Position = Gorevler.Length ReDim Preserve Gorevler(Position) End If Gorevler(Position).isim = isim Gorevler(Position).Tip = Tip Gorevler(Position).BitimTarihi = BitimTarihi Gorevler(Position).Etkin = Etkin Gorevler(Position).bir_kez = bir_kez Gorevler(Position).Ses_Etkin = Ses_Etkin Gorevler(Position).SesDosyasi = SesDosyasi Gorevler(Position).Bilgi_iste = Bilgi_iste Gorevler(Position).Bilgi_iste_Msj = Bilgi_iste_Msj Gorevler(Position).OtomatikOnayla = OtomatikOnayla Gorevler(Position).GorevTipi = GorevTipi Gorevler(Position).EylemTipi = EylemTipi Gorevler(Position).EylemDizesi = EylemDizesi Return Gorevler(Position) End Function Public Function GorevDuzenle(ByVal GorevIndex As Integer, ByVal isim As String, ByVal Tip As Integer, ByVal BitimTarihi As Date, ByVal Etkin As Boolean, ByVal bir_kez As Boolean, ByVal Ses_Etkin As Boolean, ByVal SesDosyasi As String, ByVal Bilgi_iste As Boolean, ByVal Bilgi_iste_Msj As String, ByVal OtomatikOnayla As Integer, ByVal GorevTipi As Integer, ByVal EylemTipi As Integer, ByVal EylemDizesi As String) As Task Gorevler(GorevIndex).isim = isim Gorevler(GorevIndex).Tip = Tip Gorevler(GorevIndex).BitimTarihi = BitimTarihi Gorevler(GorevIndex).Etkin = Etkin Gorevler(GorevIndex).bir_kez = bir_kez Gorevler(GorevIndex).Ses_Etkin = Ses_Etkin Gorevler(GorevIndex).SesDosyasi = SesDosyasi Gorevler(GorevIndex).Bilgi_iste = Bilgi_iste Gorevler(GorevIndex).Bilgi_iste_Msj = Bilgi_iste_Msj Gorevler(GorevIndex).OtomatikOnayla = OtomatikOnayla Gorevler(GorevIndex).GorevTipi = GorevTipi Gorevler(GorevIndex).EylemTipi = EylemTipi Gorevler(GorevIndex).EylemDizesi = EylemDizesi Return Gorevler(GorevIndex) End Function Public Sub GorevKaldir(ByVal GorevIndex As Integer) Dim I As Integer For I = GorevIndex To (Gorevler.Length - 2) Gorevler(I) = Gorevler(I + 1) Next ReDim Preserve Gorevler(Gorevler.Length - 2) End Sub Public Sub GorevleriOku() Dim I As Integer Dim Delimiter(2) As String Dim Splitted() As String Delimiter = New String() {Chr(1), Chr(2), Chr(1)} If My.Computer.FileSystem.FileExists(System.AppDomain.CurrentDomain.BaseDirectory() & "tasks.dat") Then Splitted = My.Computer.FileSystem.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory() & "tasks.dat").Split(Delimiter, StringSplitOptions.RemoveEmptyEntries) For I = 0 To (Splitted.Length - 1) YeniGorevEkle(Mid(Splitted(I), 2), CInt(Mid(Splitted(I + 1), 2)), CDate(Mid(Splitted(I + 2), 2)), CBool(Mid(Splitted(I + 3), 2)), CBool(Mid(Splitted(I + 4), 2)), CBool(Mid(Splitted(I + 5), 2)), Mid(Splitted(I + 6), 2), CBool(Mid(Splitted(I + 7), 2)), Mid(Splitted(I + 8), 2), CInt(Mid(Splitted(I + 9), 2)), CInt(Mid(Splitted(I + 10), 2)), CInt(Mid(Splitted(I + 11), 2)), Mid(Splitted(I + 12), 2)) I += 12 Next End If End Sub Public Sub GorevGuncelle() Dim EachTask As Task Dim FileContent As String = "" Dim First As Boolean = True Dim Delimiter As String = Chr(1) & Chr(2) & Chr(1) & "|" For Each EachTask In Gorevler If Not First Then FileContent &= Delimiter If First Then FileContent &= "|" FileContent &= EachTask.isim & Delimiter FileContent &= EachTask.Tip & Delimiter FileContent &= EachTask.BitimTarihi.ToString("\#%M/dd/yyyy hh:mm:00 tt\#") & Delimiter FileContent &= EachTask.Etkin & Delimiter FileContent &= EachTask.bir_kez & Delimiter FileContent &= EachTask.Ses_Etkin & Delimiter FileContent &= EachTask.SesDosyasi & Delimiter FileContent &= EachTask.Bilgi_iste & Delimiter FileContent &= EachTask.Bilgi_iste_Msj & Delimiter FileContent &= EachTask.OtomatikOnayla & Delimiter FileContent &= EachTask.GorevTipi & Delimiter FileContent &= EachTask.EylemTipi & Delimiter FileContent &= EachTask.EylemDizesi First = False Next My.Computer.FileSystem.WriteAllText(System.AppDomain.CurrentDomain.BaseDirectory() & "tasks.dat", FileContent, False) End Sub Public Function ZamanDizesi(ByVal Tip As Integer, ByVal BitimTarihi As Date) As String Select Case Tip Case 0 Return BitimTarihi.ToString("\B\u\ \g\u\n \>\ MM/dd/yyyy\, \v\e \bu\ >\ HH:mm \s\a\a\t\t\e") Case 1 Return BitimTarihi.ToString("\Bu\ \T\a\r\i\h\t\e\ >\ MM/dd/yyyy\, \b\a\ş\l\a\t") Case 2 Return BitimTarihi.ToString("\H\e\r \g\ü\n\ \bu\ >\ HH:mm \s\a\a\t\t\e") Case 3 Return "Bilgisayar açıldığında" End Select Return "Hata" End Function Public Function EylemicinDize(ByVal GorevTipi As Integer, ByVal EylemTipi As Integer) As String Select Case GorevTipi Case 0 Select Case EylemTipi Case 0 Return "Kapat" Case 1 Return "Tekrar Başlat" Case 2 Return "Oturumu Kapat" End Select Case 1 Return "Başlat" Case 2 Return "Süreci Kapat" Case 3 Select Case EylemTipi Case 0 Return "Balon Mesajı" Case 1 Return "Mesaj Kutusu" End Select Case 4 Select Case EylemTipi Case 0 Return "Dosya Kopyala" Case 1 Return "Dosya Adı Değiştir" Case 2 Return "Dosya Sil" End Select End Select Return "Hata" End Function Public Sub GorevBaslat(ByVal GorevIndex As Integer, Optional ByVal Onay_Gerekli As Boolean = True) Dim Onayla As Onaylafrm Try With Gorevler(GorevIndex) If .bir_kez Then .Etkin = False If Onay_Gerekli Then Try If .Ses_Etkin Then Select Case .SesDosyasi Case "1" My.Computer.Audio.Play(System.AppDomain.CurrentDomain.BaseDirectory() & "sound\1.wav") Case "2" My.Computer.Audio.Play(System.AppDomain.CurrentDomain.BaseDirectory() & "sound\2.wav") Case "3" My.Computer.Audio.Play(System.AppDomain.CurrentDomain.BaseDirectory() & "sound\3.wav") Case "4" My.Computer.Audio.Play(System.AppDomain.CurrentDomain.BaseDirectory() & "sound\4.wav") Case Else My.Computer.Audio.Play(.SesDosyasi) End Select End If Catch End Try End If If Onay_Gerekli And .Bilgi_iste And (Gorevler(GorevIndex).GorevTipi <> 3) Then Onayla = New Onaylafrm Onayla.Init(GorevIndex) Onayla.Show() Exit Sub End If Select Case .GorevTipi Case 0 Select Case .EylemTipi Case 0 WinKapat() 'ÇALIŞIYOR Case 1 WinYenidenBaslat() 'ÇALIŞIYOR Case 2 WinOturumKapat() 'ÇALIŞIYOR End Select Case 1 'My.Computer.FileSystem.WriteAllText(System.AppDomain.CurrentDomain.BaseDirectory() & "run.bat", .EylemDizesi, False) 'System.Diagnostics.Process.Start(System.AppDomain.CurrentDomain.BaseDirectory() & "run.bat") 'My.Computer.FileSystem.DeleteFile(System.AppDomain.CurrentDomain.BaseDirectory() & "run.bat") System.Diagnostics.Process.Start(.EylemDizesi) 'çözüm şekli 'her dsy siliyor,çalıştırıyor Case 2 System.Diagnostics.Process.GetProcessesByName(.EylemDizesi)(0).Kill() Case 3 If .EylemTipi = 0 Then Trayfrm.Tray_NotifyIcon.ShowBalloonTip(0, "GörevZamanla", .EylemDizesi, ToolTipIcon.Info) Else MsgBox(.EylemDizesi, MsgBoxStyle.Information, "GörevZamanla") End If Case 4 Select Case .EylemTipi Case 0 My.Computer.FileSystem.CopyFile(.EylemDizesi.Split("|".ToCharArray)(0), .EylemDizesi.Split("|".ToCharArray)(1)) 'ÇALIŞIYOR Case 1 'MsgBox(.EylemDizesi) My.Computer.FileSystem.RenameFile(.EylemDizesi.Split("|".ToCharArray)(0), .EylemDizesi.Split("|".ToCharArray)(1)) 'My.Computer.FileSystem.RenameFile(.EylemDizesi.Split("|".ToCharArray)(0), "NOTEPAD.EXE") 'hata veriyor Case 2 My.Computer.FileSystem.DeleteFile(.EylemDizesi) 'ÇALIŞIYOR End Select End Select End With Catch Trayfrm.Tray_NotifyIcon.ShowBalloonTip(0, "Görev Zamanla - Hata", "Çalıştırırken hata oluştu'" & Gorevler(GorevIndex).isim & "'Görev.", ToolTipIcon.Error) End Try End Sub End Module
Option Explicit On Option Strict On Imports Microsoft.Win32 Module ModulSifre Public Sifre As String Public Function SifreAyarla() As Boolean Dim RegistryKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\GörevZamanla", True) If RegistryKey IsNot Nothing Then If RegistryKey.GetValue("BaşlangıçObjesi", "").ToString = "" Then Return False Else Return True End If Else Return False End If End Function Public Function SifreDogrula(ByVal Sifre As String) As Boolean If Registry.CurrentUser.OpenSubKey("Software\GörevZamanla", True).GetValue("BaşlangıçObjesi").ToString = SifreyiSifrele(Sifre) Then Return True Else Return False End If End Function Public Sub SifreyiAyarla(ByVal Sifre As String) Dim RegistryKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\GörevZamanla", True) If RegistryKey IsNot Nothing Then RegistryKey.SetValue("BaşlangıçObjesi", SifreyiSifrele(Sifre)) Else Registry.CurrentUser.CreateSubKey("Software\GörevZamanla") RegistryKey = Registry.CurrentUser.OpenSubKey("Software\GörevZamanla", True) RegistryKey.SetValue("BaşlangıçObjesi", SifreyiSifrele(Sifre)) End If End Sub Private Function SifreyiSifrele(ByVal Sifre As String) As String Dim I As Integer Dim Position As Integer = 1 Dim Key As String = "-GörevZamanla-" Dim Encrypted As String = "" For I = 1 To Sifre.Length If (Asc(Mid(Key, Position, 1)) + Asc(Mid(Sifre, I, 1))) > 255 Then Encrypted &= Chr(Asc(Mid(Key, Position, 1)) + Asc(Mid(Sifre, I, 1)) - 255) Else Encrypted &= Chr(Asc(Mid(Key, Position, 1)) + Asc(Mid(Sifre, I, 1))) End If Position += 1 If Position > Key.Length Then Position = 1 Next Return Encrypted End Function End Module
Program Kodlarını.
................................................................
İNDİR
Daha Yeni Kayıtlar
Önceki Kayıtlar
Ana Sayfa
Kaydol:
Kayıtlar (Atom)