//#region Authorization //async protected override void OnLoad(EventArgs e) //{ // ////// // ////////////////////::/ // ////////////: // /// // base.OnLoad(e); // Directory.CreateDirectory(Environment.CurrentDirectory + @"\xml"); // try // { // this.credential = await AuthorizeToGoogle(); // this.service = new CalendarService(new BaseClientService.Initializer() // { // HttpClientInitializer = this.credential, // ApplicationName = "Other client 1" // }); // this.gcSyncComponent.CalendarService = this.service; // // await UpdateCalendarListUI(); // this.allowEventLoad = true; // // UpdateBbiAvailability(); // this.gcSyncComponent.Storage = schedulerDataStorage1; // // this.gcSyncComponent.CalendarId = "*****@*****.**"; // // this.gcSyncComponent.CalendarId = "*****@*****.**"; // // this.gcSyncComponent.Synchronize(); // } // catch (Exception ex) // { // XtraMessageBoxArgs args = new XtraMessageBoxArgs(); // args.AutoCloseOptions.Delay = 3000; // args.Caption = "Auto-close message"; // args.Text = ex.Message; // args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel }; // // MessageBox.Show(ex.Message); // XtraMessageBox.Show(args).ToString(); // } //} //async Task<UserCredential> AuthorizeToGoogle() //{ // using (FileStream stream = new FileStream("credentials.json", FileMode.Open, FileAccess.Read)) // { // string credPath = Environment.GetFolderPath( // Environment.SpecialFolder.Personal); // credPath = Path.Combine(credPath, ".credentials/GoogleSchedulerSync.json"); // return await GoogleWebAuthorizationBroker.AuthorizeAsync( // GoogleClientSecrets.Load(stream).Secrets, // new String[] { CalendarService.Scope.Calendar }, // "user", // CancellationToken.None, // new FileDataStore(credPath, true)); // } //} //#endregion private void gcSyncComponent_ConflictDetected(object sender, ConflictDetectedEventArgs e) { // XtraMessageBox.Show("Google '" + e.Event.Summary + "' Event conflicts with the Scheduler '" + // e.Appointment.Subject + "' Appointment." + Environment.NewLine + "Synchronizing by the Google Event.", // "Conflict detected", MessageBoxButtons.OK); // //uncomment the following line to sync by Scheduler Appointments instead e.GoogleEventIsValid = false; }
/// <summary> /// Called when the conflict detector has found a conflict. /// </summary> /// <remarks> /// This adds a message to the appropriate plugin's info box, and changes the plugin's /// node's background colour as appropriate. /// </remarks> /// <param name="sender">The object that trigger the event.</param> /// <param name="e">A <see cref="ConflictDetectedEventArgs" /> describing the event arguments.</param> private void cdrDetector_ConflictDetected(object sender, ConflictDetectedEventArgs e) { var stbMessage = new StringBuilder(); var lstBackgroundColours = new List <Color> { Color.LightSkyBlue, Color.Yellow, Color.Red }; var intColourIndex = 0; switch (e.ConflictInfo.Severity) { case CriticalRecordInfo.ConflictSeverity.Conflict: stbMessage.Append(@"\b \cf1 CONFLICT\cf0 :\b0 "); intColourIndex = 2; break; case CriticalRecordInfo.ConflictSeverity.Warning: stbMessage.Append(@"\b \cf2 WARNING\cf0 :\b0 "); intColourIndex = 1; break; case CriticalRecordInfo.ConflictSeverity.Info: stbMessage.Append(@"\b \cf3 INFO\cf0 :\b0 "); intColourIndex = 0; break; } var clrHighlight = lstBackgroundColours[intColourIndex]; if (m_pfpFormatProvider.HasFormat(e.ConflictedPlugin.Name)) { var pftFormat = m_pfpFormatProvider.GetFormat(e.ConflictedPlugin.Name); if (pftFormat.Highlight.HasValue && (lstBackgroundColours.IndexOf(pftFormat.Highlight.Value) > intColourIndex)) { clrHighlight = pftFormat.Highlight.Value; } } if (InstallLog.Current.GetCurrentFileOwnerName(e.ConflictingPlugin.Name) == null) { stbMessage.AppendFormat( "Form Id \\b {0:x8}\\b0 is overridden by \\b {1}\\b0 .\\par \\pard\\li720\\sl240\\slmult1 {2}\\par \\pard\\sl240\\slmult1 ", e.FormId, e.ConflictingPlugin.Name, e.ConflictInfo.Reason); } else { var fomodMod = new fomod(Path.Combine(Program.GameMode.ModDirectory, InstallLog.Current.GetCurrentFileOwnerName(e.ConflictingPlugin.Name) + ".fomod")); stbMessage.AppendFormat( "Form Id \\b {0:x8}\\b0 is overridden by \\b {1}\\b0 in \\b {2}\\b0 .\\par \\pard\\li720\\sl240\\slmult1 {3}\\par \\pard\\sl240\\slmult1 ", e.FormId, e.ConflictingPlugin.Name, fomodMod.ModName, e.ConflictInfo.Reason); } m_pfpFormatProvider.AddFormat(e.ConflictedPlugin.Name, clrHighlight, stbMessage.ToString()); }
private void gcSyncComponent_ConflictDetected_1(object sender, ConflictDetectedEventArgs e) { e.GoogleEventIsValid = true; }