private void Btn_toExcel_Click(object sender, EventArgs e)
        {
            string pathsave = "";

            try
            {
                System.Windows.Forms.SaveFileDialog saveFileDialog = new SaveFileDialog();

                saveFileDialog.Title      = "Browse Excel Files";
                saveFileDialog.DefaultExt = "Excel";
                saveFileDialog.Filter     = "Excel files (*.xls)|*.xls";

                saveFileDialog.CheckPathExists = true;

                if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    pathsave = saveFileDialog.FileName.Split('.')[0];

                    saveFileDialog.RestoreDirectory = true;
                    ToolSupport tool = new ToolSupport();
                    tool.dtgvExport2Excel(dtgv_show, pathsave + "-" + DateTime.Now.ToString("yyyyMMdd HHmmss") + ".xls");
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void Btn_toExcel_Click(object sender, EventArgs e)
        {
            if (File.Exists(path) != true)
            {
                MessageBox.Show("File  Export Excel Template don't exists ");
                return;
            }
            string pathsave = "";

            try
            {
                System.Windows.Forms.SaveFileDialog saveFileDialog = new SaveFileDialog();

                saveFileDialog.Title      = "Browse Excel Files";
                saveFileDialog.DefaultExt = "Excel";
                saveFileDialog.Filter     = "Excel files (*.xls)|*.xls";

                //   saveFileDialog.CheckPathExists = true;

                if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    pathsave = saveFileDialog.FileName.Split('.')[0];

                    saveFileDialog.RestoreDirectory = true;
                    ToolSupport tool       = new ToolSupport();
                    string      strUser    = Class.valiballecommon.GetStorage().UserName;
                    string      strVersion = Class.valiballecommon.GetStorage()._version;
                    //  tool.dtgvExport2Excel(dgv_show, pathsave + "-" + DateTime.Now.ToString("yyyyMMdd HHmmss") + ".xls");
                    tool.editexcelshipping(DateTime.Now.ToString("yyyy-MM-dd"), strUser, strVersion, DateTime.Now.ToString("yyyy"), dgv_show, pathsave + "-" + DateTime.Now.ToString("yyyyMMdd HHmmss") + ".xls", path);
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Chạy lần lượt tất cả các Job
        /// Chuẩn bị Update: Chạy lần lượt Job theo Mode?
        /// Hiện tại sử dụng đầu vào Camera
        /// </summary>
        /// <returns></returns>
        public string RunJob()
        {
            string returnString       = "";
            CogTransform2DLinear temp = null;

            if (toolBlockEdit.Subject != null)
            {
                toolBlockEdit.Subject.Run();
            }
            if (toolGroupEdit.Subject != null)
            {
                toolGroupEdit.Subject.Run();
            }
            if (ImageFileTool != null)
            {
                ImageFileTool.Run();
            }
            if (acqFifoTool.Subject != null)
            {
                acqFifoTool.Subject.Run();
            }
            if (!calibGribCBTool.Subject.Calibration.Calibrated)
            {
                MessageBox.Show("Image Not Calibration!!!");
            }
            else
            {
                calibGribCBTool.Subject.Run();
            }
            if (pmAlignTool.Subject != null)
            {
                pmAlignTool.Subject.Run();
            }
            if (pmAlignTool.Subject.Results.Count > 0)
            {
                temp = pmAlignTool.Subject.Results[0].GetPose();
            }
            if (temp != null)
            {
                foreach (var item in pmAlignTool.Subject.Results)
                {
                    temp          = (item as CogPMAlignResult).GetPose();
                    returnString += $"X : {temp.TranslationX.ToString("0.00")} - Y : {temp.TranslationY.ToString("0.00")} - Angle : {(temp.Rotation * 180 / Math.PI).ToString("0.00")}\r\n";
                }
                //return ($"X : {temp.TranslationX.ToString("0.00")} - Y : {temp.TranslationY.ToString("0.00")} - Angle : {(temp.Rotation * 180 / Math.PI).ToString("0.00")}");

                // Input pattern to Array
                listPatterns = new patternObject[20];
                for (int i = 0; i < listPatterns.Length; i++)
                {
                    listPatterns[i] = new patternObject();
                }

                int index = 0;
                foreach (var item in PMAlignTool.Subject.Results)
                {
                    var tempResult = item as CogPMAlignResult;
                    listPatterns[index] = new patternObject {
                        X = tempResult.GetPose().TranslationX, Y = tempResult.GetPose().TranslationY, Angle = tempResult.GetPose().Rotation * 180 / Math.PI
                    };
                    index += 1;
                }

                listPatterns = ToolSupport.SortPatterns(listPatterns);

                // In ra màn hình list Pattern
                foreach (var item in listPatterns)
                {
                    Console.WriteLine($"X: {item.X} Y: {item.Y} Angle: {item.Angle}");
                }

                return(returnString);
            }

            return("Fail");
        }
        private void Btn_toExcel_Click(object sender, EventArgs e)
        {
            ToolSupport tool = new ToolSupport();

            tool.dtgvExport2Excel(dgv_show, PathFoler + DateTime.Now.ToString("yyyyMMdd HHmmss") + ".xls");
        }