コード例 #1
0
        public void SendLectio(string picturepath, string lectioWordFile, LectioDivinaWeek lectioWeek)
        {
            if (!File.Exists(lectioWordFile))
                throw new Exception("Nie znaleziono pliku Lectio Divina: " + lectioWordFile);

            if (!File.Exists(picturepath))
                throw new Exception("Nie znaleziono pliku z obrazkiem");

            string postTemplate = Properties.Settings.Default.OnJestPostTemplate;
            if (!File.Exists(postTemplate))
                throw new Exception("Nie znaleziono pliku z szablonem postu: " + postTemplate);

            OnNotification("Wysyłanie rozpoczęte.");

            SendPicture(picturepath, lectioWeek);

            SendLectioFile(lectioWordFile, lectioWeek);

            SendDayPost(lectioWeek.Sunday);
            SendDayPost(lectioWeek.Monday);
            SendDayPost(lectioWeek.Tuesday);
            SendDayPost(lectioWeek.Wednesday);
            SendDayPost(lectioWeek.Thursday);
            SendDayPost(lectioWeek.Friday);
            SendDayPost(lectioWeek.Saturday);

            SendOnJestAdminInfo(lectioWeek);

            OnNotification("Wysyłanie zakończone");
        }
コード例 #2
0
        public LectioDivinaWeek GetEmpty()
        {
            LectioDivinaWeek lectioDivina = new LectioDivinaWeek();

            lectioDivina.Title = new TitlePage() { SundayDate = GetNearestSunday(), WeekDescription = "np. 10 Tydzień zwykły", WeekPictureName = GetDataFolderName() + @"\obrazektygodnia.jpg", LectioTemplateFile = "szablon.docx", LectioTargetFolder = ""};
            lectioDivina.Sunday = GetEmptyContemplation();
            lectioDivina.Sunday.Day = lectioDivina.Title.SundayDate;
            lectioDivina.Monday = GetEmptyContemplation();
            lectioDivina.Monday.Day = lectioDivina.Sunday.Day.AddDays(1);
            lectioDivina.Tuesday = GetEmptyContemplation();
            lectioDivina.Tuesday.Day = lectioDivina.Sunday.Day.AddDays(2);
            lectioDivina.Wednesday = GetEmptyContemplation();
            lectioDivina.Wednesday.Day = lectioDivina.Sunday.Day.AddDays(3);
            lectioDivina.Thursday = GetEmptyContemplation();
            lectioDivina.Thursday.Day = lectioDivina.Sunday.Day.AddDays(4);
            lectioDivina.Friday = GetEmptyContemplation();
            lectioDivina.Friday.Day = lectioDivina.Sunday.Day.AddDays(5);
            lectioDivina.Saturday = GetEmptyContemplation();
            lectioDivina.Saturday.Day = lectioDivina.Sunday.Day.AddDays(6);

            return lectioDivina;
        }
コード例 #3
0
 private string CreateName(string nameTemplate, LectioDivinaWeek lectioWeek)
 {
     return lectioWeek.Title.SundayDate.ToString(nameTemplate);
 }
コード例 #4
0
        private void SendPicture(string picturepath, LectioDivinaWeek lectioWeek)
        {
            string picName = CreateName(Properties.Settings.Default.OnJestPictureNameTemplate, lectioWeek);
            OnNotification("Wysyłam obrazek jako "+picName);
            string newName = System.IO.Path.Combine(tempPath, picName);

            // ensure right size
            MvvmLight.Extensions.Wpf.ImageToolHelper.DecreaseToWidth(picturepath,
                newName, Properties.Settings.Default.OnJestPictureMaxWidth, null);

            // send
            onJestProxy.UploadFile(Properties.Settings.Default.OnJestUser, Properties.Settings.Default.OnJestPwd, newName);
        }
コード例 #5
0
        private void SendOnJestAdminInfo(LectioDivinaWeek lectioWeek)
        {
            OnNotification("Wysyłam mail do admina OnJest");
            var mailer = new MailTransport();

            mailer.SendMail("Lectio Divina " + Localization.Date2PlStr(lectioWeek.Title.SundayDate), "wysłane", Properties.Settings.Default.OnJestAdminEmail, "OnJest Admin");
        }
コード例 #6
0
        private void SendLectioFile(string lectioWordFile, LectioDivinaWeek lectioWeek)
        {
            string fileName = CreateName(Properties.Settings.Default.OnJestLectioNameTemplate, lectioWeek);
            OnNotification("Wysyłam całość Lectio Divina jako "+fileName );
            string newName = System.IO.Path.Combine(tempPath, fileName);
            WordDocument word = new WordDocument();

            word.Open(lectioWordFile, false);

            word.SaveAsDifferentFormat(newName, WordFormats.Pdf);
            word.Close();

            onJestProxy.UploadFile(Properties.Settings.Default.OnJestUser, Properties.Settings.Default.OnJestPwd, newName);
        }
コード例 #7
0
        public void Save(LectioDivinaWeek lectioDivina)
        {
            string xml;

            EnsureDataFolder();

            xml = SerializationHelper.Serialize(lectioDivina);
            using (var sw = new System.IO.StreamWriter(GetLocalFileName()))
            {
                sw.WriteLine(xml);
            }
        }
コード例 #8
0
        private void InitiateData()
        {
            lectioDivinaWeek = dataService.Load();

            TitlePage = new TitlePageVM(lectioDivinaWeek.Title);

            Sunday = new OneDayContemplationVM(lectioDivinaWeek.Sunday);
            Monday = new OneDayContemplationVM(lectioDivinaWeek.Monday);
            Tuesday = new OneDayContemplationVM(lectioDivinaWeek.Tuesday);
            Wednesday = new OneDayContemplationVM(lectioDivinaWeek.Wednesday);
            Thursday = new OneDayContemplationVM(lectioDivinaWeek.Thursday);
            Friday = new OneDayContemplationVM(lectioDivinaWeek.Friday);
            Saturday = new OneDayContemplationVM(lectioDivinaWeek.Saturday);

            RefreshTargetFileProperty();

            IsDirty = false;
        }