示例#1
0
        public const string DescriptionHeaderName = "# CrossSync: "; // Don't modify this.

        #endregion Fields

        #region Methods

        public static bool CanSync(out CybozuException ex)
        {
            ex = null;

            Properties.Settings settings = Properties.Settings.Default;
            if (!IsConfigured(settings)) return false;

            App firstApp, secondApp;
            Schedule firstSchedule, secondSchedule;

            try
            {
                firstApp = new App(settings.FirstUrl);
                firstApp.Auth(settings.FirstUsername, settings.FirstPassword);
                firstSchedule = new Schedule(firstApp);

                secondApp = new App(settings.SecondUrl);
                secondApp.Auth(settings.SecondUsername, settings.SecondPassword);
                secondSchedule = new Schedule(secondApp);
            }
            catch (CybozuException e)
            {
                // fail to auth
                ex = e;
                return false;
            }
            catch (Exception)
            {
                return false;
            }

            return true;
        }
        protected bool ShowMessageIfLicenseError(CybozuException ex)
        {
            if (ex == null)
            {
                return false;
            }
            else if (ex.Code == App.ErrorCode.OfficeLicenseError)
            {
                MessageBox.Show(Resources.OfficeLicenseExpires, Resources.ProductName);
            }
            else if (ex.Code == App.ErrorCode.GaroonLicenseError)
            {
                MessageBox.Show(Resources.GaroonLicenseExpires, Resources.ProductName);
            }
            else
            {
                return false;
            }

            return true;
        }