在我的日历中导入.ICS文件在android应用程序中创建 [英] Importing .ICS-file in my calendar made in android application

查看:331
本文介绍了在我的日历中导入.ICS文件在android应用程序中创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿那里:)

我目前正在尝试在我的日历中找到导入.ICS链接/ URL的方法。我尝试使用本网站上的一个:Dday.Ical( https://www.codeproject.com/Articles/17980/Adding-iCalendar-Support-to-Your-Program-Part- 1)),但一直得到异常:System.TypeLoadException ..我有最新版本的.NET框架,我还添加了DDay.iCal包。



我正在执行的代码(也在链接中显示):

Hey there :)
I am currently trying to find a way to import an .ICS link/URL in my calendar. I tried using one I found here on this site: Dday.Ical (https://www.codeproject.com/Articles/17980/Adding-iCalendar-Support-to-Your-Program-Part-1), but kept getting the exception: System.TypeLoadException.. I have the newest version of .NET framework and also I added the DDay.iCal package.

The code I am executing is (also as shown in the link):

using System;
using System.Collections.Generic;
using System.Text;

// Required DDay.iCal namespace
using DDay.iCal;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            // Load the calendar file
            IICalendarCollection calendars = iCalendar.LoadFromFile(@"Business.ics");

            //
            // Get all events that occur today.
            //
            IList&occurrence> occurrences = calendars.GetOccurrences
				(DateTime.Today, DateTime.Today.AddDays(1));

            Console.WriteLine("Today's Events:");

            // Iterate through each occurrence and display information about it
            foreach (Occurrence occurrence in occurrences)
            {
                DateTime occurrenceTime = occurrence.Period.StartTime.Local;
                IRecurringComponent rc = occurrence.Source as IRecurringComponent;
                if (rc != null)
                    Console.WriteLine(rc.Summary + ": " + 
				occurrenceTime.ToShortTimeString());
            }

            //
            // Get all occurrences for the next 7 days, starting tomorrow.
            //
            occurrences = calendars.GetOccurrences
		(DateTime.Today.AddDays(1), DateTime.Today.AddDays(7));

            Console.WriteLine(Environment.NewLine + "Upcoming Events:");

            // Start with tomorrow
            foreach (Occurrence occurrence in occurrences)
            {
                DateTime occurrenceTime = occurrence.Period.StartTime.Local;
                IRecurringComponent rc = occurrence.Source as IRecurringComponent;
                if (rc != null)
                    Console.WriteLine(rc.Summary + ": " + occurrenceTime.ToString());
            }
        }
    }
}





我不知道为什么呢是不是有用..有没有更简单的方法将事件导入到Android应用程序中的日历?



我尝试了什么:



我已经尝试了我在问题中提到的事情



I have got no clue why it is not working.. are there maybe easier ways to import events to a calendar in an android app?

What I have tried:

I have tried the things I mentioned in the question

推荐答案

你应该在论坛中发表你的问题在文章的最后, iCalendar 类的作者可以帮助你。
You should post your question in the forum at the end of the article so the author of the iCalendar class can help you.


这篇关于在我的日历中导入.ICS文件在android应用程序中创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆