Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Virtual Helper - frmOption.vb

frmOption.vb

Caricato da: Totem
Scarica il programma completo

  1. Imports RegManager.frmHelper
  2. Public Class frmOption
  3.     Public Function GetInfo(ByVal Mode As Boolean) As String()
  4.         Dim S(1) As String
  5.         Dim PrevFilter As String = FOpen.Filter
  6.  
  7.         'Link
  8.         If Mode = True Then
  9.             FOpen.Filter = "Tutti i file|*.*"
  10.             S(0) = InputBox("Inserire il nome del nuovo collegamento:")
  11.             If FOpen.ShowDialog = Windows.Forms.DialogResult.OK Then
  12.                 S(1) = FOpen.FileName
  13.             End If
  14.         Else
  15.             FOpen.Filter = "File musicali|*.wmv;*.wma;*.mp3;*.mid"
  16.             S(0) = InputBox("Inserire il nome del nuovo brano:")
  17.             If FOpen.ShowDialog = Windows.Forms.DialogResult.OK Then
  18.                 S(1) = FOpen.FileName
  19.             End If
  20.         End If
  21.  
  22.         FOpen.Filter = PrevFilter
  23.         Return S
  24.     End Function
  25.     Private Sub cmdTextRef_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdTextRef.Click
  26.         Dim W As New IO.StreamWriter(Application.StartupPath + "\Settings\Texts.dat")
  27.         W.WriteLine(txtOpen.Text)
  28.         W.WriteLine(txtMusic.Text)
  29.         W.WriteLine(txtPass.Text)
  30.         W.Close()
  31.     End Sub
  32.     Private Sub cmdTextsRip_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdTextsRip.Click
  33.         txtOpen.Text = "E' attvio l'aiutante virtuale. Cliccaci sopra per accedere alle varie funzioni."
  34.         txtMusic.Text = "In ascolto..."
  35.         txtPass.Text = "Password errata!"
  36.  
  37.         Dim W As New IO.StreamWriter(Application.StartupPath + "\Settings\Texts.dat")
  38.         W.WriteLine(txtOpen.Text)
  39.         W.WriteLine(txtMusic.Text)
  40.         W.WriteLine(txtPass.Text)
  41.         W.Close()
  42.     End Sub
  43.     Private Sub cmdInitbrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdInitbrowse.Click
  44.         If FOpen.ShowDialog = Windows.Forms.DialogResult.OK Then
  45.             txtInitImm.Text = FOpen.FileName
  46.         End If
  47.     End Sub
  48.     Private Sub cmdMusicBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdMusicBrowse.Click
  49.         If FOpen.ShowDialog = Windows.Forms.DialogResult.OK Then
  50.             txtMusicImm.Text = FOpen.FileName
  51.         End If
  52.     End Sub
  53.     Private Sub cmdImmRef_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdImmRef.Click
  54.         If txtInitImm.Text = Nothing Or txtMusicImm.Text = Nothing Then
  55.             MsgBox("E' necessario riempire tutti i campi. Scegliere delle immagini adatte!", MsgBoxStyle.Exclamation)
  56.             Exit Sub
  57.         End If
  58.  
  59.         Dim W As New IO.StreamWriter(Application.StartupPath + "\Settings\Images.dat")
  60.         W.WriteLine(nudW.Value)
  61.         W.WriteLine(nudH.Value)
  62.         W.WriteLine(IO.Path.GetFileName(txtInitImm.Text))
  63.         W.WriteLine(IO.Path.GetFileName(txtMusicImm.Text))
  64.         W.Close()
  65.  
  66.         Try
  67.             FileCopy(txtInitImm.Text, Application.StartupPath + "\Imms\" + IO.Path.GetFileName(txtInitImm.Text))
  68.         Catch IOE As IO.IOException
  69.  
  70.         End Try
  71.         Try
  72.             FileCopy(txtMusicImm.Text, Application.StartupPath + "\Imms\" + IO.Path.GetFileName(txtMusicImm.Text))
  73.         Catch IOE As IO.IOException
  74.  
  75.         End Try
  76.     End Sub
  77.     Private Sub cmdImmRip_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdImmRip.Click
  78.         nudW.Value = 71
  79.         nudH.Value = 91
  80.         txtInitImm.Text = Application.StartupPath + "\Imms\002.gif"
  81.         txtMusicImm.Text = Application.StartupPath + "\Imms\003.jpg"
  82.  
  83.         Dim W As New IO.StreamWriter(Application.StartupPath + "\Settings\Images.dat")
  84.         W.WriteLine(71)
  85.         W.WriteLine(91)
  86.         W.WriteLine("002.gif")
  87.         W.WriteLine("003.jpg")
  88.         W.Close()
  89.     End Sub
  90.     Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
  91.         Dim S(1) As String
  92.         Dim L As ListViewItem
  93.  
  94.         S = GetInfo(True)
  95.         L = New ListViewItem(S)
  96.         lstLinks.Items.Add(L)
  97.     End Sub
  98.     Private Sub cmdRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRemove.Click
  99.         Try
  100.             If lstLinks.SelectedIndices(0) >= 0 Then
  101.                 lstLinks.Items.RemoveAt(lstLinks.SelectedIndices(0))
  102.             End If
  103.         Catch NRE As NullReferenceException
  104.  
  105.         End Try
  106.     End Sub
  107.     Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
  108.         Dim W As New IO.StreamWriter(Application.StartupPath + "\Settings\Links.dat")
  109.         Dim L As ListViewItem
  110.  
  111.         For Each L In lstLinks.Items
  112.             W.WriteLine(L.SubItems(0).Text)
  113.             W.WriteLine(L.SubItems(1).Text)
  114.         Next
  115.  
  116.         W.Close()
  117.     End Sub
  118.     Private Sub frmOption_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  119.         Dim L As Link
  120.         Dim S(1) As String
  121.         Dim LI As ListViewItem
  122.  
  123.         txtOpen.Text = Settings.Texts.Open
  124.         txtMusic.Text = Settings.Texts.Music
  125.         txtPass.Text = Settings.Texts.Out
  126.         nudW.Value = Settings.Images.W
  127.         nudH.Value = Settings.Images.H
  128.         txtInitImm.Text = Application.StartupPath + "\Imms\" + Settings.Images.Init
  129.         txtMusicImm.Text = Application.StartupPath + "\Imms" + Settings.Images.Music
  130.         txtExeMusic.Text = Settings.MusicExe
  131.  
  132.         Try
  133.             For Each L In Settings.Links
  134.                 S(0) = L.Name
  135.                 S(1) = L.Path
  136.                 LI = New ListViewItem(S)
  137.                 lstLinks.Items.Add(LI)
  138.             Next
  139.         Catch NRE As NullReferenceException
  140.  
  141.         End Try
  142.  
  143.         Try
  144.             For Each L In Settings.Musics
  145.                 S(0) = L.Name
  146.                 S(1) = L.Path
  147.                 LI = New ListViewItem(S)
  148.                 lstMusics.Items.Add(LI)
  149.             Next
  150.         Catch NRE As NullReferenceException
  151.  
  152.         End Try
  153.     End Sub
  154.     Private Sub frmOption_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
  155.         MsgBox("Tutte le modifiche apportate saranno visibili al riavvio del programma!", MsgBoxStyle.Information)
  156.     End Sub
  157.     Private Sub cmdExeBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExeBrowse.Click
  158.         FOpen.Filter = "Applicazioni|*.exe;*.com"
  159.         If FOpen.ShowDialog = Windows.Forms.DialogResult.OK Then
  160.             txtExeMusic.Text = FOpen.ShowDialog
  161.         End If
  162.         FOpen.Filter = "File immagine|*.jpg;*.jpeg;*.gif;*.bmp;*.png"
  163.     End Sub
  164.     Private Sub cmdExeRef_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExeRef.Click
  165.         Dim W As New IO.StreamWriter(Application.StartupPath + "\Settings\ExeMus.dat")
  166.         W.WriteLine(txtExeMusic.Text)
  167.         W.Close()
  168.     End Sub
  169.     Private Sub cmdExeRip_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExeRip.Click
  170.         txtExeMusic.Text = "C:\Programmi\Windows Media Player\wmplayer.exe"
  171.         Dim W As New IO.StreamWriter(Application.StartupPath + "\Settings\ExeMus.dat")
  172.         W.WriteLine(txtExeMusic.Text)
  173.         W.Close()
  174.     End Sub
  175.     Private Sub cmdMAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdMAdd.Click
  176.         Dim S(1) As String
  177.         Dim L As ListViewItem
  178.  
  179.         S = GetInfo(False)
  180.         L = New ListViewItem(S)
  181.         lstMusics.Items.Add(L)
  182.     End Sub
  183.     Private Sub cmdMRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdMRemove.Click
  184.         Try
  185.             If lstMusics.SelectedIndices(0) >= 0 Then
  186.                 lstMusics.Items.RemoveAt(lstMusics.SelectedIndices(0))
  187.             End If
  188.         Catch NRE As NullReferenceException
  189.  
  190.         End Try
  191.     End Sub
  192.     Private Sub cmdMRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdMRefresh.Click
  193.         Dim W As New IO.StreamWriter(Application.StartupPath + "\Settings\Musics.dat")
  194.         Dim L As ListViewItem
  195.  
  196.         For Each L In lstMusics.Items
  197.             W.WriteLine(L.SubItems(0).Text)
  198.             W.WriteLine(L.SubItems(1).Text)
  199.         Next
  200.  
  201.         W.Close()
  202.     End Sub
  203. End Class