public static List<Rx> Get_Rx() { //SqlConnection cn; //SqlDataReader rdr; List<Rx> rxList = new List<Rx>(); try { string query = "SELECT * FROM Rx"; SqlConnection cn = Setup_Connection(); SqlCommand cmd = new SqlCommand(query, cn); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { while (rdr.Read()) { Rx rx = new Rx(rdr); rxList.Add(rx); } } } catch (Exception e) { return rxList; } return rxList; }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Rx holder = new Rx(); if (DropDownList1.SelectedIndex != 0) { int selectV; Int32.TryParse(DropDownList1.SelectedValue, out selectV); foreach (Rx pescr in pescribe) { if(pescr.RxID == selectV) { holder = pescr; odAdd.Text = holder.RAdd.ToString(); odAx.Text = holder.RAxis.ToString(); odBase.Text = holder.RBase.ToString(); odCyl.Text = holder.RCylinder.ToString(); odNPD.Text = holder.Rnpd.ToString(); odPD.Text = holder.Rpd.ToString(); odPri.Text = holder.RPrism.ToString(); odSeg.Text = holder.RSeg.ToString(); odSph.Text = holder.RSphere.ToString(); osAdd.Text = holder.LAdd.ToString(); osAx.Text = holder.LAxis.ToString(); osBase.Text = holder.LBase.ToString(); osCyl.Text = holder.LCylinder.ToString(); osNPD.Text = holder.Lnpd.ToString(); osPD.Text = holder.Lpd.ToString(); osPri.Text = holder.LPrism.ToString(); osSeg.Text = holder.LSeg.ToString(); osSph.Text = holder.LSphere.ToString(); rxLabel.Text = "Rx ID "+ holder.RxID.ToString(); } } } }
private void trackBar4_Scroll(object sender, EventArgs e) { Rx = trackBar9.Value * 0.001 + trackBar0.Value * 0.01 + trackBar1.Value * 0.1 + trackBar2.Value * 1 + trackBar3.Value * 10 + trackBar4.Value * 100 + trackBar5.Value * 1000 + trackBar6.Value * 10000; RxBox.Text = Rx.ToString(); if (radioButton1.Checked) { R = Convert.ToDouble(RaBox.Text) + Convert.ToDouble(RxBox.Text); // R = Rx + Ra RBox.Text = R.ToString(); } else if (radioButton2.Checked) { R = (Convert.ToDouble(RxBox.Text) * Convert.ToDouble(RvBox.Text)) / (Convert.ToDouble(RxBox.Text) + Convert.ToDouble(RvBox.Text)); // R = (Rx * Rv) / (Rx + Rv) RBox.Text = R.ToString(); } curI = curV / R; trackBar8.Value = Convert.ToInt32(curI); ASetValue(panel2, curI); textBox2.Text = curI.ToString(); }
private async Task Receive() { try { while (WebSocket.State == WebSocketState.Open) { var buffer = new byte[BufferSize]; var result = await WebSocket.ReceiveAsync(new ArraySegment <byte>(buffer), _objCancelationToken); if (result.MessageType == WebSocketMessageType.Close) { throw new Exception("Client Disconnected"); } else { var arrMessage = new byte[result.Count]; Array.Copy(buffer, 0, arrMessage, 0, result.Count); while ( !result.EndOfMessage && ( result.CloseStatus == null || result.CloseStatus == WebSocketCloseStatus.Empty ) ) { result = await WebSocket.ReceiveAsync(new ArraySegment <byte>(buffer), _objCancelationToken); Array.Resize(ref arrMessage, arrMessage.Length + result.Count); Array.Copy(buffer, 0, arrMessage, arrMessage.Length - result.Count, result.Count); } Rx?.Invoke(this, arrMessage); } } } catch (TaskCanceledException) { } catch (OperationCanceledException) { //ignore } catch (Exception ex) { Log.Info($"Error receiving data: {ex.Message}, closing connection"); } Disconnect(); }
internal bool SetInput(Rx input) { if (!this.IsConnected) { return(false); } string command = string.Format(CultureInfo.InvariantCulture, "set insel {0} 4", (int)input); if (this.writer != null) { try { this.writer.WriteLine(command); this.writer.Flush(); } catch { return(false); } } return(true); }
#pragma warning restore CA1062 private void SetCurrentInput(Rx input) { switch (input) { case Rx.Input1: SetImageSource(this.Input0, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_1_white_24dp.png"); SetImageSource(this.Input1, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_2_black_24dp.png"); SetImageSource(this.Input2, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_3_black_24dp.png"); SetImageSource(this.Input3, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_4_black_24dp.png"); break; case Rx.Input2: SetImageSource(this.Input0, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_1_black_24dp.png"); SetImageSource(this.Input1, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_2_white_24dp.png"); SetImageSource(this.Input2, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_3_black_24dp.png"); SetImageSource(this.Input3, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_4_black_24dp.png"); break; case Rx.Input3: SetImageSource(this.Input0, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_1_black_24dp.png"); SetImageSource(this.Input1, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_2_black_24dp.png"); SetImageSource(this.Input2, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_3_white_24dp.png"); SetImageSource(this.Input3, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_4_black_24dp.png"); break; case Rx.Input4: SetImageSource(this.Input0, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_1_black_24dp.png"); SetImageSource(this.Input1, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_2_black_24dp.png"); SetImageSource(this.Input2, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_3_black_24dp.png"); SetImageSource(this.Input3, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_4_white_24dp.png"); break; default: SetImageSource(this.Input0, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_1_black_24dp.png"); SetImageSource(this.Input1, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_2_black_24dp.png"); SetImageSource(this.Input2, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_3_black_24dp.png"); SetImageSource(this.Input3, "pack://application:,,/DigitalHomeCinemaControl;component/Resources/Icons/outline_filter_4_black_24dp.png"); break; } }
public void ReceiveFrame(byte[] frame) { this.Log(LogLevel.Warning, "packet as bytes '{0}' of len {1}", frame.Select(x => String.Format("0x{0:X}", x)).Aggregate((x, y) => x + " " + y), frame.Length); packLength = (uint)frame.Length; machine.SystemBus.WriteByte(MAC_RX_ST_ADDR_A, (byte)(frame.Length)); machine.SystemBus.WriteByte(MAC_RX_ST_ADDR_B, (byte)(frame.Length)); for (int i = 0; i < frame.Length; ++i) { machine.SystemBus.WriteByte(MAC_RX_ST_ADDR_A + i + 1, frame[i]); machine.SystemBus.WriteByte(MAC_RX_ST_ADDR_B + i + 1, frame[i]); } /* ushort crc = count_crc(data); * this.Log(LogType.Noisy, "Counted CRC = {0:X}", crc); * this.SystemBus.WriteByte(MAC_RX_ST_ADDR_A + packet_data.Length - 1, (byte)(crc & 0xFF)); * this.SystemBus.WriteByte(MAC_RX_ST_ADDR_A + packet_data.Length, (byte)((crc >> 8) & 0xFF)); * this.SystemBus.WriteByte(MAC_RX_ST_ADDR_B + packet_data.Length - 1, (byte)(crc & 0xFF)); * this.SystemBus.WriteByte(MAC_RX_ST_ADDR_B + packet_data.Length, (byte)((crc >> 8) & 0xFF)); */ Rx.Set(); Tim.Set(); }
/// <summary> /// Listens on the Receiver Queue for any messages /// /// When data is received the Rx event is raised /// </summary> private void StartListening(string pName) { var factory = new ConnectionFactory() { HostName = "test.crazyzone.be" }; var connection = factory.CreateConnection(); var channel = connection.CreateModel(); channel.ExchangeDeclare(exchange: QueueType.ToString(), type: "fanout"); channel.QueueDeclare(pName, false, false, !Shared); channel.QueueBind(pName, QueueType.ToString(), pName); var consumer = new EventingBasicConsumer(channel); consumer.Shutdown += Consumer_Shutdown; consumer.Received += (model, ea) => { Task.Run(() => { Rx?.Invoke(this, new RoutingFrame(ea.Body)); }); }; channel.BasicConsume(queue: pName, autoAck: true, consumer: consumer); }
public override void SetRecommendedPrescription(Rx prescription) { }
protected void Page_Load(object sender, EventArgs e) { if(Application["lastSelect"] == null) Application["lastSelect"] = 0; //If We havent initialized the list of prescriptions //do so if (Application["Rxs"] == null) { //where the data is string path = Server.MapPath("App_Data/Rx.csv"); //Read a line from the data file until we finish using (StreamReader readFile = new StreamReader(path)) { readFile.ReadLine(); string line; while ((line = readFile.ReadLine()) != null) { Rx display_rx = new Rx(line); Rxs.Add(display_rx); } } } else { Rxs = (List<Rx>)Application["Rxs"]; } Application["Rxs"] = Rxs; //If the user postbacked we dont have much to do. if (IsPostBack) { return; } }
public virtual void SetRecommendedPrescription(Rx prescription) { Prescription = new Rx(prescription); }
public RxWatch(Rx <T> rx) => this.rx = rx;