Esempio n. 1
0
        private void insertListItem(RX rx) //get information from NewInfo form and insert it into listview.
        {
            ListViewItem item = createListItem(rx);

            this.listView1.Items.Add(item);
            //UpdateListViewColumnWidth();
        }
Esempio n. 2
0
 public IObservable <Tuple <Target, Message> > Map <Source, Target>(IObservable <Tuple <Source, Message> > source, IDictionary <Source, Target> target_by_source)
 {
     return(RX.Create <Tuple <Target, Message> >(observer =>
     {
         return source.Subscribe(
             source_node_message =>
         {
             try
             {
                 Target target_node;
                 bool found_target;
                 using (Concurrency.ReaderLock(_mutex))
                 {
                     found_target = target_by_source.TryGetValue(source_node_message.Item1, out target_node);
                 }
                 if (found_target)
                 {
                     var target_node_message = Tuple.Create(target_node, source_node_message.Item2);
                     observer.OnNext(target_node_message);
                 }
             }
             catch (Exception error)
             {
                 observer.OnError(error);
             }
         },
             observer.OnError,
             observer.OnCompleted
             );
     }));
 }
Esempio n. 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            RX rX = db.RXes.Find(id);

            db.RXes.Remove(rX);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
    // Use this for initialization
    private void Start()
    {
        //runs the pidLoop at 2khz
        InvokeRepeating("pidLoop", 0, loopTime);

        //gets access to all other scripts attached to this game obejct
        receiver     = gameObject.GetComponent <RX>();
        getIMU       = gameObject.GetComponent <IMU>();
        motorControl = gameObject.GetComponent <Motor>();
    }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "RxID,RxName,ExID,PID,PhID,LogID")] RX rX)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rX).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(rX));
 }
Esempio n. 6
0
        private void CalcNumSteps()
        {
            //double ra = (Math.Abs(RX) + Math.Abs(RY)) / 2;
            T ra = RX.Abs().Add(RY.Abs()).Divide(2);

            //double da = Math.Acos(ra / (ra + 0.125 / m_scale)) * 2;

            T da = ra.Divide(ra.Add(0.125).Divide(m_scale)).Acos().Multiply(2);

            m_num = (uint)M.PI <T>().Multiply(2).Divide(da).Round().ToInt();
        }
Esempio n. 7
0
        public ActionResult Create([Bind(Include = "RxID,RxName,ExID,PID,PhID,LogID")] RX rX)
        {
            if (ModelState.IsValid)
            {
                db.RXes.Add(rX);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(rX));
        }
Esempio n. 8
0
 public ActionResult Edit([Bind(Include = "RxID,RxName,ExID,PID,PhID,LogID")] RX rX)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rX).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PID = new SelectList(db.Patients, "PID", "UserID", rX.PID);
     return(View(rX));
 }
Esempio n. 9
0
        private void updateListItem(RX rx)
        {
            int index = this.listView1.Items.IndexOf(selected[0]);

            this.listView1.Items.RemoveAt(index);
            ListViewItem item = createListItem(rx);

            this.listView1.Items.Insert(index, item);

            //UpdateListViewColumnWidth();
        }
Esempio n. 10
0
        private static string RemoveSeriesAndNumbers(this string S)
        {
            foreach (var RX in Episode.Tests)
            {
                if (RX.IsMatch(S))
                {
                    return(S.Substring(S.IndexOf(RX.Match(S).Groups[0].Value) + RX.Match(S).Groups[0].Value.Length).StartWithLetter());
                }
            }

            return(S);
        }
Esempio n. 11
0
        public ActionResult Create([Bind(Include = "RxID,RxName,ExID,PID,PhID,LogID")] RX rX)
        {
            if (ModelState.IsValid)
            {
                db.RXes.Add(rX);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.PID = new SelectList(db.Patients, "PID", "UserID", rX.PID);
            return(View(rX));
        }
Esempio n. 12
0
        private RX loadItem()
        {
            RX           rx   = new RX();
            ListViewItem item = selected[0];

            ListViewItem.ListViewSubItemCollection sub = item.SubItems;
            for (int i = 0; i < sub.Count; i++)
            {
                rx[i] = sub[i].Text;
            }
            return(rx);
        }
 public void LoadEvent(RX rx)
 {
     for (int i = 0; i < textBoxArray.Count; i++)
     {
         ((TextBox)this.textBoxArray[i]).Text = rx[i];
     }
     //this.textBox1.Text = rx.Col1;
     //this.textBox2.Text = rx.Col2;
     //this.textBox3.Text = rx.Col3;
     //this.textBox4.Text = rx.Col4;
     //this.textBox5.Text = rx.Col5;
     //this.textBox6.Text = rx.Col6;
 }
Esempio n. 14
0
        public Boolean Save()
        {
            Boolean Saved = true;

            try
            {
                XmlNode Node;

                m_Doc.RemoveAll();

                Node = m_Doc.CreateXmlDeclaration("1.0", "utf-8", String.Empty);
                m_Doc.AppendChild(Node);

                Node = m_Doc.CreateComment(String.Format(" ScpControl Configuration Data. {0} ", DateTime.Now));
                m_Doc.AppendChild(Node);

                Node = m_Doc.CreateWhitespace("\r\n");
                m_Doc.AppendChild(Node);

                Node = m_Doc.CreateNode(XmlNodeType.Element, "ScpControl", null);
                {
                    CreateTextNode(Node, "Idle", Idle.ToString());

                    CreateTextNode(Node, "LX", LX.ToString());
                    CreateTextNode(Node, "LY", LY.ToString());
                    CreateTextNode(Node, "RX", RX.ToString());
                    CreateTextNode(Node, "RY", RY.ToString());

                    CreateTextNode(Node, "LED", LED.ToString());
                    CreateTextNode(Node, "Rumble", Rumble.ToString());
                    CreateTextNode(Node, "Triggers", Triggers.ToString());

                    CreateTextNode(Node, "Latency", Latency.ToString());
                    CreateTextNode(Node, "DeadL", DeadL.ToString());
                    CreateTextNode(Node, "DeadR", DeadR.ToString());

                    CreateTextNode(Node, "Native", Native.ToString());
                    CreateTextNode(Node, "SSP", SSP.ToString());

                    CreateTextNode(Node, "Brightness", Brightness.ToString());
                    CreateTextNode(Node, "Bus", Bus.ToString());
                    CreateTextNode(Node, "Force", Repair.ToString());
                }
                m_Doc.AppendChild(Node);

                m_Doc.Save(m_File);
            }
            catch { Saved = false; }

            return(Saved);
        }
Esempio n. 15
0
        // GET: RXes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RX rX = db.RXes.Find(id);

            if (rX == null)
            {
                return(HttpNotFound());
            }
            return(View(rX));
        }
Esempio n. 16
0
        // GET: RXes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RX rX = db.RXes.Find(id);

            if (rX == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PID = new SelectList(db.Patients, "PID", "UserID", rX.PID);
            return(View(rX));
        }
Esempio n. 17
0
        private ListViewItem createListItem(RX rx)//create an item
        {
            ListViewItem item = new ListViewItem();

            item.SubItems.Clear();
            item.SubItems[0].Text = rx[0];
            item.SubItems.Add(rx[1]);
            item.SubItems.Add(rx[2]);
            item.SubItems.Add(rx[3]);
            item.SubItems.Add(rx[4]);
            item.SubItems.Add(rx[5]);
            item.SubItems.Add(rx[0]);
            item.SubItems.Add(rx[0]);
            item.SubItems.Add(rx[0]);
            return(item);
        }
Esempio n. 18
0
        public static IObservable <int> Observable(int count)
        {
            return(RX.Create <int>(observer =>
            {
                var storage = new BehaviorSubject <int>(1);
                var output = RX.Return(0).Concat(storage).Take(count);
                var transfer = output.Zip(storage, (x, y) => x + y);

                return new CompositeDisposable
                {
                    output.Subscribe(observer),
                    transfer.Subscribe(storage),
                    storage
                };
            }));
        }
Esempio n. 19
0
        public Episode(string path)
        {
            FilePath = path;
            var filename = Path.GetFileNameWithoutExtension(path);

            foreach (var RX in Tests)
            {
                if (RX.IsMatch(filename))
                {
                    SeasonNumber  = RX.Match(filename).Groups[1].Value.SmartParse();
                    EpisodeNumber = RX.Match(filename).Groups[2].Value.SmartParse();
                    EpisodeName   = ExtractName();
                    return;
                }
            }
            throw new Exception("Given File is not Valid");
        }
Esempio n. 20
0
        public Data()
        {
            _start    = Properties.Settings.Default.Start;
            _minimize = Properties.Settings.Default.Minimize;
            _noStereo = Properties.Settings.Default.NoStereo;
            _latch    = Properties.Settings.Default.Latch;
            _manual   = Properties.Settings.Default.Manual;

            _devicePort = Properties.Settings.Default.Device;
            _otrspPort  = Properties.Settings.Default.Otrsp;
            _keyerPort  = Properties.Settings.Default.Keyer;

            _rx = (RX)Properties.Settings.Default.RxRadio;
            _tx = (TX)Properties.Settings.Default.TxRadio;

            _ptt = false;
        }
Esempio n. 21
0
        private void ExecuteRXSearchTextCommand(object obj)
        {
            _searchIdxRXStart = RX.IndexOf(_searchRXText, _searchIdxRXStart);

            if (_searchIdxRXStart < 0) //Start again
            {
                _searchIdxRXStart = RX.IndexOf(_searchRXText, 0);
            }

            OnRXTextHighlight(this, _searchIdxRXStart, _searchIdxRXStart + _searchRXText.Length);

            _searchIdxRXStart = _searchIdxRXStart + _searchRXText.Length;
            if (_searchIdxRXStart > RX.Length)
            {
                _searchIdxRXStart = 0;
            }
        }
        private void button1_Click(object sender, EventArgs e) // SAVE_BTN
        {
            RX obj = new RX();

            for (int i = 0; i < this.textBoxArray.Count; i++)
            {
                obj[i] = ((TextBox)this.textBoxArray[i]).Text;
            }

            //obj.Col1 = this.textBox1.Text;
            //obj.Col2 = this.textBox2.Text;
            //obj.Col3 = this.textBox3.Text;
            //obj.Col4 = this.textBox4.Text;
            //obj.Col5 = this.textBox5.Text;
            //obj.Col6 = this.textBox6.Text;
            Event(obj);
            //MessageBox.Show(str);
            //this.Close();
        }
Esempio n. 23
0
        public Subtitle(string path)
        {
            FilePath = path;
            Name     = NameExtractor.GetSubtitleName(Path.GetFileNameWithoutExtension(FilePath));
            if (MovieMode)
            {
                return;
            }
            var filename = Path.GetFileNameWithoutExtension(path);

            foreach (var RX in TV_Renamer_2.Episode.Tests)
            {
                if (RX.IsMatch(filename))
                {
                    SeasonNumber  = int.Parse(RX.Match(filename).Groups[1].Value);
                    EpisodeNumber = int.Parse(RX.Match(filename).Groups[2].Value);
                    return;
                }
            }
            throw new Exception("Given File is not Valid");
        }
Esempio n. 24
0
    static int EntryPoint()
    {
        // Create and start the thread for receiving and parsing the tuple
        RX     rx           = new RX();
        Thread tuple_parser = new Thread(new ThreadStart(rx.parse_rx));

        tuple_parser.Start();

        // Create and start the thread for retrieving the tuple from the CAM
        CAM    cam    = new CAM();
        Thread tupler = new Thread(new ThreadStart(cam.find_tuple));

        tupler.Start();

        while (true)
        {
            Kiwi.Pause();
        }
        ;
        return(0);
    }
Esempio n. 25
0
        static void vJoyDataPack(float ROLL, float PITCH, float YAW, float THROTTLE, Frame thisFrame, Form1 sender)
        {
            //Display raw values
            sender.rollTXT.Text   = ROLL.ToString();
            sender.pitchTXT.Text  = PITCH.ToString();
            sender.yawTXT.Text    = YAW.ToString();
            sender.heightTXT.Text = THROTTLE.ToString();


            //Display raw values
            sender.rollJOY.Text   = RX.ToString();
            sender.pitchJOY.Text  = RY.ToString();
            sender.yawJOY.Text    = X.ToString();
            sender.heightJOY.Text = Y.ToString();

            sender.yawProg.Value    = (int)X;
            sender.rollProg.Value   = (int)RX;
            sender.pitchProg.Value  = (int)RY;
            sender.heightProg.Value = (int)Y;

            HandValue thisHand = new HandValue();

            thisHand.Roll      = RX;
            thisHand.Pitch     = RY;
            thisHand.Yaw       = X;
            thisHand.Height    = Y;
            thisHand.Timestamp = thisFrame.Timestamp;

            myLog.LogHand(thisHand);

            if (sender.chartCheckBox.Checked)
            {
                if ((thisFrame.Id % 3) == 0)
                {
                    myCircularBuff.Add(thisHand);
                }
            }
        }
Esempio n. 26
0
    static int EntryPoint()
    {
        // Create and start the thread for receiving and parsing the tuple
        RX     rx   = new RX();
        Thread rxTh = new Thread(new ThreadStart(rx.start_rx));

        rxTh.Start();

        TIMER  timer   = new TIMER();
        Thread timerTh = new Thread(new ThreadStart(timer.start_timer));

        timerTh.Start();

        TABLES tables = new TABLES();

        tables.reset_tables();
        Thread bw_tmpTh = new Thread(new ThreadStart(tables.update_bw_tmp));

        bw_tmpTh.Start();
        Thread tablesTh = new Thread(new ThreadStart(tables.update_tables));

        tablesTh.Start();

        while (true)
        {
            if (rst | clear)
            {
                timer.reset_timer();
                tables.reset_raw_entry();
                tables.reset_bw_tmp();
                tables.reset_total_entries();
            }
            Kiwi.Pause();
        }
        return(0);
    }
Esempio n. 27
0
        /// <summary>
        /// Figure out actual RX based on RX requested and whether stereo is allowed
        /// </summary>
        private void ComputeRX()
        {
            RX _r     = _rxRequested;
            RX _rxOld = _rx;

            if (_noStereo)
            {
                if ((_r == RX.RX1S) || (_r == RX.RX1R))
                {
                    _r = RX.RX1;
                }

                if ((_r == RX.RX2S) || (_r == RX.RX2R))
                {
                    _r = RX.RX2;
                }
            }

            if ((_rxOld != _r) && (Rx_Changed != null))
            {
                _rx = _r;
                Rx_Changed();
            }
        }
Esempio n. 28
0
        // Hàm của em nó là ở đây. Đừng hỏi vì sao lại thế.

        private void SetText(string text)
        {
            if (this.txtkq.InvokeRequired)
            {
                SetTextCallback d = new SetTextCallback(SetText); // khởi tạo 1 delegate mới gọi đến SetText
                this.Invoke(d, new object[] { text });

                text1 += text;
                if (text1.Contains(STX) && text1.Contains(ETX))
                {
                    try
                    {
                        List <string> testluu = ExtractFromString(text1, STX, ETX);
                        foreach (string RX in testluu)
                        {
                            text1 = text1.Replace(STX + RX + ETX, "");
                            if (RX.Length >= 38)
                            {
                                if (RX.Substring(0, 1).Equals("R"))
                                {
                                    string barcode = RX.Substring(28);

                                    // xử lý lấy chuỗi yêu cầu từ pm
                                    barcode.Trim();
                                    string macode = "";
                                    //tạo chuỗi gửi qua máy au480
                                    s = STX + "S" + RX.Substring(1) + "    E" + macode + ETX;
                                    P.Write(s);
                                    s = "";
                                }
                                //xử lý lưu dữ liệu luu
                                else
                                {
                                    if (RX.Substring(0, 2).Equals("D "))
                                    {
                                        //lstr.Remove(str);
                                        string       pathfilekq = @"D:\testrs232\" + RX.Substring(28, 11) + ".txt";
                                        FileStream   fw         = new FileStream(pathfilekq, FileMode.Create);
                                        StreamWriter swt        = new StreamWriter(fw, Encoding.ASCII);
                                        string       RX1        = RX.Replace("E", "");
                                        RX1 = RX1.Substring(43);
                                        for (int i = 8; i < RX1.Length; i += 11)
                                        {
                                            swt.WriteLine(RX1.Substring(i - 8, 9));
                                            swt.Flush();
                                        }
                                        swt.Close();
                                        fw.Close();
                                        swt.Dispose();
                                        fw.Dispose();
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
            else
            {
                this.txtkq.Text += text;
            }
        }
Esempio n. 29
0
        static void serialCommData_pack(float ROLL, float PITCH, float YAW, float THROTTLE, Frame thisFrame, Form1 sender)
        {
            if (sender.serialPort1.IsOpen)
            {
                //Display raw values
                sender.rollTXT.Text   = ROLL.ToString();
                sender.pitchTXT.Text  = PITCH.ToString();
                sender.yawTXT.Text    = YAW.ToString();
                sender.heightTXT.Text = THROTTLE.ToString();

                //Display raw values
                sender.rollJOY.Text   = RX.ToString();
                sender.pitchJOY.Text  = RY.ToString();
                sender.yawJOY.Text    = X.ToString();
                sender.heightJOY.Text = Y.ToString();

                sender.yawProg.Value    = (int)X;
                sender.rollProg.Value   = (int)RX;
                sender.pitchProg.Value  = (int)RY;
                sender.heightProg.Value = (int)Y;

                HandValue thisHand = new HandValue();
                thisHand.Roll      = RX;
                thisHand.Pitch     = RY;
                thisHand.Yaw       = X;
                thisHand.Height    = Y;
                thisHand.Timestamp = thisFrame.Timestamp;

                if (ball_motion)
                {
                    int Roll_to_send  = (int)(((float)(RX >> 7)) / 1.422f);
                    int Pitch_to_send = (int)(((float)(RY >> 7)) / 1.422f);
                    dataOUT[0]  = (byte)'$';
                    dataOUT[1]  = (byte)'Y';
                    dataOUT[2]  = (byte)(((Roll_to_send % 1000) / 100) + 48);
                    dataOUT[3]  = (byte)(((Roll_to_send % 100) / 10) + 48);
                    dataOUT[4]  = (byte)((Roll_to_send % 10) + 48);
                    dataOUT[5]  = (byte)'#';
                    dataOUT[6]  = (byte)'$';
                    dataOUT[7]  = (byte)'X';
                    dataOUT[8]  = (byte)(((Pitch_to_send % 1000) / 100) + 48);
                    dataOUT[9]  = (byte)(((Pitch_to_send % 100) / 10) + 48);
                    dataOUT[10] = (byte)((Pitch_to_send % 10) + 48);
                    dataOUT[11] = (byte)'#';
                }
                else
                {
                    //scrittura nella seriale
                    dataOUT[0] = (byte)'$';
                    dataOUT[1] = 85;

                    uint Roll_to_send   = (uint)((float)((uint)RX >> 5) / 1.28f); // CH1
                    uint Pitch_to_send  = (uint)((float)((uint)RY >> 5) / 1.28f);
                    uint Height_to_send = (uint)((float)((uint)Y >> 5) / 1.28f);
                    uint Yaw_to_send    = (uint)((float)((uint)X >> 5) / 1.28f);
                    uint arm_disarm     = 800;
                    uint Air_mode       = 0;
                    uint Flight_mode    = (uint)sender.FlightMode;
                    uint CH8            = 0;

                    if (AirMode)
                    {
                        Air_mode = 800;
                    }
                    else
                    {
                        Air_mode = 0;
                    }


                    if (run)
                    {
                        arm_disarm = 0;     // armed
                    }
                    else
                    {
                        arm_disarm = 800;   // disarmed
                    }

                    dataOUT[2]  = (byte)(Roll_to_send >> 2);
                    dataOUT[3]  = (byte)((Roll_to_send << 6) | (Pitch_to_send >> 4));
                    dataOUT[4]  = (byte)((Pitch_to_send << 4) | (Height_to_send >> 6));
                    dataOUT[5]  = (byte)((Height_to_send << 2) | (Yaw_to_send >> 8));
                    dataOUT[6]  = (byte)(Yaw_to_send);
                    dataOUT[7]  = (byte)(arm_disarm >> 2);
                    dataOUT[8]  = (byte)((arm_disarm << 6) | (Air_mode >> 4));
                    dataOUT[9]  = (byte)((Air_mode << 4) | (Flight_mode >> 6));
                    dataOUT[10] = (byte)((Flight_mode << 2) | (CH8 >> 8));
                    dataOUT[11] = (byte)(CH8);
                    dataOUT[12] = (byte)'#';
                }
            }
        }
Esempio n. 30
0
 public IObservable <Tuple <string, Message> > LogRetryErrors(IObservable <Tuple <string, Message> > source)
 {
     return(RX.LogRetryErrors(source, _paxos.Policy.BackoffMaximum, _paxos.Scheduler));
 }