Exemple #1
0
		void MainWindow_Loaded(object sender, RoutedEventArgs e) {
			_Server = new CalDav.Client.Server("https://www.google.com/calendar/dav/[email protected]/events/", "*****@*****.**", "Gboey6Emo!");
			_Calendar = _Server.GetCalendars().FirstOrDefault();

			this.AsyncUI(_Calendar.Initialize, () => lblCalendarName.Content = _Calendar.Name);
			LoadEvents();
		}
Exemple #2
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            _Server   = new CalDav.Client.Server("https://www.google.com/calendar/dav/[email protected]/events/", "*****@*****.**", "Gboey6Emo!");
            _Calendar = _Server.GetCalendars().FirstOrDefault();

            this.AsyncUI(_Calendar.Initialize, () => lblCalendarName.Content = _Calendar.Name);
            LoadEvents();
        }
Exemple #3
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            _Server   = new CalDav.Client.Server("http://colinlaney:12000/caldav/calendar/alk");
            _Calendar = _Server.GetCalendars().FirstOrDefault();

            this.AsyncUI(_Calendar.Initialize, () => lblCalendarName.Content = _Calendar.Name);
            LoadEvents();
        }
        public static IServer GetCalendarServer(CalendarTypes calendarTypes, string username = null, string password = null)
        {
            IServer server;

            if (calendarTypes == CalendarTypes.Outlook)
            {
                return(new OutlookServer());
            }
            else
            {
                IConnection connection;
                if (calendarTypes == CalendarTypes.Google)
                {
                    if (File.Exists("token"))
                    {
                        StreamReader sr = new StreamReader("token");
                        connection = new GoogleConnection(sr.ReadLine());
                        sr.Close();
                    }
                    else
                    {
                        connection = refreshGoogleToken();
                    }
                    server = null;
                }
                else
                {
                    connection = new BasicConnection(username, password);
                    server     = null;
                }
                if (server == null)
                {
                    try
                    {
                        server = new CalDav.Client.Server(urlFromCalendarType(calendarTypes), connection, username, password);
                    }
                    catch (Exception ex)
                    {
                        if (ex.Message == "Authentication is required" && connection.GetType().Equals(new GoogleConnection("").GetType()))
                        {
                            connection = refreshGoogleToken();
                            server     = new CalDav.Client.Server(urlFromCalendarType(calendarTypes), connection, username, password);
                        }
                        else
                        {
                            throw ex;
                        }
                    }
                }
                return(server);
            }
        }
Exemple #5
0
		public void ParseICal() {
			//http://blogs.nologin.es/rickyepoderi/index.php?/archives/14-Introducing-CalDAV-Part-I.html
			//http://blogs.nologin.es/rickyepoderi/index.php?/archives/15-Introducing-CalDAV-Part-II.html

			var server = new CalDav.Client.Server("https://www.google.com/calendar/dav/[email protected]/events/", "*****@*****.**", "Gboey6Emo!");
			var calendars = server.GetCalendars();
			calendars.ShouldNotBeEmpty();

			var calendar = calendars[0];
			var events = calendar.Search(CalendarQuery.SearchEvents(new DateTime(2012, 8, 1), new DateTime(2012, 8, 31))).ToArray();
			events.Length.ShouldBeGreaterThan(0);

		}
Exemple #6
0
        public void ParseICal()
        {
            //http://blogs.nologin.es/rickyepoderi/index.php?/archives/14-Introducing-CalDAV-Part-I.html
            //http://blogs.nologin.es/rickyepoderi/index.php?/archives/15-Introducing-CalDAV-Part-II.html

            var server    = new CalDav.Client.Server("https://www.google.com/calendar/dav/[email protected]/events/", "*****@*****.**", "Gboey6Emo!");
            var calendars = server.GetCalendars();

            calendars.ShouldNotBeEmpty();

            var calendar = calendars[0];
            var events   = calendar.Search(CalendarQuery.SearchEvents(new DateTime(2012, 8, 1), new DateTime(2012, 8, 31))).ToArray();

            events.Length.ShouldBeGreaterThan(0);
        }
Exemple #7
0
		//http://www.phpkode.com/source/p/eyeos/eyeos-2.5/eyeos/system/Frameworks/Calendar/calDavLib/caldav-client.php
		//http://www.webdav.org/specs/rfc4791.html
		//https://bugzilla.mozilla.org/show_bug.cgi?id=702570
		static void Main(string[] args) {
			var server = new CalDav.Client.Server("http://localhost:60399/caldav/");

			if (server.Supports("MKCALENDAR"))
				server.CreateCalendar("me");
			var sets = server.GetCalendars();
			sets.ShouldContain(x => x.Url.AbsolutePath.EndsWith("/caldav/me/"));

			var calendar = sets[0];
			var e = new Event {
				Description = "this is a description",
				Summary = "summary",
				Sequence = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds,
			};
			calendar.Save(e);
			Console.WriteLine(e.Url);
		}
Exemple #8
0
        //http://www.phpkode.com/source/p/eyeos/eyeos-2.5/eyeos/system/Frameworks/Calendar/calDavLib/caldav-client.php
        //http://www.webdav.org/specs/rfc4791.html
        //https://bugzilla.mozilla.org/show_bug.cgi?id=702570
        static void Main(string[] args)
        {
            var server = new CalDav.Client.Server("http://localhost:60399/caldav/");

            if (server.Supports("MKCALENDAR"))
            {
                server.CreateCalendar("me");
            }
            var sets = server.GetCalendars();

            sets.ShouldContain(x => x.Url.AbsolutePath.EndsWith("/caldav/me/"));

            var calendar = sets[0];
            var e        = new Event {
                Description = "this is a description",
                Summary     = "summary",
                Sequence    = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds,
            };

            calendar.Save(e);
            Console.WriteLine(e.Url);
        }
        public static IServer GetCalendarServer(CalendarTypes calendarTypes, string username = null, string password = null, string token = null)
        {
            IServer     server;
            IConnection connection;

            if (calendarTypes == CalendarTypes.Google)
            {
                connection = new GoogleConnection(token);
                server     = null;
            }
            else
            {
                connection = new BasicConnection(username, password);
                server     = null;
            }

            if (server == null)
            {
                try
                {
                    server = new CalDav.Client.Server(urlFromCalendarType(calendarTypes), connection, username, password);
                }
                catch (Exception ex)
                {
                    if (ex.Message == "Authentication is required" && connection.GetType().Equals(new GoogleConnection("").GetType()))
                    {
                        connection = refreshGoogleToken();
                        server     = new CalDav.Client.Server(urlFromCalendarType(calendarTypes), connection, username, password);
                    }
                    else
                    {
                        throw ex;
                    }
                }
            }
            return(server);
        }
Exemple #10
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            _Server = new CalDav.Client.Server("http://colinlaney:12000/caldav/calendar/alk");
            _Calendar = _Server.GetCalendars().FirstOrDefault();

            this.AsyncUI(_Calendar.Initialize, () => lblCalendarName.Content = _Calendar.Name);
            LoadEvents();
        }