public void ScanDirInfo() { String[] drives = Environment.GetLogicalDrives(); if (File.Exists(drives[drives.Length - 1] + "List.lis")) { string filecontent = WriteDataToFile.ReadFile(drives[drives.Length - 1] + "List.lis"); filecontent = filecontent.Remove(filecontent.Length - 1); string[] ct = filecontent.Split(';'); char[] f1 = ct[0].ToArray(); string[] TaskNames = filecontent.Remove(0, 2).Split(';'); //任务名称集合 int num = Convert.ToInt32(f1[0].ToString() + f1[1].ToString()); //预定任务数量 if (num != ct.Length) { //错误 } WorkingSets.local.refreshTestResults(); foreach (var Tn in TaskNames) { string taskPath = drives[drives.Length - 1] + "\\" + Tn; // int hashcode = UseUpanDoWork.LocalUsb.ReadJob(taskPath + "Jobtask.dat").Information.GetHashCode(); DataRow[] data = Testresultrows(); foreach (var outi in data) { } Insertdatabyupan inser = new Insertdatabyupan(taskPath); inser.InsertUpandatatodatabase(); } } }
public void SaveToFile(DataGridViewRowCollection DataRows) { //WKL.SaveToFile(); WriteDataToFile WDTF1 = new WriteDataToFile(); SaveFileDialog SFD = new SaveFileDialog(); SFD.Filter = "Text files(*.txt)|*.txt|All files(*.*)|*.*"; if (SFD.ShowDialog() == DialogResult.Cancel) { return; } string filename = SFD.FileName; WDTF1.ChooseFile(filename); WDTF1.OpenFile(); foreach (DataGridViewRow Zl in DataRows) { if (Zl.Cells[iTimeColumn].Value != null) { WDTF1.WriteToFile(Zl.Cells[iTimeColumn].Value + "_" + Zl.Cells[idataColumn].Value); } else { WDTF1.WriteToFile(""); } } WDTF1.CloseFile(); }
private void saveimages(string name) { Bitmap bit = new Bitmap(this.Width, this.Height); Graphics g = Graphics.FromImage(bit); g.CopyFromScreen(new Point(this.Location.X + 10, this.Location.Y), new Point(20, 0), bit.Size); if (!Directory.Exists("D:\\waveImage")) { WriteDataToFile.DeelDirectoryInfo("D:\\waveImage", Mode.Create); } bit.Save("D:\\waveImage\\" + name + ".jpg"); g.Dispose(); }
public ConnectVCH308(string Atr) { ComPort = new System.IO.Ports.SerialPort() { DtrEnable = true, RtsEnable = true, PortName = address, BaudRate = 19200 }; //ComPort.Handshake = System.IO.Ports.Handshake.RequestToSend; stopWatch = new Stopwatch(); ComPort.DataReceived += ComPort_DataReceived; Atributes = Atr; wdtf = new WriteDataToFile(); wdtf2 = new WriteDataToFile(); wdtf3 = new WriteDataToFile(); //wdtf.OpenFile }
Quaternion initialCamRot; // holds main camera's initial rotation in scene view #endregion // Use this for initialization void Start() { // button listeners povButton.onClick.AddListener(povClick); emergencyButton.onClick.AddListener(emergencyClick); resetButton.onClick.AddListener(resetClick); // hold main camera's position in scene view initialCamPos = Camera.main.transform.position; initialCamRot = Camera.main.transform.rotation; // Find other external GameObjects agentManager = GameObject.Find("AgentManager").GetComponent <AgentManager>(); eventManager = GameObject.Find("EventManager").GetComponent <EventManager>(); selectedAgent = GameObject.Find("CrowdAgent(Clone)"); writeToFile = GetComponent <WriteDataToFile>(); writeToFile.WriteString(string.Format("Start of scene. Event Time: {0} seconds.", eventManager.getEventTime())); }
public WorkLogic(string FolderPath) { folderPath = FolderPath; MeasTimer = new Timer() { Interval = 1000 }; MeasTimer.Tick += new EventHandler(MeasTimer_Tick); MeasCountTimer = new Timer() { Interval = 1000 }; MeasCountTimer.Tick += new EventHandler(MeasCountTimer_Tick); GlobalTime = new Timer(); GlobalTime.Interval = 1000; GlobalTime.Start(); GlobalTime.Tick += new EventHandler(GTTicTac); WDTF = new WriteDataToFile(); }
//private enum MCEType //{ // msoElementChartTitleNone = 0, // msoElementChartTitleCenteredOverlay = 1, // msoElementChartTitleAboveChart = 2, // msoElementLegendNone = 100, // msoElementLegendRight = 101, // msoElementLegendTop = 102, // msoElementLegendLeft = 103, // msoElementLegendBottom = 104, // msoElementLegendRightOverlay = 105, // msoElementLegendLeftOverlay = 106, // msoElementDataLabelNone = 200, // msoElementDataLabelShow = 201, // msoElementDataLabelCenter = 202, // msoElementDataLabelInsideEnd = 203, // msoElementDataLabelInsideBase = 204, // msoElementDataLabelOutSideEnd = 205, // msoElementDataLabelLeft = 206, // msoElementDataLabelRight = 207, // msoElementDataLabelTop = 208, // msoElementDataLabelBottom = 209, // msoElementDataLabelBestFit = 210, // msoElementPrimaryCategoryAxisTitleNone = 300, // msoElementPrimaryCategoryAxisTitleAdjacentToAxis = 301, // msoElementPrimaryCategoryAxisTitleBelowAxis = 302, // msoElementPrimaryCategoryAxisTitleRotated = 303, // msoElementPrimaryCategoryAxisTitleVertical = 304, // msoElementPrimaryCategoryAxisTitleHorizontal = 305, // msoElementPrimaryValueAxisTitleNone = 306, // msoElementPrimaryValueAxisTitleAdjacentToAxis = 306, // msoElementPrimaryValueAxisTitleBelowAxis = 308, // msoElementPrimaryValueAxisTitleRotated = 309, // msoElementPrimaryValueAxisTitleVertical = 310, // msoElementPrimaryValueAxisTitleHorizontal = 311, // msoElementSecondaryCategoryAxisTitleNone = 312, // msoElementSecondaryCategoryAxisTitleAdjacentToAxis = 313, // msoElementSecondaryCategoryAxisTitleBelowAxis = 314, // msoElementSecondaryCategoryAxisTitleRotated = 315, // msoElementSecondaryCategoryAxisTitleVertical = 316, // msoElementSecondaryCategoryAxisTitleHorizontal = 317, // msoElementSecondaryValueAxisTitleNone = 318, // msoElementSecondaryValueAxisTitleAdjacentToAxis = 319, // msoElementSecondaryValueAxisTitleBelowAxis = 320, // msoElementSecondaryValueAxisTitleRotated = 321, // msoElementSecondaryValueAxisTitleVertical = 322, // msoElementSecondaryValueAxisTitleHorizontal = 323, // msoElementSeriesAxisTitleNone = 324, // msoElementSeriesAxisTitleRotated = 325, // msoElementSeriesAxisTitleVertical = 326, // msoElementSeriesAxisTitleHorizontal = 327, // msoElementPrimaryValueGridLinesNone = 328, // msoElementPrimaryValueGridLinesMinor = 329, // msoElementPrimaryValueGridLinesMajor = 330, // msoElementPrimaryValueGridLinesMinorMajor = 331, // msoElementPrimaryCategoryGridLinesNone = 332, // msoElementPrimaryCategoryGridLinesMinor = 333, // msoElementPrimaryCategoryGridLinesMajor = 334, // msoElementPrimaryCategoryGridLinesMinorMajor = 335, // msoElementSecondaryValueGridLinesNone = 336, // msoElementSecondaryValueGridLinesMinor = 337, // msoElementSecondaryValueGridLinesMajor = 338, // msoElementSecondaryValueGridLinesMinorMajor = 339, // msoElementSecondaryCategoryGridLinesNone = 340, // msoElementSecondaryCategoryGridLinesMinor = 341, // msoElementSecondaryCategoryGridLinesMajor = 342, // msoElementSecondaryCategoryGridLinesMinorMajor = 343, // msoElementSeriesAxisGridLinesNone = 344, // msoElementSeriesAxisGridLinesMinor = 345, // msoElementSeriesAxisGridLinesMajor = 346, // msoElementSeriesAxisGridLinesMinorMajor = 347, // msoElementPrimaryCategoryAxisNone = 348, // msoElementPrimaryCategoryAxisShow = 349, // msoElementPrimaryCategoryAxisWithoutLabels = 350, // msoElementPrimaryCategoryAxisReverse = 351, // msoElementPrimaryValueAxisNone = 352, // msoElementPrimaryValueAxisShow = 353, // msoElementPrimaryValueAxisThousands = 354, // msoElementPrimaryValueAxisMillions = 355, // msoElementPrimaryValueAxisBillions = 356, // msoElementPrimaryValueAxisLogScale = 357, // msoElementSecondaryCategoryAxisNone = 358, // msoElementSecondaryCategoryAxisShow = 359, // msoElementSecondaryCategoryAxisWithoutLabels = 360, // msoElementSecondaryCategoryAxisReverse = 361, // msoElementSecondaryValueAxisNone = 362, // msoElementSecondaryValueAxisShow = 363, // msoElementSecondaryValueAxisThousands = 364, // msoElementSecondaryValueAxisMillions = 365, // msoElementSecondaryValueAxisBillions = 366, // msoElementSecondaryValueAxisLogScale = 367, // msoElementSeriesAxisNone = 368, // msoElementSeriesAxisShow = 369, // msoElementSeriesAxisWithoutLabeling = 370, // msoElementSeriesAxisReverse = 371, // msoElementPrimaryCategoryAxisThousands = 372, // msoElementPrimaryCategoryAxisMillions = 373, // msoElementPrimaryCategoryAxisBillions = 374, // msoElementPrimaryCategoryAxisLogScale = 375, // msoElementSecondaryCategoryAxisThousands = 376, // msoElementSecondaryCategoryAxisMillions = 377, // msoElementSecondaryCategoryAxisBillions = 378, // msoElementSecondaryCategoryAxisLogScale = 379, // msoElementDataTableNone = 500, // msoElementDataTableShow = 501, // msoElementDataTableWithLegendKeys = 502, // msoElementTrendlineNone = 600, // msoElementTrendlineAddLinear = 601, // msoElementTrendlineAddExponential = 602, // msoElementTrendlineAddLinearForecast = 603, // msoElementTrendlineAddTwoPeriodMovingAverage = 604, // msoElementErrorBarNone = 700, // msoElementErrorBarStandardError = 701, // msoElementErrorBarPercentage = 702, // msoElementErrorBarStandardDeviation = 703, // msoElementLineNone = 800, // msoElementLineDropLine = 801, // msoElementLineHiLoLine = 802, // msoElementLineSeriesLine = 803, // msoElementLineDropHiLoLine = 804, // msoElementUpDownBarsNone = 900, // msoElementUpDownBarsShow = 901, // msoElementPlotAreaNone = 1000, // msoElementPlotAreaShow = 1001, // msoElementChartWallNone = 1100, // msoElementChartWallShow = 1101, // msoElementChartFloorNone = 1200, // msoElementChartFloorShow = 1201, //} public void FileToExcel(DataGridViewRowCollection DataRows) { Microsoft.Office.Interop.Excel.Application app; Microsoft.Office.Interop.Excel.Workbook wb; Microsoft.Office.Interop.Excel.Worksheet ws; app = new Microsoft.Office.Interop.Excel.Application() { DisplayAlerts = false }; int er = 0; try { WriteDataToFile WDTF1 = new WriteDataToFile(); //SaveFileDialog SFD = new SaveFileDialog(); //SFD.Filter = "Text files(*.txt)|*.txt|All files(*.*)|*.*"; //if (SFD.ShowDialog() == DialogResult.Cancel) // return; Directory.CreateDirectory(folderPath + "\\Data" + "\\ForExcel"); string filename = folderPath + "\\Data" + "\\ForExcel" + nameFile.Substring(4, nameFile.Length - 4); WDTF1.ChooseFile(filename); WDTF1.OpenFile(false); int N = DataRows.Count; foreach (DataGridViewRow Zl in DataRows) { if (Zl.Cells[iTimeColumn].Value != null) { WDTF1.WriteToFile(Zl.Cells[iTimeColumn].Value + "_" + Zl.Cells[idataColumn].Value); } else { WDTF1.WriteToFile(""); } } WDTF1.CloseFile(); wb = app.Workbooks.Open(filename); ws = wb.ActiveSheet as Microsoft.Office.Interop.Excel.Worksheet; ws.Columns["A:A"].TextToColumns(Destination: ws.Range["A1"], DataType: Microsoft.Office.Interop.Excel.XlTextParsingType.xlDelimited, TextQualifier: Microsoft.Office.Interop.Excel.XlTextQualifier.xlTextQualifierDoubleQuote, ConsecutiveDelimiter: false, Tab: true, Semicolon: false, Comma: false, Space: false, Other: true, OtherChar: "_", FieldInfo: new int[, ] { { 1, 1 }, { 2, 1 } }, TrailingMinusNumbers: true); ws.Columns.AutoFit(); //ws.Range["A1"].Insert(ro ws.Rows["1:1"].Insert(Shift: Microsoft.Office.Interop.Excel.XlDirection.xlDown, CopyOrigin: Microsoft.Office.Interop.Excel.XlInsertFormatOrigin.xlFormatFromLeftOrAbove); er = 1; Microsoft.Office.Interop.Excel.ChartObject ExcelDataChart = (Microsoft.Office.Interop.Excel.ChartObject)ws.ChartObjects().Add(150, 10, 500, 350); er = 2; ExcelDataChart.Chart.ChartType = Microsoft.Office.Interop.Excel.XlChartType.xlXYScatterSmoothNoMarkers; er = 3; ws.Range["B1"].Value2 = "Данные"; er = 4; ExcelDataChart.Chart.SeriesCollection().Add(Source: ws.Range["B2:B" + (N + 1).ToString()]); er = 41; Microsoft.Office.Interop.Excel.Series ser = (Microsoft.Office.Interop.Excel.Series)ExcelDataChart.Chart.SeriesCollection()[1]; er = 5; ws.Range["A1"].Value2 = "Дата/Время"; er = 6; ser.XValues = ws.Range["A2:A" + (N + 1).ToString()]; er = 7; //ser.Format.Line.Weight = 2; //er = 8; //chB.Chart.SeriesCollection(1).Name = "Канал 1" //ExcelDataChart.Chart.SetElement(Microsoft.Office.Core.MsoChartElementType.msoElementPrimaryCategoryGridLinesMajor); //ExcelDataChart.Chart.SetElement(Microsoft.Office.Core.MsoChartElementType.msoElementPrimaryValueGridLinesMajor); ExcelDataChart.Chart.Legend.Delete(); er = 9; //ExcelDataChart.Chart.SetElement (Microsoft.Office.Core.MsoChartElementType.msoElementChartTitleAboveChart); //ExcelDataChart.Chart.ChartTitle.Text = nameFile.Substring(5, nameFile.Length - 5); ExcelDataChart.Chart.Axes(Microsoft.Office.Interop.Excel.XlAxisType.xlCategory).TickLabelPosition = Microsoft.Office.Interop.Excel.XlTickLabelPosition.xlTickLabelPositionLow; er = 10; //ExcelDataChart.Chart.SetElement (Microsoft.Office.Core.MsoChartElementType.msoElementPrimaryValueAxisTitleRotated); //ExcelDataChart.Chart.SetElement (Microsoft.Office.Core.MsoChartElementType.msoElementPrimaryCategoryAxisTitleAdjacentToAxis); ExcelDataChart.Chart.Axes(Microsoft.Office.Interop.Excel.XlAxisType.xlValue).TickLabelPosition = Microsoft.Office.Interop.Excel.XlTickLabelPosition.xlTickLabelPositionLow; er = 11; //ExcelDataChart.Chart.Axes(Microsoft.Office.Interop.Excel.XlAxisType.xlCategory).AxisTitle.Text = "Время"; //ExcelDataChart.Chart.Axes(Microsoft.Office.Interop.Excel.XlAxisType.xlValue).AxisTitle.Text = "Данные"; //ExcelDataChart.Chart.Axes(Microsoft.Office.Interop.Excel.XlAxisType.xlValue).TickLabelPosition = Microsoft.Office.Interop.Excel.XlTickLabelPosition.xlTickLabelPositionLow; ExcelDataChart.Chart.Axes(Microsoft.Office.Interop.Excel.XlAxisType.xlCategory).TickLabels.Orientation = 45; er = 12; app.Visible = true; } catch { System.Windows.Forms.MessageBox.Show("Неудалось открыть Excel" + er.ToString()); return; } }