Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.VisualBasic;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Printer_Calc
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- public string SELECTED_PRINTER = "Normal Printer";
- public double OverallTotal;
- public double SELECTED_MULTIPLIER = 1;
- public double SELECTED_PRINTER_PROFIT = 35928;
- public double EARNINGS;
- private void timer1_Tick(object sender, EventArgs e)
- {
- if (OverallTotal <= 0 )
- {
- label2.Text = "No Printers";
- }
- else
- {
- label2.Text = OverallTotal.ToString() + "$/h";
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- OverallTotal = 0;
- dataGridView1.Rows.Clear();
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (comboBox1.SelectedIndex == 0)
- {
- SELECTED_PRINTER = "=Normal Printer=";
- SELECTED_PRINTER_PROFIT = 0;
- }
- else if (comboBox1.SelectedIndex == 1)
- {
- SELECTED_PRINTER = "Topaz Printer";
- SELECTED_PRINTER_PROFIT = 18000;
- }
- else if (comboBox1.SelectedIndex == 2)
- {
- SELECTED_PRINTER = "Amethyst Printer";
- SELECTED_PRINTER_PROFIT = 27000;
- }
- else if (comboBox1.SelectedIndex == 3)
- {
- SELECTED_PRINTER = "Emerald Printer";
- SELECTED_PRINTER_PROFIT = 45000;
- }
- else if (comboBox1.SelectedIndex == 4)
- {
- SELECTED_PRINTER = "Sapphire Printer";
- SELECTED_PRINTER_PROFIT = 135000;
- }
- else if (comboBox1.SelectedIndex == 5)
- {
- SELECTED_PRINTER = "Uranium Printer";
- SELECTED_PRINTER_PROFIT = 133;
- }
- else if (comboBox1.SelectedIndex == 6)
- {
- SELECTED_PRINTER = "=VIP Printers=";
- SELECTED_PRINTER_PROFIT = 0;
- }
- else if (comboBox1.SelectedIndex == 7)
- {
- SELECTED_PRINTER = "Normal Printer";
- SELECTED_PRINTER_PROFIT = 36000;
- }
- else if (comboBox1.SelectedIndex == 8)
- {
- SELECTED_PRINTER = "Ruby Printer";
- SELECTED_PRINTER_PROFIT = 72000;
- }
- else if (comboBox1.SelectedIndex == 9)
- {
- SELECTED_PRINTER = "Gold Printer";
- SELECTED_PRINTER_PROFIT = 144000;
- }
- else if (comboBox1.SelectedIndex == 10)
- {
- SELECTED_PRINTER = "Nuclear Printer";
- SELECTED_PRINTER_PROFIT = 324000;
- }
- else if (comboBox1.SelectedIndex == 11)
- {
- SELECTED_PRINTER = "=Special Printers=";
- SELECTED_PRINTER_PROFIT = 0;
- }
- else if (comboBox1.SelectedIndex == 12)
- {
- SELECTED_PRINTER = "Diamond Printer";
- SELECTED_PRINTER_PROFIT = 720000;
- }
- else if (comboBox1.SelectedIndex == 13)
- {
- SELECTED_PRINTER = "Black Diamond Printer";
- SELECTED_PRINTER_PROFIT = 1200000;
- }
- else if (comboBox1.SelectedIndex == 14)
- {
- SELECTED_PRINTER = "Golden Plated Printer";
- SELECTED_PRINTER_PROFIT = 27000000;
- }
- else if (comboBox1.SelectedIndex == 15)
- {
- SELECTED_PRINTER = "GenCorp Printer";
- SELECTED_PRINTER_PROFIT = 1800000;
- }
- else if (comboBox1.SelectedIndex == 16)
- {
- SELECTED_PRINTER = "Magik Printer";
- SELECTED_PRINTER_PROFIT = 2400012;
- }
- else if (comboBox1.SelectedIndex == 17)
- {
- SELECTED_PRINTER = "Festive Printer";
- SELECTED_PRINTER_PROFIT = 1800000;
- }
- else if (comboBox1.SelectedIndex == 18)
- {
- SELECTED_PRINTER = "Iridium Printer";
- SELECTED_PRINTER_PROFIT = 2250000;
- }
- else if (comboBox1.SelectedIndex == 19)
- {
- SELECTED_PRINTER = "Ice Printer";
- SELECTED_PRINTER_PROFIT = 27000000;
- }
- else if (comboBox1.SelectedIndex == 20)
- {
- SELECTED_PRINTER = "Skull Printer";
- SELECTED_PRINTER_PROFIT = 27000000;
- }
- else if (comboBox1.SelectedIndex == 21)
- {
- SELECTED_PRINTER = "XMAS Printer";
- SELECTED_PRINTER_PROFIT = 2772000;
- }
- else if (comboBox1.SelectedIndex == 22)
- {
- SELECTED_PRINTER = "Summer Printer";
- SELECTED_PRINTER_PROFIT = 2880000;
- }
- else if (comboBox1.SelectedIndex == 23)
- {
- SELECTED_PRINTER = "Hell Printer";
- SELECTED_PRINTER_PROFIT = 2889000;
- }
- else if (comboBox1.SelectedIndex == 24)
- {
- SELECTED_PRINTER = "Santa Printer";
- SELECTED_PRINTER_PROFIT = 2520000;
- }
- else if (comboBox1.SelectedIndex == 25)
- {
- SELECTED_PRINTER = "Easter Printer";
- SELECTED_PRINTER_PROFIT = 2790000;
- }
- }
- private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (comboBox2.SelectedIndex == 0)
- {
- SELECTED_MULTIPLIER = 1;
- }
- else if (comboBox2.SelectedIndex == 1)
- {
- SELECTED_MULTIPLIER = 2;
- }
- else if (comboBox2.SelectedIndex == 2)
- {
- SELECTED_MULTIPLIER = 3;
- }
- else if (comboBox2.SelectedIndex == 3)
- {
- SELECTED_MULTIPLIER = 4;
- }
- else if (comboBox2.SelectedIndex == 4)
- {
- SELECTED_MULTIPLIER = 5;
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- EARNINGS = SELECTED_PRINTER_PROFIT * SELECTED_MULTIPLIER;
- dataGridView1.Rows.Add(SELECTED_PRINTER, SELECTED_MULTIPLIER.ToString(), EARNINGS.ToString());
- OverallTotal += EARNINGS;
- }
- private void button3_Click(object sender, EventArgs e)
- {
- if (dataGridView1.SelectedRows.Count > 0 && dataGridView1.SelectedRows[0].Index != dataGridView1.Rows.Count - 1)
- {
- dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[0].Index);
- }
- }
- private void button3_Click_1(object sender, EventArgs e)
- {
- string defaultResponse = "Your Config";
- string input = Interaction.InputBox("Enter your Config name below", "Enter Name", defaultResponse, -1, -1);
- if (input.Length == 0)
- {
- MessageBox.Show("Input can't be empty!!", "Error");
- }
- else
- {
- MessageBox.Show("Will save printer config with the name: " + input);
- string file = Application.StartupPath + "/" + input + "_calcsave.bin";
- using (BinaryWriter bw = new BinaryWriter(File.Open(file, FileMode.Create)))
- {
- bw.Write(dataGridView1.Columns.Count);
- bw.Write(dataGridView1.Rows.Count);
- foreach (DataGridViewRow dgvR in dataGridView1.Rows)
- {
- for (int j = 0; j < dataGridView1.Columns.Count; ++j)
- {
- object val = dgvR.Cells[j].Value;
- if (val == null)
- {
- bw.Write(false);
- bw.Write(false);
- }
- else
- {
- bw.Write(true);
- bw.Write(val.ToString());
- }
- }
- }
- }
- }
- }
- private void button4_Click(object sender, EventArgs e)
- {
- try
- {
- string defaultResponse = "Your Config";
- string input = Interaction.InputBox("Enter your Config name below", "Enter Name", defaultResponse, -1, -1);
- if (input.Length == 0)
- {
- MessageBox.Show("Input can't be empty!!", "Error");
- }
- else
- {
- MessageBox.Show("Will load printer config with the name: " + input);
- dataGridView1.Rows.Clear();
- string file = Application.StartupPath + "/" + input + "_calcsave.bin";
- using (BinaryReader bw = new BinaryReader(File.Open(file, FileMode.Open)))
- {
- int n = bw.ReadInt32();
- int m = bw.ReadInt32();
- for (int i = 0; i < m; ++i)
- {
- dataGridView1.Rows.Add();
- for (int j = 0; j < n; ++j)
- {
- if (bw.ReadBoolean())
- {
- dataGridView1.Rows[i].Cells[j].Value = bw.ReadString();
- }
- else bw.ReadBoolean();
- }
- }
- }
- }
- }
- catch
- {
- MessageBox.Show("Config does not exist!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
- {
- }
- private void quicknonprinterload_Click(object sender, EventArgs e)
- {
- if (comboBox1.SelectedIndex == 0)
- {
- SELECTED_PRINTER = "=Normal Printer=";
- SELECTED_PRINTER_PROFIT = 0;
- }
- else if (comboBox1.SelectedIndex == 1)
- {
- SELECTED_PRINTER = "Topaz Printer";
- SELECTED_PRINTER_PROFIT = 18000;
- }
- else if (comboBox1.SelectedIndex == 2)
- {
- SELECTED_PRINTER = "Amethyst Printer";
- SELECTED_PRINTER_PROFIT = 27000;
- }
- else if (comboBox1.SelectedIndex == 3)
- {
- SELECTED_PRINTER = "Emerald Printer";
- SELECTED_PRINTER_PROFIT = 45000;
- }
- else if (comboBox1.SelectedIndex == 4)
- {
- SELECTED_PRINTER = "Sapphire Printer";
- SELECTED_PRINTER_PROFIT = 135000;
- }
- else if (comboBox1.SelectedIndex == 5)
- {
- SELECTED_PRINTER = "Uranium Printer";
- SELECTED_PRINTER_PROFIT = 133;
- }
- else if (comboBox1.SelectedIndex == 6)
- EARNINGS = SELECTED_PRINTER_PROFIT * SELECTED_MULTIPLIER;
- dataGridView1.Rows.Add(SELECTED_PRINTER, SELECTED_MULTIPLIER.ToString(), EARNINGS.ToString());
- OverallTotal += EARNINGS;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement