private void BtnSave_Click(object sender, RoutedEventArgs e) { if (bmpMain == null) { MessageBox.Show("No image loaded.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } SaveFileDialog svf = new SaveFileDialog { InitialDirectory = Environment.CurrentDirectory, Title = "Save Image as...", Filter = "Bitmap (*.bmp)|*.bmp", ValidateNames = true, AddExtension = true }; if (svf.ShowDialog() == false) { TxtLog.AppendText("\nImage not saved.\n"); return; } bmpMain.Save(svf.FileName, ImageFormat.Bmp); TxtLog.AppendText("\n" + svf.FileName + " written.\n"); }
private void BtnLoad_Click(object sender, RoutedEventArgs e) { OpenFileDialog opf = new OpenFileDialog { InitialDirectory = Environment.CurrentDirectory, Title = "Open Image from...", Filter = "Bitmap (*.bmp)|*.bmp|JPEG Image (*.jpg)|*.jpg|PNG Image (*.png)|*.png", AddExtension = true, ValidateNames = true, CheckPathExists = true, Multiselect = false }; if (opf.ShowDialog() == false) { TxtLog.AppendText("\nImage not loaded.\n"); return; } bmpMain = new Bitmap(opf.FileName); TxtLog.AppendText("\nImage loaded from " + opf.FileName + ".\n"); TxtLog.AppendText("Image size: " + bmpMain.Size.ToString() + ".\n"); TxtLog.AppendText("Pixel format: " + bmpMain.PixelFormat + ".\n"); UpdateImg(); }
private void FileWorkerWorkCompleted(object sender, EventArgs e) { TxtLog.AppendText(DateTime.Now + "\tEnd.\r\n"); TxtLog.ScrollToEnd(); BtnStart.IsEnabled = true; logList.Add(_dtoLog); Dispatcher.Invoke(new Action(SetServiceLabels)); }
private void VypisTimer_Tick(object sender, EventArgs e) { TxtLog.Clear(); foreach (string a in ServerLog.VratS()) { TxtLog.AppendText(a + Environment.NewLine); } }
////////////////////////////////////////////////////////////////////////// private void OnAddLog(object sender, AddLogEventArgs e) { TxtLog.SelectionLength = 0; TxtLog.AppendText(e.Message.Replace("\n", "\r\n")); TxtLog.SelectionStart = TxtLog.Text.Length; TxtLog.SelectionLength = 0; TxtLog.ScrollToCaret(); }
/// <summary> /// Appends the given string to the on-screen log, and the debug console. /// </summary> /// <param name="output">string to be appended</param> private async Task OutputAsync(string output) { await Dispatcher.InvokeAsync(() => { TxtLog.AppendText(output + Environment.NewLine); TxtLog.ScrollToEnd(); }); Console.WriteLine(output); }
public void AddLogLine(string logLine) { if (TxtLog != null && !TxtLog.IsDisposed) { TxtLog.AppendText(logLine.EndsWith(Environment.NewLine) ? logLine : (logLine + Environment.NewLine)); if (!CkAutoScroll.Checked) { TxtLog.ScrollToCaret(); } } }
private void Logger_Logged(object sender, LoggedArgs e) { lock (_syncLock) { Application.Current.Dispatcher.Invoke(() => { TxtLog.AppendText(e.Message); TxtScrollViewer.ScrollToEnd(); }, System.Windows.Threading.DispatcherPriority.Render); } }
private void UpdateLog(string text) { var message = "[ " + DateTime.Now.ToString() + " ]: " + text + "\r\n"; TxtLog.AppendText(message); if (TxtLog.Text.Length > 100000) { TxtLog.Text.Remove(0, 20000); } TxtLog.ScrollToEnd(); }
private void HandleErrorDataReceived(object sender, DataReceivedEventArgs e) { if (String.IsNullOrEmpty(e.Data)) { return; } this.BeginInvoke(new Action(() => { TxtLog.AppendText(e.Data + "\r\n"); })); }
public void Init() { // 至少提供下面的四个参数 _client = new AuthingClient(new AuthingClientOptions() { AppId = "5e72d72e3798fb03e1d57b13", AppDomain = "authing-net-sdk-demo.authing.cn", RedirectUri = "https://authing.cn/guide/oidc/callback", PostLogoutRedirectUri = "https://authing.cn/guide/oidc/callback", }); print = (str) => TxtLog.AppendText(str + "\r\n"); clear = () => TxtLog.Clear(); }
private void GenerateMetStationDetailToolStripMenuItem_Click(object sender, EventArgs e) { try { GenerateRowsOfSubbasinDetail(); TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Met Station Detail Table Generated Successfully"); TxtLog.AppendText(Environment.NewLine); TxtLog.AppendText("-------------------------------------------------------------------------------"); TxtLog.AppendText(Environment.NewLine); } catch { } }
private void CalcSubbasinWiseDataToolStripMenuItem_Click(object sender, EventArgs e) { try { Calculate_SubbasinWise_Data_Using_Thiessen_Poly(); TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Calculating Subbasin wise data using Theissen completed Successfully"); TxtLog.AppendText(Environment.NewLine); TxtLog.AppendText("-------------------------------------------------------------------------------"); TxtLog.AppendText(Environment.NewLine); } catch { } }
private void YearwiseToMetStWiseDataToolStripMenuItem_Click(object sender, EventArgs e) { try { Transform_Yearwiswe_to_MetStWise(); TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Transformation of Yearwise to Met Station wise data completed Successfully"); TxtLog.AppendText(Environment.NewLine); TxtLog.AppendText("-------------------------------------------------------------------------------"); TxtLog.AppendText(Environment.NewLine); } catch { } }
private void GenerateSubbasinTableToolStripMenuItem_Click(object sender, EventArgs e) { try { GenerateSubbasinWiseData_Column(); TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Subbasin Table Generated Successfully"); TxtLog.AppendText(Environment.NewLine); TxtLog.AppendText("-------------------------------------------------------------------------------"); TxtLog.AppendText(Environment.NewLine); } catch { } }
private void GenerateMetStWiseDataTableToolStripMenuItem_Click(object sender, EventArgs e) { try { GenerateColumnsOfMetStWiseTable(); TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Met Station wise Year Data Table Generated Successfully"); TxtLog.AppendText(Environment.NewLine); TxtLog.AppendText("-------------------------------------------------------------------------------"); TxtLog.AppendText(Environment.NewLine); } catch { } }
private void FindUniqueMetStationToolStripMenuItem_Click(object sender, EventArgs e) { try { GetUniqueMetStation(); TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Unique Met Station Found Successfully"); TxtLog.AppendText(Environment.NewLine); TxtLog.AppendText("-------------------------------------------------------------------------------"); TxtLog.AppendText(Environment.NewLine); } catch { } }
private void ImportUniqueMetStationToolStripMenuItem_Click(object sender, EventArgs e) { int TotalNumberofDailyData = 366; int i, rowIndex = 0; string FolderPath = TxtFolderPath.Text; bool FileFound; //string path = @"F:\AY\VS_2017\C#\ReadFromExcel\ReadFromExcel\Example1.xlsx"; //string[] filePaths = Directory.GetFiles(@"c:\1A\", "*.xls", SearchOption.AllDirectories); string[] filePaths = Directory.GetFiles(FolderPath + "\\", "*.csv", SearchOption.AllDirectories); foreach (string files in filePaths) { FileFound = false; for (int fl = 0; fl < Unique_Met_st; fl++) { if (files == (FolderPath + "\\" + Met_St_Name_Unique[fl] + ".csv")) { FileFound = true; } } if (FileFound == true) { string[] lines = System.IO.File.ReadAllLines(files); for (i = 1; i <= TotalNumberofDailyData; i++) //row; i=0 is header in *.csv file { string[] rowdata = lines[i].Split(','); for (int onecolindex = 0; onecolindex < Year_No; onecolindex++) { //MessageBox.Show((rowIndex + i - 1).ToString() + " ; " + (onecolindex + 2).ToString() // + " ; " + rowdata[onecolindex]); dataGridView2.Rows[rowIndex + i - 1].Cells[onecolindex + 2].Value = rowdata[onecolindex]; } } rowIndex += 366; } } //MessageBox.Show("Import Completed Successfully"); TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Met Station Data Import Completed Successfully"); TxtLog.AppendText(Environment.NewLine); TxtLog.AppendText("-------------------------------------------------------------------------------"); TxtLog.AppendText(Environment.NewLine); }
private void BtnAcquire_Click(object sender, RoutedEventArgs e) { CamCtrl cam = new CamCtrl( str => { TxtLog.AppendText(str); }); // Default given example //cam.AcquisitionExample(); // Retrieve a BW image and display it accordingly IManagedImage result = cam.RetrieveMonoImage(); if (result != null) { bmpMain = result.bitmap; //PixelFormat: Format8bppIndexed } UpdateImg(); }
public MainWindow() { InitializeComponent(); TxtLog.Document.Blocks.Clear(); _timer.Interval = TimeSpan.FromMilliseconds(250); _timer.Tick += (o, e) => { _timer.Stop(); Stopwatch stopwatch = Stopwatch.StartNew(); ViewModel.FilterBusinessDataView(TxtFilter.Text); stopwatch.Stop(); TxtLog.AppendText($"DG filter: {stopwatch.Elapsed.TotalMilliseconds}ms\r"); }; this.DataContext = ViewModel; ViewModel.UpdateViewModel(BusinessData.UsefulDataList); }
private void BtnQuantize_Click(object sender, RoutedEventArgs e) { if (bmpMain == null) { MessageBox.Show("No image loaded.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } const int bytePerPx = 1; // 8-bit color depth, Mono 8 palette int imgByteSize = bytePerPx * bmpMain.Height * bmpMain.Width; byte[] pxArr = new byte[imgByteSize]; using (MemoryStream imgdata = new MemoryStream()) { byte[] buff32 = new byte[4]; ImgProc imgProc = new ImgProc( // Initialize image processor str => { TxtLog.AppendText(str); }, new Tuple <int, int>(bmpMain.Width, bmpMain.Height), // pxDimens (H,V) new Tuple <double, double>(6.86, 3.62), // Image AoVs (H,V) bytePerPx, imgByteSize ); bmpMain.Save(imgdata, ImageFormat.Bmp); imgdata.Seek(10, SeekOrigin.Begin); // Find out Pixel Array's offset imgdata.Read(buff32, 0, 4); uint pxArrOfs = BitConverter.ToUInt32(buff32, 0); imgdata.Seek(pxArrOfs, SeekOrigin.Begin); // Jump to Pixel Array imgdata.Read(pxArr, 0, imgByteSize); // Read Pixel Array data imgProc.QuantizePixels(pxArr); // Quantize the pixels imgdata.Seek(pxArrOfs, SeekOrigin.Begin); // Jump to Pixel Array imgdata.Write(pxArr, 0, imgByteSize); // Write data back to stream bmpMain = new Bitmap(imgdata); // Generate new image based on updated stream UpdateImg(); } }
private void AppendLogToUI(string format, params object[] args) { try { Invoke(new MethodInvoker(delegate { try { int iMax = 10000; TxtLog.AppendText((TxtLog.TextLength > 0 ? Environment.NewLine : null) + ((args?.Length ?? 0) < 1 ? format : string.Format(format, args))); if (TxtLog.TextLength > iMax) { TxtLog.Text = TxtLog.Text.Substring(TxtLog.Text.Length - iMax); } TxtLog.SelectionStart = TxtLog.TextLength; TxtLog.ScrollToCaret(); } catch (Exception ex2) { Logger?.Error(ex2); } })); } catch (Exception ex) { Logger?.Error(ex); } }
private void timer1_Tick(object sender, EventArgs e) { if (found) { TxtLog.Lines = TxtLog.Lines.Take(TxtLog.Lines.Length - 2).ToArray(); found = false; TxtLog.AppendText("\nPassword found! --> " + str2); MessageBox.Show("Password found! ---> " + str2 + "\n\nUnzipped file at: " + caminho, "Password found!", MessageBoxButtons.OK, MessageBoxIcon.Information); LblStatus.Text = "Status: Password Broken --> " + str2; PicClipboard.Visible = true; PicClear.Visible = true; } if (error) { TxtLog.AppendText("Wrong password --> " + str2 + "\n"); progressBar1.Value = progressBar1.Value + 1; error = false; } if (Nda) { Nda = false; LblStatus.Text = "Status: Password was not found."; int max = progressBar1.Maximum; int atual = progressBar1.Value; int conta = max - atual; progressBar1.Value = atual + conta; PicClear.Visible = true; MessageBox.Show("Password was not found in the wordlist :(", "Attention!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (done) { if (Thrd) { LblStatus.Text = ""; Thrd = false; } } }
private void SetWorkerThreads() { string searchPath; if (RadioBtnHdd.IsChecked.Value) { searchPath = "HD"; } else if (!string.IsNullOrEmpty(_chosenSearchPath)) { searchPath = _chosenSearchPath; } else { MessageBox.Show("Choose Search Path."); return; } BtnStart.IsEnabled = false; TxtLog.AppendText(DateTime.Now + "\tStarted.\r\n"); GeneratPayloadString(); var dtoLog = new DtoLog { CreateDateTime = DateTime.Now, Payload = _payLoad, SearchPath = searchPath, Source = "App" }; new BoLog().Save(dtoLog); _dtoLog = dtoLog; _searchPath = searchPath; var backgroundWorker = new BackgroundWorker(); backgroundWorker.DoWork += (s, eventArgs) => { userSettings.SearchPath = searchPath; _boUserSettings.Save(userSettings); _windowsRegistryManager.GenerateNewRegistryKeys(userSettings.SelectedFileExtensionList, ref dtoLog); }; backgroundWorker.RunWorkerCompleted += WindowsRegistryManagerWorkCompleted; backgroundWorker.RunWorkerAsync(); }
private void LogChanges(string logEntry, LogType logType) { Dispatcher.Invoke(new Action(() => { string color; switch (logType) { case LogType.Success: color = "green"; break; case LogType.Error: color = "red"; break; default: color = "white"; break; } TxtLog.AppendText(DateTime.Now + "\t" + logEntry + "\r\n", color); TxtLog.ScrollToEnd(); })); }
private void WriteLogToUI(string format, params object[] args) { try { if (IsExit) { return; } Invoke(new MethodInvoker(delegate { try { int iMax = 100000; char[] cArrayTrim = { ' ', '\t', (char)10, (char)13 }; string s = (args?.Length ?? 0) < 1 ? format : string.Format(format, args); TxtLog.AppendText(s.Trim(cArrayTrim) + Environment.NewLine); if (TxtLog.TextLength > iMax) { TxtLog.Text = TxtLog.Text.Substring(TxtLog.Text.Length - iMax); } TxtLog.SelectionStart = TxtLog.TextLength; TxtLog.ScrollToCaret(); } catch (Exception ex2) { try { Logger?.Error(ex2); } catch (Exception ex3) { Console.WriteLine("[error] {0}.{1}. {2}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name, System.Reflection.MethodBase.GetCurrentMethod().Name, ex3.Message); } } })); } catch (Exception ex) { try { Logger?.Error(ex); } catch (Exception ex4) { Console.WriteLine("[error] {0}.{1}. {2}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name, System.Reflection.MethodBase.GetCurrentMethod().Name, ex4.Message); } } }
public void ShowLog(string inf) { TxtLog.AppendText(inf); TxtLog.ScrollToEnd(); }
void WriteLog(string Msg) { TxtLog.AppendText(Msg); TxtLog.AppendText(Environment.NewLine); }
public void CreateWeatherGenFolderWiseTxtFile() { string Folder; string root, ProjectName, ProjectFolder; //string DirPcp, DirTmp, DirSolar, DirRH, DirWnd; string DirPcp; int TotalStations = Convert.ToInt32(TxtSubbasinNo.Text); //creating directory //string ImagePath = Environment.CurrentDirectory + "\\CRAWFORD" + DateTime.Now.ToString("yyyyMMddTHHmmss") + ".png"; Folder = TxtDirectoryPath.Text; if (Folder == "") { Folder = Environment.CurrentDirectory; TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Folder Path set to " + Folder); TxtLog.AppendText(Environment.NewLine); TxtLog.AppendText("-------------------------------------------------------------------------------"); TxtLog.AppendText(Environment.NewLine); } ProjectName = TxtProjectName.Text; if (ProjectName == "") { ProjectName = "New Project_" + DateTime.Now.ToString("yyyyMMddTHHmmss") + "_"; TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Project Name set to " + ProjectName); TxtLog.AppendText(Environment.NewLine); TxtLog.AppendText("-------------------------------------------------------------------------------"); TxtLog.AppendText(Environment.NewLine); } ProjectFolder = Folder + "\\" + ProjectName; if (!Directory.Exists(ProjectFolder)) { Directory.CreateDirectory(ProjectFolder); } root = ProjectFolder + "\\Weather Data"; DirPcp = root + "\\Precipitation"; //DirTmp = root + "\\Temperature"; //DirSolar = root + "\\Solar"; //DirRH = root + "\\RH"; //DirWnd = root + "\\Wind"; if (!Directory.Exists(root)) { Directory.CreateDirectory(root); } if (!Directory.Exists(DirPcp)) { Directory.CreateDirectory(DirPcp); } /*if (!Directory.Exists(DirTmp)) * { * Directory.CreateDirectory(DirTmp); * } * if (!Directory.Exists(DirSolar)) * { * Directory.CreateDirectory(DirSolar); * } * if (!Directory.Exists(DirRH)) * { * Directory.CreateDirectory(DirRH); * } * if (!Directory.Exists(DirWnd)) * { * Directory.CreateDirectory(DirWnd); * } */ //creating files in directory string txtFile, SYear, MainFile, TempName; int StepColumn; SYear = TxtStartYear.Text + "0101"; // precipitation Application.DoEvents(); TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Writing to Precipitation files..."); TxtLog.AppendText(Environment.NewLine); StepColumn = 0; MainFile = DirPcp + "\\" + "Pcp" + ".txt"; //TextWriter MainwriterP = new StreamWriter(MainFile); //MainwriterP.Write("ID,NAME,LAT,LONG,ELEVATION"); for (int i = 0; i < TotalStations; i++) //TotalStations is equal to Total number of subbasin { txtFile = DirPcp + "\\" + dataGridViewSubbasinSummary.Rows[i].Cells[1].Value + ".txt"; TempName = "Pcp_" + dataGridViewSubbasinSummary.Rows[i].Cells[1].Value; //subbasin name //for main pcp file containing records of pcp stations //MainwriterP.Write(Environment.NewLine); /*MainwriterP.Write((i + 1).ToString() + "," + TempName + "," + dataGridViewStation.Rows[i].Cells[2].Value + "," + dataGridViewStation.Rows[i].Cells[3].Value + "," + dataGridViewStation.Rows[i].Cells[4].Value);*/ TextWriter writer = new StreamWriter(txtFile); //writing to each files writer.Write(SYear); for (int j = 0; j < TotalNumberofDailyData; j++) { writer.Write(Environment.NewLine); writer.Write(dataGridView5.Rows[j].Cells[2 + i].Value); } //StepColumn += EachStationColumn; writer.Close(); TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Finished writing to file : " + txtFile); TxtLog.AppendText(Environment.NewLine); TxtLog.AppendText("................................................................................"); TxtLog.AppendText(Environment.NewLine); } //MainwriterP.Close(); /* //tmp mx, tmp mn * Application.DoEvents(); * TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Writing to Temperature files..."); * TxtLog.AppendText(Environment.NewLine); * StepColumn = 0; * MainFile = DirTmp + "\\" + "Tmp" + ".txt"; * TextWriter MainwriterT = new StreamWriter(MainFile); * MainwriterT.Write("ID,NAME,LAT,LONG,ELEVATION"); * for (int i = 0; i < TotalStations; i++) * { * txtFile = DirTmp + "\\" + "Tmp_" + dataGridViewStation.Rows[i].Cells[1].Value + ".txt"; * * TempName = "Tmp_" + dataGridViewStation.Rows[i].Cells[1].Value; * MainwriterT.Write(Environment.NewLine); * MainwriterT.Write((i + 1).ToString() + "," + TempName + "," + dataGridViewStation.Rows[i].Cells[2].Value + "," + dataGridViewStation.Rows[i].Cells[3].Value + "," + dataGridViewStation.Rows[i].Cells[4].Value); + + TextWriter writer = new StreamWriter(txtFile); + writer.Write(SYear); + for (int j = 0; j < TotalNumberofDailyData; j++) + { + writer.Write(Environment.NewLine); + writer.Write(dataGridViewMusking.Rows[j].Cells[3 + StepColumn].Value + "," + dataGridViewMusking.Rows[j].Cells[4 + StepColumn].Value); + } + StepColumn += EachStationColumn; + writer.Close(); + TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Finished writing to file : " + txtFile); + TxtLog.AppendText(Environment.NewLine); + TxtLog.AppendText("................................................................................"); + TxtLog.AppendText(Environment.NewLine); + } + MainwriterT.Close(); + + //solar + Application.DoEvents(); + TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Writing to Solar files..."); + TxtLog.AppendText(Environment.NewLine); + StepColumn = 0; + MainFile = DirSolar + "\\" + "Solar" + ".txt"; + TextWriter MainwriterS = new StreamWriter(MainFile); + MainwriterS.Write("ID,NAME,LAT,LONG,ELEVATION"); + for (int i = 0; i < TotalStations; i++) + { + txtFile = DirSolar + "\\" + "Solar_" + dataGridViewStation.Rows[i].Cells[1].Value + ".txt"; + + TempName = "Solar_" + dataGridViewStation.Rows[i].Cells[1].Value; + MainwriterS.Write(Environment.NewLine); + MainwriterS.Write((i + 1).ToString() + "," + TempName + "," + dataGridViewStation.Rows[i].Cells[2].Value + "," + dataGridViewStation.Rows[i].Cells[3].Value + "," + dataGridViewStation.Rows[i].Cells[4].Value); + + TextWriter writer = new StreamWriter(txtFile); + writer.Write(SYear); + for (int j = 0; j < TotalNumberofDailyData; j++) + { + writer.Write(Environment.NewLine); + writer.Write(dataGridViewMusking.Rows[j].Cells[5 + StepColumn].Value); + } + StepColumn += EachStationColumn; + writer.Close(); + TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Finished writing to file : " + txtFile); + TxtLog.AppendText(Environment.NewLine); + TxtLog.AppendText("................................................................................"); + TxtLog.AppendText(Environment.NewLine); + } + MainwriterS.Close(); + + //Relative Humidity + Application.DoEvents(); + TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Writing to Relative Humidity files..."); + TxtLog.AppendText(Environment.NewLine); + StepColumn = 0; + MainFile = DirRH + "\\" + "RH" + ".txt"; + TextWriter MainwriterR = new StreamWriter(MainFile); + MainwriterR.Write("ID,NAME,LAT,LONG,ELEVATION"); + for (int i = 0; i < TotalStations; i++) + { + txtFile = DirRH + "\\" + "RH_" + dataGridViewStation.Rows[i].Cells[1].Value + ".txt"; + + TempName = "RH_" + dataGridViewStation.Rows[i].Cells[1].Value; + MainwriterR.Write(Environment.NewLine); + MainwriterR.Write((i + 1).ToString() + "," + TempName + "," + dataGridViewStation.Rows[i].Cells[2].Value + "," + dataGridViewStation.Rows[i].Cells[3].Value + "," + dataGridViewStation.Rows[i].Cells[4].Value); + + TextWriter writer = new StreamWriter(txtFile); + writer.Write(SYear); + for (int j = 0; j < TotalNumberofDailyData; j++) + { + writer.Write(Environment.NewLine); + writer.Write(dataGridViewMusking.Rows[j].Cells[6 + StepColumn].Value); + } + StepColumn += EachStationColumn; + writer.Close(); + TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Finished writing to file : " + txtFile); + TxtLog.AppendText(Environment.NewLine); + TxtLog.AppendText("................................................................................"); + TxtLog.AppendText(Environment.NewLine); + } + MainwriterR.Close(); + + //Wind + Application.DoEvents(); + TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Writing to Wind files..."); + TxtLog.AppendText(Environment.NewLine); + StepColumn = 0; + MainFile = DirWnd + "\\" + "Wind" + ".txt"; + TextWriter MainwriterW = new StreamWriter(MainFile); + MainwriterW.Write("ID,NAME,LAT,LONG,ELEVATION"); + for (int i = 0; i < TotalStations; i++) + { + txtFile = DirWnd + "\\" + "Wind_" + dataGridViewStation.Rows[i].Cells[1].Value + ".txt"; + + TempName = "Wind_" + dataGridViewStation.Rows[i].Cells[1].Value; + MainwriterW.Write(Environment.NewLine); + MainwriterW.Write((i + 1).ToString() + "," + TempName + "," + dataGridViewStation.Rows[i].Cells[2].Value + "," + dataGridViewStation.Rows[i].Cells[3].Value + "," + dataGridViewStation.Rows[i].Cells[4].Value); + + TextWriter writer = new StreamWriter(txtFile); + writer.Write(SYear); + for (int j = 0; j < TotalNumberofDailyData; j++) + { + writer.Write(Environment.NewLine); + writer.Write(dataGridViewMusking.Rows[j].Cells[6 + StepColumn].Value); + } + StepColumn += EachStationColumn; + writer.Close(); + TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Finished writing to file : " + txtFile); + TxtLog.AppendText(Environment.NewLine); + TxtLog.AppendText("................................................................................"); + TxtLog.AppendText(Environment.NewLine); + } + MainwriterW.Close();*/ TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Writing to all files completed"); TxtLog.AppendText(Environment.NewLine); TxtLog.AppendText(DateTime.Now.ToString("hh:mm:ss") + " ==> Files written to " + root); TxtLog.AppendText(Environment.NewLine); TxtLog.AppendText("-------------------------------------------------------------------------------"); TxtLog.AppendText(Environment.NewLine); }
private void BtnAdd_Click(object sender, EventArgs e) { Animal animal = Animal.make(CbKinds.SelectedItem.ToString(), TxtName.Text); TxtLog.AppendText(animal.ToString() + Environment.NewLine); }