示例#1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Laskut.OstoHinnasto();
            //Application.Run(new AdminForm());
            Application.Run(new Form2());

            Application.Run(new Form1());
        }
示例#2
0
        private void Button11_Click(object sender, EventArgs e) //OK Näppäin
        {
            string pin = textBox4.Text;

            if (sound)
            {
                if (Directory.Exists("C:/temp/SoundClips"))
                {
                    System.Media.SoundPlayer Beep = new System.Media.SoundPlayer("C:/temp/SoundClips/Beep.wav");
                    Beep.Play();
                }
            }

            try
            {
                litrat = double.Parse(textBox4.Text);
            }
            catch
            {
                textBox4.Text = "";
            }
            if (pin.Length > 3 && pin.Length < 9 && !määrä)
            {
                tyhjennys = true;
                valinta   = true;
                TextBoxClear();
                textBox4.Text    = "Valitse bensan laatu";
                kortti           = false;
                button11.Enabled = false;
                Blink2();
            }
            else if (!määrä && kortti)
            {
                textBox4.Text = "Väärä tunnusluku";
                tyhjennys     = true;
            }
            else if (määrä && litrat > 4 && litrat < 121)
            {
                textBox4.Text = "Aloita tankkaus";
                textBox6.Text = $"{litrat.ToString()} Litraa";
                textBox5.Text = $"{Laskut.Hinta(litrat, bensa, eriTiedostot)} €";
                hinta         = textBox5.Text;
                kortti        = false;
                tankkaus      = true;

                button11.Enabled = false;
            }
        }
示例#3
0
 private void ButtonTankkaus_Click(object sender, EventArgs e) //TankkausNappi
 {
     if (tankkaus)
     {
         if (sound)
         {
             if (Directory.Exists("C:/temp/SoundClips"))
             {
                 System.Media.SoundPlayer Beep = new System.Media.SoundPlayer("C:/temp/SoundClips/Beep.wav");
                 Beep.Play();
             }
         }
         tyhjennys = true;
         TextBoxClear();
         Progress(litrat);
         Laskut.Talletus(bensa, litrat, hinta);
         Laskut.MääräLasku(litrat, bensa);
     }
 }
示例#4
0
        public void InitializeValues() //Tekstitiedostosta hinnat formiin
        {
            if (!Laskut.Check95())
            {
                label1.Enabled = false;
            }
            else
            {
                label1.Enabled = true;
            }
            if (!Laskut.Check98())
            {
                label2.Enabled = false;
            }
            else
            {
                label2.Enabled = true;
            }
            if (!Laskut.CheckD())
            {
                label3.Enabled = false;
            }
            else
            {
                label3.Enabled = true;
            }


            if (!eriTiedostot)
            {
                var e95 = File.ReadLines(filepath).ElementAt(0);
                e95           = e95.Remove(0, e95.IndexOf(' ', +1));
                e95           = Math.Round((double)Convert.ToDouble(e95), 3).ToString();
                textBox1.Text = $"{e95} €";

                var e98 = File.ReadLines(filepath).ElementAt(1);
                e98           = e98.Remove(0, e98.IndexOf(' ', +1));
                e98           = Math.Round((double)Convert.ToDouble(e98), 3).ToString();
                textBox2.Text = $"{e98} €";

                var diesel = File.ReadLines(filepath).ElementAt(2);
                diesel        = diesel.Remove(0, diesel.IndexOf(' ', +1));
                diesel        = Math.Round((double)Convert.ToDouble(diesel), 3).ToString();
                textBox3.Text = $"{diesel} €";
            }
            else
            {
                var e95 = File.ReadLines(filepath101).ElementAt(0);
                textBox1.Text = $"{e95} €";

                var e98 = File.ReadLines(filepath102).ElementAt(0);
                textBox2.Text = $"{e98} €";

                var diesel = File.ReadLines(filepath103).ElementAt(0);
                textBox3.Text = $"{diesel} €";
            }

            if (!sound)
            {
                soundToolStripMenuItem.ForeColor = Color.Red;
            }
            else
            {
                soundToolStripMenuItem.ForeColor = Color.Green;
            }
            if (eriTiedostot)
            {
                tiedostoToolStripMenuItem.ForeColor = Color.Red;
            }
            else
            {
                tiedostoToolStripMenuItem.ForeColor = Color.Green;
            }
        }