当前位置: 首页>>代码示例>>C#>>正文


C# CalendarService.QueryClientLoginToken方法代码示例

本文整理汇总了C#中Google.GData.Calendar.CalendarService.QueryClientLoginToken方法的典型用法代码示例。如果您正苦于以下问题:C# CalendarService.QueryClientLoginToken方法的具体用法?C# CalendarService.QueryClientLoginToken怎么用?C# CalendarService.QueryClientLoginToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Google.GData.Calendar.CalendarService的用法示例。


在下文中一共展示了CalendarService.QueryClientLoginToken方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: checkPw

        // Validates a username/pass by attempting to login to calendar
        public static bool checkPw(string username, string password)
        {
            GDataGAuthRequestFactory authFactory = new GDataGAuthRequestFactory("cl", "Seadragon");
            authFactory.AccountType = "HOSTED";

            CalendarService client = new CalendarService(authFactory.ApplicationName);
            client.RequestFactory = authFactory;
            client.setUserCredentials(username + "@" + DOMAIN, password);

            try
            {
                client.QueryClientLoginToken(); // Authenticate the user immediately
            }
            catch (WebException)     // Invalid login
            {
                return false;
            }

            return true;
        }
开发者ID:andrewkrug,项目名称:seadragon,代码行数:21,代码来源:Google.cs

示例2: Button_Click_1

        /// <summary>
        /// 同期
        /// </summary>
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            //各設定保存
            XML xl = new XML();
            DataSet ds = new DataSet();
            DataTable dtb;

            dtb = ds.Tables.Add("data");
            dtb.Columns.Add("cal1",Type.GetType("System.String"));
            dtb.Columns.Add("cal2", Type.GetType("System.String"));
            dtb.Columns.Add("id", Type.GetType("System.String"));
            dtb.Columns.Add("pass", Type.GetType("System.String"));
            dtb.Rows.Add(new object[] {tbCal1.Text,tbCal2.Text,tbID.Text,tbPASS.Text});
            xl.Save(System.Environment.CurrentDirectory + "/data.xml", ds);

            // カレンダーサービスを作成
            CalendarService service = new CalendarService("companyName-applicationName-1");

            // 認証設定
            service.setUserCredentials(tbID.Text, tbPASS.Text);

            // 認証結果の確認
            try
            {
                // ここで例外がthrowされなければOK
                // 処理に少し時間がかかる
                var token = service.QueryClientLoginToken();
            }
            catch (InvalidCredentialsException ex)
            {
                // 認証に失敗している
                MessageBox.Show(ex.Message);
                service = null;
            }

            // 取得条件設定
            for (int year = 2014; year < 2021; year++)
            {
                //ファイルを開く
                EXCEL EX = new EXCEL();
                EX.Open(year.ToString());

                for (int calNo = 1; calNo < 3; calNo++)
                {
                    EventQuery query = new EventQuery();
                    if (calNo == 1)
                    {
                        query.Uri = new Uri("https://www.google.com/calendar/feeds/" + tbCal1.Text + "/private/full");
                    }
                    else
                    {
                        query.Uri = new Uri("https://www.google.com/calendar/feeds/" + tbCal2.Text + "/private/full");
                    }

                    query.StartTime = new DateTime(year, 1, 1);
                    query.EndTime = new DateTime(year, 12, 31);
                    query.SortOrder = CalendarSortOrder.descending;
                    //query.SingleEvents = true;

                    // 取得して表示
                    EventFeed feeds = service.Query(query);
                    IEnumerable<EventEntry> entries = feeds.Entries.Cast<EventEntry>();
                    foreach (EventEntry entry in entries)
                    {
                        //ファイルに書き込み
                        EX.Write(entry.Times.First().StartTime.Month, entry.Times.First().StartTime.Day,
                            entry.Times.First().StartTime.TimeOfDay.ToString(), entry.Locations.First().ValueString, entry.Title.Text, calNo);
                    }
                }

                //ファイル保存
                EX.Save(year.ToString());
                //ファイルを閉じる
                EX.Close();
            }
        }
开发者ID:renton18,项目名称:GoogleCalenderAssist,代码行数:79,代码来源:MainWindow.xaml.cs

示例3: GetCalendarService

        private CalendarService GetCalendarService(EventQuery query, string eventId, DateTime startDateTime, DateTime endDateTime)
        {
            query.Uri = CalendarUri;
            query.Uri = new Uri(string.Concat(query.Uri.ToString(), !string.IsNullOrEmpty(eventId) ? string.Concat("/", eventId) : string.Empty));

            query.StartTime = startDateTime;
            query.EndTime = endDateTime;

            var calendarService = new CalendarService(_applicationName);
            calendarService.setUserCredentials(_googleUsername, _googlePassword);
            calendarService.QueryClientLoginToken();
            return calendarService;
        }
开发者ID:dextermixwith,项目名称:simplereminders,代码行数:13,代码来源:GoogleCalendarFacade.cs

示例4: GetAuthToken

        private static string GetAuthToken()
        {
            if (GoogleCalendarAuthToken.IsExpired())
            {
                var service = new CalendarService("GoogleCalendarReminder");

                service.setUserCredentials(Account.Default.Username
                                            , SecureStringUtility.SecureStringToString(Account.Default.Password));

                try
                {
                    GoogleCalendarAuthToken.AuthToken = service.QueryClientLoginToken();
                }
                catch (CaptchaRequiredException ex)
                {
                    // TODO: CDA - http://code.google.com/googleapps/faq.html
                    MessageBox.Show(ex.Message, ex.GetType().ToString());

                    //https://www.google.com/accounts/UnlockCaptcha
                    return null;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ex.GetType().ToString());
                    return null;
                }
            }

            return GoogleCalendarAuthToken.AuthToken;
        }
开发者ID:cyndilou,项目名称:CalendarReminderApp,代码行数:30,代码来源:GoogleCalendarService.cs


注:本文中的Google.GData.Calendar.CalendarService.QueryClientLoginToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。