예제 #1
0
        private void BTN_Add_Click(object sender, EventArgs e)
        {
            RelationalItem ri = new RelationalItem(this, cycles, tempKey, timeKey, probeAmtKey, doneKey, powKey, cpltKey, relationalItems.Count);

            relationalItems.Add(ri);
            ReSort();
            PAN_Steps.ScrollControlIntoView(ri);
        }
예제 #2
0
        private void BTN_Import_Click(object sender, EventArgs e)
        {
            string mes = TB_Import.Text.ToUpper().Replace(".", "").Replace(",", "");

            try
            {
                mes          = mes.Substring(mes.IndexOf("FE010001FD020001"));
                mes          = mes.Substring(mes.IndexOf("FE020003") + 8);
                TB_Name.Text = HextoString(mes);
                if (mes.IndexOf("02030008") > 0)
                {
                    mes         = mes.Substring(mes.IndexOf("02030008") + 8);
                    TB_URL.Text = HextoString(mes);
                }
                mes = mes.Substring(mes.IndexOf("FE020001") + 8);
                mes = mes.Replace("FE020001", "~");

                PAN_Steps.Controls.Clear();
                relationalItems.Clear();

                string[] steps = mes.Split('~');
                for (int i = 0; i < steps.Length; i++)
                {
                    int       cidx  = -1;
                    string [] msg   = new string[10];
                    string    temp  = "";
                    string    time  = "";
                    string    zone  = "";
                    string    probe = "";
                    //string pow = "";
                    //string done = "";
                    int eidx = -1;

                    steps[i] = steps[i].Substring(8);
                    steps[i] = steps[i].Substring(0, steps[i].IndexOf("FE020002"));
                    while (steps[i].Length > 0)
                    {
                        string key = steps[i].Substring(0, 8);
                        steps[i] = steps[i].Substring(8);
                        if (key == tempKey)
                        {
                            temp     = Cx10toF(int.Parse(steps[i].Substring(0, 4), NumberStyles.AllowHexSpecifier)).ToString();
                            steps[i] = steps[i].Substring(4);
                        }
                        if (key == powKey)
                        {
                            temp     = (int.Parse(steps[i].Substring(0, 2), NumberStyles.AllowHexSpecifier)).ToString();
                            steps[i] = steps[i].Substring(2);
                        }
                        if (key == doneKey)
                        {
                            zone     = (int.Parse(steps[i].Substring(0, 2), NumberStyles.AllowHexSpecifier)).ToString();
                            steps[i] = steps[i].Substring(2);
                        }
                        if (key == timeKey)
                        {
                            time     = (int.Parse(steps[i].Substring(0, 8), NumberStyles.AllowHexSpecifier) / 60).ToString();
                            steps[i] = steps[i].Substring(8);
                        }
                        if (key == probeAmtKey)
                        {
                            if (doneKey == "")
                            {
                                probe    = (int.Parse(steps[i].Substring(0, 4), NumberStyles.AllowHexSpecifier)).ToString();
                                steps[i] = steps[i].Substring(4);
                            }
                            else
                            {
                                probe    = Cx10toF(int.Parse(steps[i].Substring(0, 4), NumberStyles.AllowHexSpecifier)).ToString();
                                steps[i] = steps[i].Substring(4);
                            }
                        }
                        if (key == "02030009" || key == "0203000B" || key == parent.v1msgKey || key == parent.v2msgKey)
                        {
                            string hexmsg = steps[i].Substring(0, steps[i].IndexOf("00") + 2);
                            if (hexmsg.Length % 2 != 0)//in case the last character ends in 0
                            {
                                hexmsg = steps[i].Substring(0, steps[i].IndexOf("00") + 3);
                            }

                            string ms = HextoString(hexmsg);
                            if (key == "0203000B" || key == parent.v2msgKey)
                            {
                                string[] parts = ms.Split(',');
                                msg[int.Parse(parts[0])] = parts[1];
                                //zone = parts[0];
                            }
                            else
                            {
                                msg[0] = ms;
                            }
                            steps[i] = steps[i].Substring(hexmsg.Length);
                        }
                        if (key == cpltKey.KeyID)
                        {
                            eidx     = int.Parse(steps[i].Substring(0, 2), NumberStyles.AllowHexSpecifier);
                            steps[i] = steps[i].Substring(2);
                        }
                        if (cyclekeys.Contains(key))
                        {
                            for (int j = 0; j < cycles.Count; j++)
                            {
                                if (key == cycles[j].KeyID && steps[i].Substring(0, 2) == cycles[j].Enum.ToString("X2"))
                                {
                                    cidx = j;
                                    break;
                                }
                            }
                            steps[i] = steps[i].Substring(2);
                        }
                    }
                    this.BTN_Add_Click(this, null);
                    this.relationalItems[relationalItems.Count - 1].SetAttributes(cidx, msg, temp, time, probe, eidx, zone);
                }
                PAN_Steps.ScrollControlIntoView(relationalItems[0]);
            }
            catch
            {
                MessageBox.Show("Specified input is not a recognized relational cycle for the selected platform/cavity.");
            }
        }