コード例 #1
0
 static void ThreadProject()
 {
     _12ConGiap.DrawImage();
     VanKhanString.ReadVK();
     LunnarCalendar.ReadFileStar();
     StringText.GetQuote();
     StringText.DrawImage();
     StringText.GetHDSD();
 }
コード例 #2
0
        //GT = 1 là nữ
        //GT = 0 là nam
        public static string GetTuVi(DateTime date, int GT)
        {
            string line = "";
            LuniSolarDate <VietnameseLocalInfoProvider> luni = LuniSolarCalendar <VietnameseLocalInfoProvider> .LuniSolarDateFromSolarDate(date);

            LunnarCalendar lunnar   = new LunnarCalendar();
            string         sCan     = lunnar.GetCanNam(luni.Year);
            string         sChi     = lunnar.GetChiNam(luni.Year);
            string         sCanFile = "";
            string         sChiFile = "";
            string         filetext = "";

            switch (sCan)
            {
            case "Giáp":
                sCanFile = Can[0];
                break;

            case "Ất":
                sCanFile = Can[1];
                break;

            case "Bính":
                sCanFile = Can[2];
                break;

            case "Đinh":
                sCanFile = Can[3];
                break;

            case "Mậu":
                sCanFile = Can[4];
                break;

            case "Kỷ":
                sCanFile = Can[5];
                break;

            case "Canh":
                sCanFile = Can[6];
                break;

            case "Tân":
                sCanFile = Can[7];
                break;

            case "Nhâm":
                sCanFile = Can[8];
                break;

            case "Quý":
                sCanFile = Can[9];
                break;

            default:
                break;
            }
            switch (sChi)
            {
            case "Tý":
                sChiFile = Chi[0];
                break;

            case "Sửu":
                sChiFile = Chi[1];
                break;

            case "Dần":
                sChiFile = Chi[2];
                break;

            case "Mão":
                sChiFile = Chi[3];
                break;

            case "Thìn":
                sChiFile = Chi[4];
                break;

            case "Tỵ":
                sChiFile = Chi[5];
                break;

            case "Ngọ":
                sChiFile = Chi[6];
                break;

            case "Mùi":
                sChiFile = Chi[7];
                break;

            case "Thân":
                sChiFile = Chi[8];
                break;

            case "Dậu":
                sChiFile = Chi[9];
                break;

            case "Tuất":
                sChiFile = Chi[10];
                break;

            case "Hợi":
                sChiFile = Chi[11];
                break;

            default:
                break;
            }

            if (GT == 1)
            {
                filetext = string.Format("{0}{1}Nu.txt", sCanFile, sChiFile);
                StreamReader streamReader = new StreamReader(FileTextNu(filetext), Encoding.UTF8);
                line = streamReader.ReadToEnd();
            }
            else
            {
                filetext = string.Format("{0}{1}Nam.txt", sCanFile, sChiFile);
                StreamReader streamReader = new StreamReader(FileTextNam(filetext), Encoding.UTF8);
                line = streamReader.ReadToEnd();
            }
            return(line);
        }
コード例 #3
0
ファイル: DisplayDetailDate.cs プロジェクト: 11012001/tam
        public void DisplayDate(DateTime date)
        {
            LunnarCalendar calendar = new LunnarCalendar();
            LuniSolarDate <VietnameseLocalInfoProvider> luni = LuniSolarCalendar <VietnameseLocalInfoProvider> .LuniSolarDateFromSolarDate(date);

            #region Chỉnh sửa panelDisplayDate
            labelSolarDate.Text  = string.Format("{0}, {1}/{2}/{3}", calendar.GetThu(date), date.Day, date.Month, date.Year);
            labelLunnarDate.Text = string.Format("Ngày {0}/{1}/{2} Tức ngày {3}, tháng {4}, năm {5}", luni.Day, luni.Month, luni.Year, luni.DayName, luni.MonthLongName, luni.YearName);
            labelDetailDate.Text = string.Format("Hành {0} - Sao {1} - Trực {2} - Ngày {3}", calendar.GetNguHanh(date), calendar.GetSao(date), calendar.GoodDayString(date), calendar.GetNameHoangHacDao(date));
            labelTietKhi.Text    = string.Format("{0}", calendar.SolarTermString(luni.SolarTerm));
            #endregion

            #region Chỉnh sửa PanelZodiacHour
            string[] words1 = calendar.GetZodiacTime(date).Split(',');
            labelGood1.Text = words1[0];
            labelGood2.Text = words1[1];
            labelGood3.Text = words1[2];
            labelGood4.Text = words1[3];
            labelGood5.Text = words1[4];
            labelGood6.Text = words1[5];

            string[] word2 = calendar.GetUnZodiacTime(date).Split(',');
            labelBad1.Text = word2[0];
            labelBad2.Text = word2[1];
            labelBad3.Text = word2[2];
            labelBad4.Text = word2[3];
            labelBad5.Text = word2[4];
            labelBad6.Text = word2[5];
            #endregion

            #region Chỉnh sửa PanelTruc
            tbTrucName.Text = string.Format("Trực {0}", calendar.GoodDayString(date));
            DataTable dtTruc = calendar.GetDetailTruc(date);
            foreach (DataRow row in dtTruc.Rows)
            {
                tbTrucDo.Text    = (string)row["Do"];
                tbUnDoTruc.Text  = (string)row["Undo"];
                tbTrucBonus.Text = (string)row["Bonus"];
            }
            #endregion

            #region Chính sửa PanelStar
            DataTable dtTot = calendar.GetGoodStar(date);
            string    sTot  = "";
            foreach (DataRow row in dtTot.Rows)
            {
                sTot += string.Format("{0}\r\n", (string)row["Name"]);
            }
            tbSaoTot.Text = sTot;

            DataTable dtXau = calendar.GetBadStar(date);
            string    sXau  = "";
            foreach (DataRow row in dtXau.Rows)
            {
                sXau += string.Format("{0}\r\n", (string)row["Name"]);
            }
            tbSaoXau.Text = sXau;
            #endregion

            #region Chính sửa PanelNTBT
            rtb.Text = calendar.GetDetailStar28(date);
            HighlightRTB(rtb, 11);
            #endregion

            #region Chỉnh sửa PanelHXH
            labelTaiThan.Text = string.Format("Đi về hướng {0} để nghênh tiếp Tài Thần", calendar.GetTaiThan(date));
            labelHyThan.Text  = string.Format("Đi về hướng {0} để đón Hỷ Thần", calendar.GetHyThan(date));
            string sHacThan = calendar.GetHacThan(date);
            if (sHacThan == "Vô")
            {
                labelHacThan.Visible = false;
            }
            else
            {
                labelHacThan.Visible = true;
                labelHacThan.Text    = string.Format("Tránh đi về hướng {0} để gặp Hắc Thần", sHacThan);
            }
            #endregion

            #region Chỉnh sửa PanelNXH
            DataTable dtNXH = calendar.GetNgayXuatHanh(date);
            string    sNXH  = "";
            foreach (DataRow row in dtNXH.Rows)
            {
                string sName = (string)row["Name"];
                string sMean = (string)row["Mean"];
                sNXH = string.Format("Ngày {0}: {1}", sName, sMean);
            }
            tbNXH.Text = sNXH;
            #endregion

            #region Chỉnh sửa PanelGXH
            DataTable dtGXH1 = calendar.GetXuatHanh(date, 1);
            foreach (DataRow row in dtGXH1.Rows)
            {
                string sName = (string)row["Name"];
                tbGXHName1.Text = string.Format("{0}", sName.ToUpper());
                tbGXHMean1.Text = string.Format("{0}", (string)row["Mean"]);
            }

            DataTable dtGXH2 = calendar.GetXuatHanh(date, 2);
            foreach (DataRow row in dtGXH2.Rows)
            {
                string sName = (string)row["Name"];
                tbGXHName2.Text = string.Format("{0}", sName.ToUpper());
                tbGXHMean2.Text = string.Format("{0}", (string)row["Mean"]);
            }

            DataTable dtGXH3 = calendar.GetXuatHanh(date, 3);
            foreach (DataRow row in dtGXH3.Rows)
            {
                string sName = (string)row["Name"];
                tbGXHName3.Text = string.Format("{0}", sName.ToUpper());
                tbGXHMean3.Text = string.Format("{0}", (string)row["Mean"]);
            }

            DataTable dtGXH4 = calendar.GetXuatHanh(date, 4);
            foreach (DataRow row in dtGXH4.Rows)
            {
                string sName = (string)row["Name"];
                tbGXHName4.Text = string.Format("{0}", sName.ToUpper());
                tbGXHMean4.Text = string.Format("{0}", (string)row["Mean"]);
            }

            DataTable dtGXH5 = calendar.GetXuatHanh(date, 5);
            foreach (DataRow row in dtGXH5.Rows)
            {
                string sName = (string)row["Name"];
                tbGXHName5.Text = string.Format("{0}", sName.ToUpper());
                tbGXHMean5.Text = string.Format("{0}", (string)row["Mean"]);
            }

            DataTable dtGXH6 = calendar.GetXuatHanh(date, 6);
            foreach (DataRow row in dtGXH6.Rows)
            {
                string sName = (string)row["Name"];
                tbGXHName6.Text = string.Format("{0}", sName.ToUpper());
                tbGXHMean6.Text = string.Format("{0}", (string)row["Mean"]);
            }
            #endregion
        }
コード例 #4
0
ファイル: DisplayDate.cs プロジェクト: 11012001/tam
        private void display_picture()
        {
            LunnarCalendar lunnar = new LunnarCalendar();
            string         sChi   = lunnar.GetChiNgay(Date);


            switch (sChi)
            {
            case "Tý":
                ZodiacAnimal1.Image = _12ConGiap.Ty;
                ZodiacAnimal2.Image = _12ConGiap.Ty;
                break;

            case "Sửu":
                ZodiacAnimal1.Image = _12ConGiap.Suu;
                ZodiacAnimal2.Image = _12ConGiap.Suu;
                break;

            case "Dần":
                ZodiacAnimal1.Image = _12ConGiap.Dan;
                ZodiacAnimal2.Image = _12ConGiap.Dan;
                break;

            case "Mão":
                ZodiacAnimal1.Image = _12ConGiap.Mao;
                ZodiacAnimal2.Image = _12ConGiap.Mao;
                break;

            case "Thìn":
                ZodiacAnimal1.Image = _12ConGiap.Thin;
                ZodiacAnimal2.Image = _12ConGiap.Thin;
                break;

            case "Tỵ":
                ZodiacAnimal1.Image = _12ConGiap.Ti;
                ZodiacAnimal2.Image = _12ConGiap.Ti;
                break;

            case "Ngọ":
                ZodiacAnimal1.Image = _12ConGiap.Ngo;
                ZodiacAnimal2.Image = _12ConGiap.Ngo;
                break;

            case "Mùi":
                ZodiacAnimal1.Image = _12ConGiap.Mui;
                ZodiacAnimal2.Image = _12ConGiap.Mui;
                break;

            case "Thân":
                ZodiacAnimal1.Image = _12ConGiap.Than;
                ZodiacAnimal2.Image = _12ConGiap.Than;
                break;

            case "Dậu":
                ZodiacAnimal1.Image = _12ConGiap.Dau;
                ZodiacAnimal2.Image = _12ConGiap.Dau;
                break;

            case "Tuất":
                ZodiacAnimal1.Image = _12ConGiap.Tuat;
                ZodiacAnimal2.Image = _12ConGiap.Tuat;
                break;

            case "Hợi":
                ZodiacAnimal1.Image = _12ConGiap.Hoi;
                ZodiacAnimal2.Image = _12ConGiap.Hoi;
                break;

            default:
                break;
            }
        }