public static void import(string file_path
                           , ref List <DetectorReportData> report_data
                           , ref List <string> report_dataString)
 {
     try
     {
         List <string> readedData = TheTool.read_File_getListString(file_path);
         //TheSys.showError(readedData.Count + " : " + file_path);
         report_data       = new List <DetectorReportData> {
         };
         report_dataString = new List <string> {
         };
         int i = 0;
         DetectorReportData d;
         foreach (string a in readedData)
         {
             if (i > 0)
             {
                 report_dataString.Add(a);
                 //-----------------
                 d = new DetectorReportData();
                 string[] b = a.Split(',');
                 d.time       = b[0];
                 d.flag_move  = int.Parse(b[1]);
                 d.flag_pitch = int.Parse(b[2]);
                 d.flag_twist = int.Parse(b[3]);
                 d.flag_stand = int.Parse(b[4]);
                 //
                 d.flag_break = int.Parse(b[5]);
                 d.prolong_lv = int.Parse(b[6]);
                 d.pitch_lv   = int.Parse(b[7]);
                 d.twist_lv   = int.Parse(b[8]);
                 d.total_lv   = double.Parse(b[9]);
                 //
                 d.prolong_score = int.Parse(b[10]);
                 d.pitch_score   = int.Parse(b[11]);
                 d.twist_score   = int.Parse(b[12]);
                 d.total_score   = int.Parse(b[13]);
                 d.state         = b[14];
                 //
                 report_data.Add(d);
             }
             i++;//Skip Header
         }
     }
     catch (Exception e)
     {
         TheSys.showError("import:" + e.Message, true);
     }
 }
Exemple #2
0
        public void draw()
        {
            try
            {
                using (DrawingContext dc = this.drawingGroup.Open())
                {
                    if (data_count > 0)
                    {
                        dc.DrawRectangle(Brushes.Black, null, new System.Windows.Rect(0.0, 0.0, 1000, 450));
                        drawTextLabel_FixSet(dc);
                        drawTextFrameRate(dc);
                        Boolean afterBreak = true;
                        //--------------------------------------
                        int size_x1        = 22;
                        int size_x1_half   = size_x1 / 2;
                        int size_x1_e      = size_x1 + 3;//wioth border/edge
                        int size_x1_e_half = size_x1_e / 2;
                        int size_y0        = 200;
                        int size_y1        = 27;

                        //--------
                        int x_temp; int y_temp;
                        int x1;
                        int y0;
                        int y1; int y2; int y3; int y4;
                        int y0_f; int y1_f; int y2_f; int y3_f;
                        int y_diff_0_1;
                        x1         = 150;
                        y0         = 60; y1 = 265; y2 = 295; y3 = 325; y4 = 375;
                        y0_f       = y0 + size_y0; y1_f = y1 + size_y1; y2_f = y2 + size_y1; y3_f = y3 + size_y1;
                        y_diff_0_1 = y1 - y0;

                        int   y_map;
                        Point line_p2 = new Point(x1, y0_f); Point line_p1 = line_p2;
                        Point line1_p2 = new Point(x1, y1_f); Point line1_p1 = line1_p2;
                        Point line2_p2 = new Point(x1, y2_f); Point line2_p1 = line2_p2;
                        Point line3_p2 = new Point(x1, y3_f); Point line3_p1 = line3_p2;

                        Brush brush_1      = Brushes.DarkMagenta;
                        Pen   drawingPen_1 = new Pen(brush_1, 2);
                        Brush brush_2      = Brushes.Orange;
                        Pen   drawingPen_2 = new Pen(brush_2, 2);

                        Pen             drawingPen_headText = new Pen(Brushes.White, 3);
                        SolidColorBrush sb0 = new SolidColorBrush(Color.FromArgb(255, 125, 125, 125));
                        SolidColorBrush sb1; SolidColorBrush sb2; SolidColorBrush sb3; SolidColorBrush sb4;


                        for (int i = 0; i < data_count; i++)
                        {
                            DetectorReportData data = report_data_35List_array[i];
                            //-- Head Text --------------
                            if (i % 6 == 0)
                            {
                                dc.DrawLine(drawingPen_headText, new Point(x1, y0 - 10), new Point(x1, y0 + 10));
                                drawTextLabel(dc, data.time, x1, y0 - 30);
                            }
                            //-- BG Color ------------------------
                            if (data.flag_break != 1)
                            {
                                sb1 = getBrush_byHRL_xlv(data.total_lv);
                                sb2 = getBrush_byHRL_3lv(data.twist_lv);
                                sb3 = getBrush_byHRL_3lv(data.pitch_lv);
                                sb4 = getBrush_byHRL_3lv(data.prolong_lv);
                            }
                            else
                            {
                                sb1 = sb0; sb2 = sb0; sb3 = sb0; sb4 = sb0;
                            }
                            dc.DrawRectangle(sb1, null, new System.Windows.Rect(x1, y0, size_x1, size_y0));
                            dc.DrawRectangle(sb2, null, new System.Windows.Rect(x1, y1, size_x1, size_y1));
                            dc.DrawRectangle(sb3, null, new System.Windows.Rect(x1, y2, size_x1, size_y1));
                            dc.DrawRectangle(sb4, null, new System.Windows.Rect(x1, y3, size_x1, size_y1));
                            //-------------------------------
                            x_temp = x1 + size_x1_e_half;
                            y_temp = y4;
                            //---------------------------------
                            if (data.flag_break == 0)
                            {
                                //--- Line  -----------------------
                                y_map = mapPosition(data.total_score, 100, y0, y0_f);
                                drawLine(dc, drawingPen_1, brush_1, ref line_p1, ref line_p2, x_temp, y_map, afterBreak);
                                if (checkChangeInData(i, 0) || afterBreak)
                                {
                                    dc.DrawEllipse(brush_1, null, line_p2, 4, 4);
                                }
                                //
                                if (checkLine.IsChecked.Value)
                                {
                                    y_map = mapPosition(data.twist_score, 60, y1, y1_f);
                                    drawLine(dc, drawingPen_2, brush_2, ref line1_p1, ref line1_p2, x_temp, y_map, afterBreak);
                                    if (checkChangeInData(i, 1) || afterBreak)
                                    {
                                        dc.DrawEllipse(brush_2, null, line1_p2, 4, 4);
                                    }                                                                                                                                //----
                                    //
                                    y_map = mapPosition(data.pitch_score, 60, y2, y2_f);
                                    drawLine(dc, drawingPen_2, brush_2, ref line2_p1, ref line2_p2, x_temp, y_map, afterBreak);
                                    if (checkChangeInData(i, 2) || afterBreak)
                                    {
                                        dc.DrawEllipse(brush_2, null, line2_p2, 4, 4);
                                    }                                                                                                                                //----
                                    //
                                    y_map = mapPosition(data.prolong_score, 240, y3, y3_f);
                                    drawLine(dc, drawingPen_2, brush_2, ref line3_p1, ref line3_p2, x_temp, y_map, afterBreak);
                                    if (checkChangeInData(i, 3) || afterBreak)
                                    {
                                        dc.DrawEllipse(brush_2, null, line3_p2, 4, 4);
                                    }
                                }
                                //--- First Icon -------------------
                                if (data.flag_stand == 1)
                                {
                                    drawIcon(dc, 9, x_temp, y_temp); y_temp += 25;
                                    if (data.flag_move == 1)
                                    {
                                        drawIcon(dc, 12, x_temp, y_temp); y_temp += 25;
                                    }
                                }
                                else
                                {
                                    if (data.flag_move == 1)
                                    {
                                        drawIcon(dc, 12, x_temp, y_temp); y_temp += 25;
                                    }
                                    else
                                    {
                                        if (data.flag_pitch == 1)
                                        {
                                            drawIcon(dc, 11, x_temp, y_temp); y_temp += 25;
                                        }
                                        if (data.flag_twist == 1)
                                        {
                                            drawIcon(dc, 21, x_temp - 5, y_temp); y_temp += 25;
                                        }
                                        if (data.flag_twist == -1)
                                        {
                                            drawIcon(dc, 22, x_temp + 5, y_temp); y_temp += 25;
                                        }
                                    }
                                }
                                afterBreak = false;
                            }
                            else
                            {
                                if (afterBreak == false)
                                {
                                    drawLine_endBreak(dc, drawingPen_1, line_p2, size_x1_e_half);
                                    if (checkLine.IsChecked.Value)
                                    {
                                        drawLine_endBreak(dc, drawingPen_2, line1_p2, 10);
                                        drawLine_endBreak(dc, drawingPen_2, line2_p2, 10);
                                        drawLine_endBreak(dc, drawingPen_2, line3_p2, 10);
                                    }
                                }
                                afterBreak = true;
                            }
                            //-------------------
                            x1 += size_x1 + 2;
                        }
                        //---- Draw Line End for the last record -----
                        drawLine_endBreak(dc, drawingPen_1, line_p2, size_x1_e_half);
                        if (checkLine.IsChecked.Value)
                        {
                            drawLine_endBreak(dc, drawingPen_2, line1_p2, 10);
                            drawLine_endBreak(dc, drawingPen_2, line2_p2, 10);
                            drawLine_endBreak(dc, drawingPen_2, line3_p2, 10);
                        }
                    }
                }
            }
            catch //(Exception ex)
            {
                //TheSys.showError("Draw:" + ex.Message);
            }
        }