示例#1
0
        public static CoinData GetLastCoinData()
        {
            CoinData data = new CoinData(0, 0, 0);
            string   sql  = "Select * from coin_logs where id = (SELECT seq FROM sqlite_sequence where name='coin_logs')";

            if (connection.State == System.Data.ConnectionState.Closed)
            {
                connection.Open();
            }
            SQLiteCommand    command = new SQLiteCommand(sql, connection);
            SQLiteDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                try
                {
                    data.Value         = Double.Parse(reader["value"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                    data.RemainedValue = Double.Parse(reader["remained_value"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                    data.UsedValue     = Double.Parse(reader["used_value"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                    data.TotalValue    = Double.Parse(reader["total_value"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                }
                catch (FormatException)
                {
                }
            }
            connection.Close();
            return(data);
        }
示例#2
0
        public TakePhoto(ImageCollection image, NikonDevice device, CoinSelector selector)
        {
            InitializeComponent();
            this.DoubleBuffered = true;
            this.Cursor         = new Cursor(GetType(), "hand128.cur");
            Cursor.Hide();
            CenterComponents();

            coinSelector = selector;
            coinSelector.OnCoinDetected += coinSelector_OnCoinDetected;
            coinSelector.PollingEnabled  = false;
            CoinData coinData = LogManager.GetLastCoinData();

            coinSelector.TotalCoin = coinData.TotalValue;
            coinSelector.UsedCoin  = coinData.UsedValue;
            // Hook up device capture events
            this.device             = device;
            device.ImageReady      += new ImageReadyDelegate(device_ImageReady);
            device.CaptureComplete += new CaptureCompleteDelegate(device_CaptureComplete);

            counter = new Counter();
            Image   = image;
            this.BackgroundImage = new Bitmap(Image.BackgroundImage);
            printImage           = new Bitmap(Image.BackgroundImage);
            timer          = new System.Timers.Timer(1000);
            timer.Elapsed += new ElapsedEventHandler(CountDown);
            timer.Enabled  = false;

            copyCount = new CopyCount(Settings.Instance.CopyCount);

            coinWaitTimer           = new System.Timers.Timer();
            coinWaitTimer.Interval  = 60000;
            coinWaitTimer.Enabled   = false;
            coinWaitTimer.AutoReset = false;
            coinWaitTimer.Elapsed  += coinWaitTimer_Elapsed;

            closingTimer = new System.Timers.Timer(6000);

            CounterItem cItem = counter.CountDown();

            pictureBox1.Image = cItem.Number;
            pictureBox2.Image = cItem.Smile;
            timer.Start();

            pictureBox5.Image = generateADImage(copyCount.Count);
            pictureBox8.Image = generateTotalCoinImage(copyCount.Count * Settings.Instance.COST);
            pictureBox9.Image = generateCoinImage(coinSelector.RemainedCoin);
        }
示例#3
0
 public CoinLogData(CoinData coinData)
 {
     LogTime  = DateTime.Now;
     CoinData = coinData;
 }