static void Main(string[] args) { AbstractMeterCountMeasurementStrategy rpMeasurement = new RotaryPistonMeasurement(); AbstractMeterCountMeasurementStrategy usMeasurement = new UltraSoundMeasurement(); IMeterCountDisplayStrategy led = new LEDDisplay(); IMeterCountDisplayStrategy scale = new ScaleDisplay(); IMeterCountTransmissionStrategy wlan = new WLANTransmission(); IMeterCountTransmissionStrategy cable = new CableTransmission(); AbstractMeter meter = new GasMeter(rpMeasurement, led, cable); string meterCount = meter.ActualMeterCount; meter.DisplayMeterCount(meterCount); meter.TransmitMeterCount(meterCount); Console.ReadKey(); }
private void Form1_Load(object sender, EventArgs e) { tmReader = new System.Timers.Timer(); tmReaderMember = new System.Timers.Timer(); loadConfig(); toggleControlDisplay(); if (!db.Connect(txtDatabaseIP.Text)) { MessageBox.Show("Cannot connect to database, please check IP Database and restart program"); } player.Stop(); MaximizeBox = false; MinimizeBox = false; progressBar1.Visible = true; active = new Image[6]; deactive = new Image[6]; for (int i = 0; i < 6; i++) { active[i] = Image.FromFile("Images/triangle-icon.png"); deactive[i] = Image.FromFile("Images/dark-icon.png"); } axVLCPlugin1.stop(); axVLCPlugin1.playlistClear(); axVLCPlugin1.addTarget("rtsp://*****:*****@" + txtCam1.Text + ":554/cam/realmonitor?channel=1&subtype=0", null, AXVLC.VLCPlaylistMode.VLCPlayListReplaceAndGo, 0); axVLCPlugin1.play(); axVLCPlugin2.stop(); axVLCPlugin2.playlistClear(); axVLCPlugin2.addTarget("rtsp://*****:*****@" + txtCam2.Text + ":554/cam/realmonitor?channel=1&subtype=0", null, AXVLC.VLCPlaylistMode.VLCPlayListReplaceAndGo, 0); axVLCPlugin2.play(); progressBar1.Visible = false; if (rdBack.Checked) { dahua.InitCamera(txtCam1.Text, txtCam2.Text, "", ""); progressBar1.Visible = true; progressBar1.Value = 10; backgroundWorker1.WorkerReportsProgress = true; backgroundWorker1.RunWorkerAsync(); } foreach (string s in SerialPort.GetPortNames()) { cmbControlPort.Items.Add(s); cmbLEDPort.Items.Add(s); cmbReaderPort.Items.Add(s); cmbReaderMember.Items.Add(s); } ledDisplay = new LEDDisplay(cmbLEDPort.Text); if (ledDisplay.openPort()) { ledDisplay.setText("Creative Innovation Technology", 3); } else { MessageBox.Show("Cannot connect to LED display."); } mifaV = new MifareReader(false); mifaMember = new FRMReader(); if (mifaMember.Open(cmbReaderMember.Text)) { if (mifaMember.Connect()) { mifaMember.setLED(1); tmReaderMember.Enabled = true; tmReaderMember.Interval = 100; tmReaderMember.Elapsed += tmReaderMember_Elapsed; tmReaderMember.Start(); } else { MessageBox.Show("Cannot connect to Member Reader."); } } if (mifaV.Open(cmbReaderPort.Text)) { if (mifaV.Connect()) { dispenserControl = new DispenserControllor(cmbControlPort.Text); if (dispenserControl.openPort()) { dispenserControl.portHandle.Write("S\r"); dispenserControl.portHandle.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler); Thread.Sleep(700); if (connectBoard) { tmReader.Enabled = true; tmReader.Interval = 100; tmReader.Elapsed += tmReader_Elapsed; tmReader.Start(); } else { MessageBox.Show("Cannot connect to control board."); } } } else { MessageBox.Show("Cannot connect to Reader."); } } }