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 - Form1.vb

Form1.vb

Caricato da: Totem
Scarica il programma completo

  1. Imports Microsoft.Win32
  2. Public Class frmHelper
  3.     Public Structure Text_
  4.         Dim Open, Music, Out As String
  5.     End Structure
  6.     Public Structure Image
  7.         Dim W, H As Int16
  8.         Dim Init, Music As String
  9.     End Structure
  10.     Public Structure Link
  11.         Dim Name, Path As String
  12.     End Structure
  13.     Public Structure Setting
  14.         Dim Texts As Text_
  15.         Dim Images As Image
  16.         Dim Links, Musics As ArrayList
  17.         Dim MusicExe As String
  18.     End Structure
  19.     Public Shared Settings As Setting
  20.     'Public MON As Boolean = False
  21.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  22.         'Carica le impostazioni
  23.         strLinks.DropDownItems.Clear()
  24.         strMusics.DropDownItems.Clear()
  25.         Dim RT As New IO.StreamReader(Application.StartupPath + "\Settings\Texts.dat")
  26.         Dim RI As New IO.StreamReader(Application.StartupPath + "\Settings\Images.dat")
  27.         Dim RM As New IO.StreamReader(Application.StartupPath + "\Settings\ExeMus.dat")
  28.         Dim L As Link
  29.         Dim T As ToolStripMenuItem
  30.  
  31.         Settings.Texts.Open = RT.ReadLine
  32.         Settings.Texts.Music = RT.ReadLine
  33.         Settings.Texts.Out = RT.ReadLine
  34.         Settings.Images.W = RI.ReadLine
  35.         Settings.Images.H = RI.ReadLine
  36.         Settings.Images.Init = RI.ReadLine
  37.         Settings.Images.Music = RI.ReadLine
  38.         Settings.MusicExe = RM.ReadLine
  39.         Settings.Links = New ArrayList
  40.         Settings.Musics = New ArrayList
  41.  
  42.         RT.Close()
  43.         RI.Close()
  44.         RM.Close()
  45.  
  46.         'Carica i collegamtni
  47.         Try
  48.             Dim RL As New IO.StreamReader(Application.StartupPath + "\Settings\Links.dat")
  49.            
  50.             While Not RL.EndOfStream
  51.                 L.Name = RL.ReadLine
  52.                 L.Path = RL.ReadLine
  53.                 T = New ToolStripMenuItem()
  54.                 T.Text = L.Name
  55.                 T.Tag = L.Path
  56.                 strLinks.DropDownItems.Add(T)
  57.                 Settings.Links.Add(L)
  58.             End While
  59.             RL.Close()
  60.         Catch FNFE As IO.FileNotFoundException
  61.             T.Text = "Nessun collegamento"
  62.             T.Tag = "exit"
  63.             strLinks.DropDownItems.Add(T)
  64.         End Try
  65.  
  66.         'Carica le musiche
  67.         Try
  68.             Dim RL As New IO.StreamReader(Application.StartupPath + "\Settings\Musics.dat")
  69.            
  70.             While Not RL.EndOfStream
  71.                 L.Name = RL.ReadLine
  72.                 L.Path = RL.ReadLine
  73.                 T = New ToolStripMenuItem()
  74.                 T.Text = L.Name
  75.                 T.Tag = L.Path
  76.                 strMusics.DropDownItems.Add(T)
  77.                 Settings.Musics.Add(L)
  78.             End While
  79.             RL.Close()
  80.         Catch FNFE As IO.FileNotFoundException
  81.             T.Text = "Nessun brano"
  82.             T.Tag = "exit"
  83.             strMusics.DropDownItems.Add(T)
  84.         End Try
  85.  
  86.         sysIcon.Visible = True
  87.         sysIcon.BalloonTipTitle = "Aiutante virtuale"
  88.         sysIcon.BalloonTipText = Settings.Texts.Open
  89.         sysIcon.ShowBalloonTip(2000)
  90.  
  91.         Me.Size = New Drawing.Size(Settings.Images.W, Settings.Images.H)
  92.         imgMain.Image = Drawing.Image.FromFile(Application.StartupPath + "\Imms\" + Settings.Images.Init)
  93.         AddHandler strLinks.DropDownItemClicked, AddressOf CallLink
  94.         AddHandler strMusics.DropDownItemClicked, AddressOf CallMusic
  95.     End Sub
  96.     Private Sub NascondiToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles strHid.Click
  97.         If strHid.Text = "Nascondi" Then
  98.             Me.Visible = False
  99.             strHid.Text = "Mostra"
  100.         Else
  101.             Me.Visible = True
  102.             strHid.Text = "Nascondi"
  103.         End If
  104.     End Sub
  105.     Private Sub EsciToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EsciToolStripMenuItem.Click
  106.         MsgBox(Settings.Texts.Out, MsgBoxStyle.Information)
  107.         sysIcon.Visible = False
  108.         Me.Close()
  109.     End Sub
  110.     Private Sub OraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OraToolStripMenuItem.Click
  111.         Dim D As Date = Date.Now
  112.  
  113.         sysIcon.BalloonTipTitle = "Data e ora"
  114.         sysIcon.BalloonTipText = D.ToLongDateString + ", Ore " + D.ToLongTimeString
  115.         sysIcon.ShowBalloonTip(3000)
  116.     End Sub
  117.     Private Sub CalcolatriceToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalcolatriceToolStripMenuItem.Click
  118.         Shell("C:\WINDOWS\system32\calc.exe")
  119.     End Sub
  120.     Private Sub AgendaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AgendaToolStripMenuItem.Click
  121.         Dim A As New frmDiary
  122.         A.Show()
  123.     End Sub
  124.     Private Sub CallLink(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs)
  125.         Try
  126.             Shell(e.ClickedItem.Tag)
  127.         Catch FNFE As IO.FileNotFoundException
  128.  
  129.         End Try
  130.     End Sub
  131.     Private Sub CallMusic(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs)
  132.         Try
  133.             Shell(Settings.MusicExe + " " + Chr(34) + e.ClickedItem.Tag + Chr(34))
  134.             sysIcon.BalloonTipText = Settings.Texts.Music
  135.             sysIcon.ShowBalloonTip(2000)
  136.             imgMain.Image = Drawing.Image.FromFile(Application.StartupPath + "\Imms\" + Settings.Images.Music)
  137.             Me.Focus()
  138.         Catch FNFE As IO.FileNotFoundException
  139.  
  140.         End Try
  141.     End Sub
  142.     Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
  143.         Dim O As New frmOption
  144.         O.ShowDialog()
  145.     End Sub
  146.     Private Sub NormaleToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NormaleToolStripMenuItem.Click
  147.         imgMain.Image = Drawing.Image.FromFile(Application.StartupPath + "\Imms\" + Settings.Images.Init)
  148.     End Sub
  149.     Private Sub MusicaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MusicaToolStripMenuItem.Click
  150.         imgMain.Image = Drawing.Image.FromFile(Application.StartupPath + "\Imms\" + Settings.Images.Music)
  151.     End Sub
  152.     Private Sub ToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem4.Click
  153.         Dim A As New frmAutoStart
  154.         A.ShowDialog()
  155.     End Sub
  156.     Private Sub ToolStripMenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem6.Click
  157.         Dim A As New frmAbout
  158.         A.ShowDialog()
  159.     End Sub
  160.     'Private Sub imgMain_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles imgMain.MouseMove
  161.     'If MON And Mode Then
  162.     '    Me.Location = MousePosition
  163.     ' End If
  164.     ' End Sub
  165.     'Private Sub imgMain_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles imgMain.MouseDown
  166.     'MON = True
  167.     'End Sub
  168.     'Private Sub imgMain_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles imgMain.MouseUp
  169.     'MON = False
  170.     ' End Sub
  171.     Private Sub ToolStripMenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem7.Click
  172.         Form1_Load(ToolStripMenuItem7, New System.EventArgs)
  173.     End Sub
  174. End Class