private void buttonCalcEkadasi_Click(object sender, EventArgs e) { TResultCalendar cal = new TResultCalendar(); cal.CalculateCalendar(GCGlobal.myLocation, new GregorianDateTime(int.Parse(textBox1.Text), comboBox1.SelectedIndex + 1, 1), 31); List <VAISNAVADAY> le = new List <VAISNAVADAY>(); for (int i = 0; i < 31; i++) { VAISNAVADAY vd = cal.GetDay(i); if (vd.nFastID == FastType.FAST_EKADASI) { LBVD lb = new LBVD(); lb.vd = vd; listBox1.Items.Add(lb); } } if (listBox1.Items.Count > 0) { listBox1.SelectedIndex = 0; } panel1.Visible = true; }
public static void ExportPngYear(GCLocation calLocation, string dir, string locationFileName, int currentYear) { Size imageSize = new Size(1280, 1024); using (Bitmap b = new Bitmap(imageSize.Width, imageSize.Height)) { using (Graphics g = Graphics.FromImage(b)) { CalendarTableDrawer ctd = new CalendarTableDrawer(); TResultCalendar rc = new TResultCalendar(); rc.CalculateCalendar(calLocation, new GregorianDateTime(currentYear, 1, 1), 366); for (int i = 1; i <= 12; i++) { g.Clear(Color.White); ctd.Draw(g, imageSize, rc, currentYear, i); b.Save(Path.Combine(dir, string.Format("{0}-{1}-{2:00}.png", locationFileName, currentYear, i)), ImageFormat.Png); } } } string text = string.Format("<html><head><title>{0} {1}</title></head><body>", locationFileName, currentYear); StringBuilder sb = new StringBuilder(); sb.Append(text); for (int i = 1; i < 13; i++) { sb.AppendFormat("<p><img src=\"{0}-{1}-{2:00}.png\"></p>", locationFileName, currentYear, i); } sb.AppendFormat("</body></html>"); File.WriteAllText(Path.Combine(dir, string.Format("{0}-{1}.html", locationFileName, currentYear)), sb.ToString()); }
private void printToolStripMenuItem_Click(object sender, EventArgs e) { if (p_mode == 0) { if (Controller != null) { Controller.ExecuteMessage("printContent", m_calendar); } } else if (p_mode == 2) { PrintDialog pd = new PrintDialog(); if (pd.ShowDialog() != DialogResult.OK) { return; } DialogResult dr = MessageBox.Show("Do you want to print a whole year ?", "Time Period", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { printMonthStart = 1; printMonthEnd = 12; printYearStart = calendarTableView1.CurrentYear; printYearEnd = printYearStart; } else if (dr == DialogResult.No) { printMonthEnd = printMonthStart = calendarTableView1.CurrentMonth; printYearStart = printYearEnd = calendarTableView1.CurrentYear; } else { printMonthStart = printMonthEnd = -1; printYearStart = printYearEnd = -1; } if (printYearStart > 0) { m_calendarToPrint = new TResultCalendar(); GregorianDateTime startDate = new GregorianDateTime(printYearStart, printMonthStart, 1); GregorianDateTime endDate = new GregorianDateTime(printYearEnd, printMonthEnd, 1); m_calendarToPrint.CalculateCalendar(calLocation, startDate, endDate.GetJulianInteger() - startDate.GetJulianInteger() + 31); printDocumentTable.PrinterSettings = pd.PrinterSettings; printDocumentTable.DocumentName = string.Format("{0}_{1}", calLocation.Title, printYearStart); printDocumentTable.Print(); } } }
public static void ExportPng(GCLocation calLocation, string directory, string locname, int year, int month) { using (Bitmap b = new Bitmap(1280, 1024)) { using (Graphics g = Graphics.FromImage(b)) { g.Clear(Color.White); CalendarTableDrawer ctd = new CalendarTableDrawer(); TResultCalendar rc = new TResultCalendar(); rc.CalculateCalendar(calLocation, new GregorianDateTime(year, month, 1), 32); ctd.Draw(g, new Size(1280, 1024), rc, year, month); } b.Save(Path.Combine(directory, string.Format("{0}-{1}-{2:00}.png", locname, year, month)), ImageFormat.Png); } }
public VAISNAVADAY GetCalcDay(GregorianDateTime dt, GCLocation loc, TResultCalendar cal, double longitude, double latitude) { loc.SetCoordinates(longitude, latitude); cal.CalculateCalendar(loc, dt, 5); for (int i = 0; i < 5; i++) { VAISNAVADAY vd = cal.GetDay(i); if (vd.nFastID == FastType.FAST_EKADASI) { return(vd); } } return(null); }
/// <summary> /// If newText is changed during the processing of this method /// then running of this method is aborted and new search starts in backSearch_DoWork /// by assigning newText value into currentText /// </summary> private void doSearch(string text, CancellationTokenSource tokenSource) { TResultCalendar cal = new TResultCalendar(); string dayText; cal.CalculateCalendar(EarthLocation, new GregorianDateTime(), 700); StringBuilder results3 = new StringBuilder(); GSScript script = new GSScript(); script.readTextTemplate(TResultCalendar.getPlainDayTemplate()); GSExecutor exec = new GSExecutor(); for (int i = 0; i < cal.m_PureCount; i++) { VAISNAVADAY vd = cal.GetDay(i); exec.SetVariable("app", GCUserInterface.Shared); exec.SetVariable("location", EarthLocation); exec.SetVariable("pvd", vd); //dayText = TResultCalendar.formatPlainTextDay(vd); exec.resetOutput(); exec.ExecuteElement(script); dayText = exec.getOutput(); //Debugger.Log(0, "", "SEARCH IN TEXT: " + dayText + "\n\n"); if (dayText.IndexOf(text, 0, StringComparison.CurrentCultureIgnoreCase) >= 0) { results3.AppendLine(); results3.AppendLine(dayText); } if (tokenSource.IsCancellationRequested) { return; } } if (!tokenSource.IsCancellationRequested) { FinalizeDelegate dlg = new FinalizeDelegate(setRichText); richTextBox1.BeginInvoke(dlg, results3.ToString()); ctTask = null; ctPrev = null; } }
public static void ExportTableCalendar(GCLocation calLocation, int printYearStart, int printYearEnd, string folderPath) { TResultCalendar m_calendarToPrint = new TResultCalendar(); GregorianDateTime startDate = new GregorianDateTime(printYearStart, 1, 1); GregorianDateTime endDate = new GregorianDateTime(printYearEnd, 12, 1); m_calendarToPrint.CalculateCalendar(calLocation, startDate, endDate.GetJulianInteger() - startDate.GetJulianInteger() + 31); string DocumentName = string.Format("{0}_{1}", calLocation.Title, printYearStart); PdfDocument doc = new PdfDocument(); CalendarPdfDrawer ctd = new CalendarPdfDrawer(); for (int year = printYearStart; year <= printYearEnd; year++) { for (int month = 1; month <= 12; month++) { PdfPage page = doc.AddPage(); page.Size = PdfSharp.PageSize.A4; page.Orientation = PdfSharp.PageOrientation.Landscape; XGraphics gfx = XGraphics.FromPdfPage(page); SizeF pageSizeF = gfx.PageSize.ToSizeF(); ctd.PaddingTop = Convert.ToInt32(pageSizeF.Height / 20); ctd.PaddingBottom = Convert.ToInt32(pageSizeF.Height / 20); ctd.PaddingLeft = Convert.ToInt32(pageSizeF.Width / 20); ctd.PaddingRight = Convert.ToInt32(pageSizeF.Width / 20); ctd.Draw(gfx, gfx.PageSize, m_calendarToPrint, year, month); } } doc.Save(folderPath); }
public void RecalculateCalendar() { calendar = new TResultCalendar(); calendar.CalculateCalendar(calLocation, new GregorianDateTime(currentYear, currentMonth, 1), 31); Invalidate(); }