예제 #1
0
    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;
    }
예제 #2
0
    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();
                }
            }
            

            
            

            
            
            
        }
    }
예제 #3
0
        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();
        }
예제 #4
0
        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();
        }
예제 #5
0
        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);
        }
예제 #6
0
#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;
            }
        }
예제 #7
0
        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();
        }
예제 #8
0
        /// <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;
        }
    }
예제 #11
0
 public virtual void SetRecommendedPrescription(Rx prescription)
 {
     Prescription = new Rx(prescription);
 }
예제 #12
0
 public RxWatch(Rx <T> rx) => this.rx = rx;