//private readonly Queue<QueueItem> _queue = new Queue<QueueItem>(); //private readonly object _queueLock = new object(); //private readonly CancellationTokenSource _token; //public delegate void QueueItemEvent(QueueItem item); //public event QueueItemEvent OnQueueItemHandle; //public event QueueItemEvent OnQueueItemHandled; //public QueueItem CurrentItem { get; private set; } //public Task Task { get; private set; } public GoogleCalendarReminderManager(ref GoogleCalendar gc) { _gc = gc; //_token = new CancellationTokenSource(); //Task = Task.Factory.StartNew(async () => // { // while (true) // { // QueueItem item = null; // lock (_queueLock) // { // if (_queue.Count > 0) // item = _queue.Dequeue(); // } // if (item != null) // HandleQueueItem(item); // if (_token.IsCancellationRequested) // { // // TODO: Save queue to disk. // } // await Task.Delay(1000, _token.Token); // } // }, _token.Token); }
static void Main(string[] args) { GoogleCalendar gCalendar = new GoogleCalendar(credentialsPath); gCalendar.ShowUpCommingEvent(); gCalendar.CreateEvent(); }
public CalendarModel() { this.Days = new List <CalendarDayModel>(); var calendarEvents = GoogleCalendar.GetUpcomingEvents(10, 60); foreach (var evt in calendarEvents.Items) { DateTime eventStart = DateTime.MinValue; if (evt.Start.DateTime.HasValue) { eventStart = evt.Start.DateTime.Value; } else { eventStart = DateTime.Parse(evt.Start.Date); } var eventDay = this.Days.FirstOrDefault(day => day.Date.Date == eventStart.Date); if (eventDay == null) { eventDay = new CalendarDayModel(eventStart); this.Days.Add(eventDay); } var item = new CalendarItemModel(); item.Title = evt.Summary; item.Start = eventStart; item.End = eventStart; if (evt.End.DateTime.HasValue) { item.End = evt.End.DateTime.Value; } eventDay.Items.Add(item); } }
public AnnouncementMessage(GoogleCalendar calendar, DataService data, Random random, LogHandler log) { _log = log; _calendar = calendar; _data = data; _random = random; }
public IActionResult Authorize() { var googleCalendar = new GoogleCalendar("mycalendar_credentials.json"); var events = googleCalendar.ShowUpCommingEvent(); googleCalendar.CreateEvent(); return(View("Index", events)); }
public LevelTesting(DataServices dataServices, Random random) { _dataServices = dataServices; _random = random; _googleCalendar = new GoogleCalendar(_dataServices); currentEventInfo = _googleCalendar.GetEvents(); //Initial get of playtest. lastEventInfo = currentEventInfo; //Make sure array is same size for doing compares later. }
private void SyncItem_Click(object sender, RoutedEventArgs e) { subjectModel.Items.Clear(); foreach (var i in GoogleCalendar.GetSubjects(new DateTime(DateTime.Today.Year, 1, 1), new DateTime(DateTime.Today.Year, 12, 31))) { subjectModel.Items.Add(i); } }
public async Task <IEnumerable <Event> > GetEventsForCalendar(string calendarId) { const string serviceAccountEmail = @"*****@*****.**"; var keyFileName = System.Web.Hosting.HostingEnvironment.MapPath(@"~/My Project-5ebf1707235e.json"); const int maxResults = 10; return(await GoogleCalendar.GetUpcomingCalendarEvents(serviceAccountEmail, keyFileName, calendarId, maxResults)); }
public void ReclaimOrphanCalendarEntries(ref List <AppointmentItem> oAppointments, ref List <Event> gEvents) { log.Debug("Looking for orphaned items to reclaim..."); //This is needed for people migrating from other tools, which do not have our GoogleID extendedProperty List <AppointmentItem> unclaimedAi = new List <AppointmentItem>(); for (int o = oAppointments.Count - 1; o >= 0; o--) { AppointmentItem ai = oAppointments[o]; //Find entries with no Google ID if (ai.UserProperties[gEventID] == null) { unclaimedAi.Add(ai); foreach (Event ev in gEvents) { //Use simple matching on start,end,subject,location to pair events String sigAi = signature(ai); String sigEv = GoogleCalendar.signature(ev); if (Settings.Instance.Obfuscation.Enabled) { if (Settings.Instance.Obfuscation.Direction == SyncDirection.OutlookToGoogle) { sigAi = Obfuscate.ApplyRegex(sigAi, SyncDirection.OutlookToGoogle); } else { sigEv = Obfuscate.ApplyRegex(sigEv, SyncDirection.GoogleToOutlook); } } if (sigAi == sigEv) { AddOGCSproperty(ref ai, gEventID, ev.Id); updateCalendarEntry_save(ai); unclaimedAi.Remove(ai); MainForm.Instance.Logboxout("Reclaimed: " + GetEventSummary(ai), verbose: true); break; } } } } if ((Settings.Instance.SyncDirection == SyncDirection.GoogleToOutlook || Settings.Instance.SyncDirection == SyncDirection.Bidirectional) && unclaimedAi.Count > 0 && !Settings.Instance.MergeItems && !Settings.Instance.DisableDelete && !Settings.Instance.ConfirmOnDelete) { if (MessageBox.Show(unclaimedAi.Count + " Outlook calendar items can't be matched to Google.\r\n" + "Remember, it's recommended to have a dedicated Outlook calendar to sync with, " + "or you may wish to merge with unmatched events. Continue with deletions?", "Delete unmatched Outlook items?", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No) { foreach (AppointmentItem ai in unclaimedAi) { oAppointments.Remove(ai); } } } }
public WeekEvent(GoogleCalendar.Data.Event evenement) { InitializeComponent(); Evt = evenement; if (mEvent.Summary == null) mEvent.Summary = ""; this.title.Text = mEvent.Summary; if (!String.IsNullOrEmpty(mEvent.Start.DateTime)) this.time.Text = DateTime.Parse(mEvent.Start.DateTime).ToString("HH:mm") + " - " + DateTime.Parse(mEvent.End.DateTime).ToString("HH:mm"); }
public ModerationModule(DataService data, DiscordSocketClient client, LogHandler log, GoogleCalendar calendar, PlaytestService playtestService, InteractiveService interactive) { _playtestService = playtestService; _calendar = calendar; _data = data; _client = client; _log = log; _interactive = interactive; }
public PlaytestService(DataService data, GoogleCalendar calendar, LogHandler log, Random random) { _data = data; _log = log; _calendar = calendar; PlaytestAnnouncementMessage = null; _oldMessage = null; _announcementMessage = new AnnouncementMessage(_calendar, _data, random, _log); }
private void SyncCalendar(int InstructorID) { InstructorBusiness InsBO = new InstructorBusiness(); Instructor Ins = InsBO.GetInstructorByID(InstructorID); //Neu chua co teken thi ko lam gi het if (Ins.ApiToken == null) { return; } SimpleLog.Info("Begin Sync Calendar for Instructor " + Ins.Fullname + "."); try { String RefreshToken = Ins.ApiToken; var WrapperAPI = new GoogleCalendarAPIWrapper(RefreshToken); //Tim toan bo lich cua instructor var Calendars = WrapperAPI.GetCalendarList(); //Tim xem da co teaching calendar chua, chua co thi insert GoogleCalendar TeachingCalendar = Calendars.Items.SingleOrDefault(ca => ca.Summary.Equals("Teaching Calendar")); if (TeachingCalendar == null) { TeachingCalendar = WrapperAPI.InsertCalendar("Teaching Calendar"); } else { //Clear nhung ngay trong tuong lai WrapperAPI.ClearFutureDateCalendar(TeachingCalendar.ID); } //Bat dau lay event, ghi vao calendar. StudySessionBusiness StuSesBO = new StudySessionBusiness(); //Chi lay nhung event trong tuong lai, tiet kiem dung luong List <Event> Events = StuSesBO.GetCalendarEvent(InstructorID). Where(e => e.StartDate >= DateTime.Now).ToList(); foreach (var Event in Events) { WrapperAPI.InsertEvent(TeachingCalendar.ID, Event.title, Event.StartDate, Event.EndDate); } String Message = String.Format("Succesfull sync {0} events, from {1:dd-MM-yyyy} to {2:dd-MM-yyyy}", Events.Count, Events.First().StartDate, Events.Last().StartDate); SimpleLog.Info(Message); } catch (Exception e) { SimpleLog.Error("Error while trying to sync."); SimpleLog.Error(e.Message); } }
public void Init(Library l) { _storage.Init(l); SearchManager = new SearchManager(_storage); _settings = new Settings(_storage); _gc = new GoogleCalendar(ref _settings); ReminderManager = new GoogleCalendarReminderManager(ref _gc); TextClipper = new TextClipper(); Reminders = new Reminders(ref _storage); EncryptionManager = new EncryptionManager(_storage.DataStore); TagManager = new TagManager(); }
//Cuando marcamos en google, trata de conectar con nuestra cuenta si no lo consigue nos manda a internet a indicar los datos private void botonGoogleCalendar_Click(object sender, RoutedEventArgs e) { if (_calendariogoogle is null) { _calendariogoogle = new GoogleCalendar(); ObtenerEventos(); EventosOriginales = _eventos.ToList(); Calendar.IsEnabled = true; ListaEventosGoogleCalendar.IsEnabled = true; GridFormulario.IsEnabled = true; } }
public MainViewModel(GoogleCalendar googleCalendar) { try { log.Debug("Loading MainWindow view model..."); calendar = googleCalendar; SelectEventsTabCommand = new RelayCommand(SelectEventsTab); log.Debug("MainWindow view model was succssfully loaded"); } catch (Exception ex) { log.Error("Failed to load MainWindow view model:", ex); } }
public void CreateCalendarEntries(List <Event> events) { foreach (Event ev in events) { AppointmentItem newAi = IOutlook.UseOutlookCalendar().Items.Add() as AppointmentItem; try { newAi = createCalendarEntry(ev); } catch (System.Exception ex) { if (!Settings.Instance.VerboseOutput) { MainForm.Instance.Logboxout(GoogleCalendar.GetEventSummary(ev)); } MainForm.Instance.Logboxout("WARNING: Appointment creation failed.\r\n" + ex.Message); log.Error(ex.StackTrace); if (MessageBox.Show("Outlook appointment creation failed. Continue with synchronisation?", "Sync item failed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { continue; } else { newAi = (AppointmentItem)ReleaseObject(newAi); throw new UserCancelledSyncException("User chose not to continue sync."); } } try { createCalendarEntry_save(newAi, ev); } catch (System.Exception ex) { MainForm.Instance.Logboxout("WARNING: New appointment failed to save.\r\n" + ex.Message); log.Error(ex.StackTrace); if (MessageBox.Show("New Outlook appointment failed to save. Continue with synchronisation?", "Sync item failed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { continue; } else { newAi = (AppointmentItem)ReleaseObject(newAi); throw new UserCancelledSyncException("User chose not to continue sync."); } } if (ev.Recurrence != null && ev.RecurringEventId == null && Recurrence.Instance.HasExceptions(ev)) { MainForm.Instance.Logboxout("This is a recurring item with some exceptions:-"); Recurrence.Instance.CreateOutlookExceptions(newAi, ev); MainForm.Instance.Logboxout("Recurring exceptions completed."); } newAi = (AppointmentItem)ReleaseObject(newAi); } }
private AppointmentItem createCalendarEntry(Event ev) { string itemSummary = GoogleCalendar.GetEventSummary(ev); log.Debug("Processing >> " + itemSummary); MainForm.Instance.Logboxout(itemSummary, verbose: true); AppointmentItem ai = IOutlook.UseOutlookCalendar().Items.Add() as AppointmentItem; //Add the Google event ID into Outlook appointment. AddOGCSproperty(ref ai, gEventID, ev.Id); ai.Start = new DateTime(); ai.End = new DateTime(); ai.AllDayEvent = (ev.Start.Date != null); ai = OutlookCalendar.Instance.IOutlook.WindowsTimeZone_set(ai, ev); Recurrence.Instance.BuildOutlookPattern(ev, ai); ai.Subject = Obfuscate.ApplyRegex(ev.Summary, SyncDirection.GoogleToOutlook); if (Settings.Instance.AddDescription && ev.Description != null) { ai.Body = ev.Description; } ai.Location = ev.Location; ai.Sensitivity = (ev.Visibility == "private") ? OlSensitivity.olPrivate : OlSensitivity.olNormal; ai.BusyStatus = (ev.Transparency == "transparent") ? OlBusyStatus.olFree : OlBusyStatus.olBusy; if (Settings.Instance.AddAttendees && ev.Attendees != null) { foreach (EventAttendee ea in ev.Attendees) { createRecipient(ea, ai); } } //Reminder alert if (Settings.Instance.AddReminders && ev.Reminders != null && ev.Reminders.Overrides != null) { foreach (EventReminder reminder in ev.Reminders.Overrides) { if (reminder.Method == "popup") { ai.ReminderSet = true; ai.ReminderMinutesBeforeStart = (int)reminder.Minutes; } } } return(ai); }
public static void CreateGoogleExceptions(AppointmentItem ai, String recurringEventId) { if (!ai.IsRecurring) { return; } log.Debug("Creating Google recurrence exceptions."); List <Event> gRecurrences = GoogleCalendar.Instance.GetCalendarEntriesInRecurrence(recurringEventId); if (gRecurrences != null) { Microsoft.Office.Interop.Outlook.Exceptions exps = ai.GetRecurrencePattern().Exceptions; foreach (Microsoft.Office.Interop.Outlook.Exception oExcp in exps) { for (int g = 0; g < gRecurrences.Count; g++) { Event ev = gRecurrences[g]; String gDate = ev.OriginalStartTime.DateTime ?? ev.OriginalStartTime.Date; Boolean isDeleted = exceptionIsDeleted(oExcp); if (isDeleted && !ai.AllDayEvent) //Deleted items get truncated?! { gDate = GoogleCalendar.GoogleTimeFrom(DateTime.Parse(gDate).Date); } if (oExcp.OriginalDate == DateTime.Parse(gDate)) { if (isDeleted) { MainForm.Instance.Logboxout(GoogleCalendar.GetEventSummary(ev)); MainForm.Instance.Logboxout("Recurrence deleted."); ev.Status = "cancelled"; GoogleCalendar.Instance.UpdateCalendarEntry_save(ref ev); } else { int exceptionItemsModified = 0; Event modifiedEv = GoogleCalendar.Instance.UpdateCalendarEntry(oExcp.AppointmentItem, ev, ref exceptionItemsModified, forceCompare: true); if (exceptionItemsModified > 0) { GoogleCalendar.Instance.UpdateCalendarEntry_save(ref modifiedEv); } } break; } } } } }
public PlaytestService(DataService data, GoogleCalendar calendar, LogHandler log, Random random, ReservationService reservationService, RconService rconService, SrcdsLogService srcdsLogService, DiscordSocketClient client) { _dataService = data; _log = log; _calendar = calendar; _reservationService = reservationService; _srcdsLogService = srcdsLogService; _client = client; _rconService = rconService; _announcementMessage = new AnnouncementMessage(_dataService, random, _log); _srcdsLogService.PostStartSetup(this); }
static void Main(string[] args) { // Set up IoC container var builder = new ContainerBuilder(); builder.RegisterInstance(new GoogleAPIconnection()) .As <IGoogleAPIconnection>(); var container = builder.Build(); // Run some code var apiConnection = container.Resolve <IGoogleAPIconnection>(); var googleCalendar = new GoogleCalendar(apiConnection, "Google Calendar API .NET Quickstart"); // DEBUG //googleCalendar.GetEvents(); //googleCalendar.GetAllUserCalendars(); //googleCalendar.GetEventByDateTime(DateTime.UtcNow, DateTime.UtcNow+TimeSpan.FromDays(7)); //googleCalendar.AddEvent("Sprzatanie", // "Home", // "Code a lot in .NET", // DateTime.UtcNow.AddDays(1).AddHours(14), // DateTime.UtcNow.AddDays(1).AddHours(16), // "Europe/Warsaw", // true); //var eventToUpdate = googleCalendar.GetEventByDateTime(DateTime.UtcNow.AddDays(5), DateTime.UtcNow.AddDays(7)); //googleCalendar.UpdateEvent(eventToUpdate.Id, new Event() //{ // Summary = "Updated Summary", // Location = "Home", // Description = "some description", // Start = new EventDateTime() // { // DateTime = DateTime.UtcNow.AddDays(1).AddHours(16), // TimeZone = "Europe/Warsaw" // }, // End = new EventDateTime() // { // DateTime = DateTime.UtcNow.AddDays(1).AddHours(17), // TimeZone = "Europe/Warsaw" // }, //}); //var eventToDelete = googleCalendar.GetEventByDateTime(DateTime.UtcNow.AddDays(6), DateTime.UtcNow.AddDays(7)); //googleCalendar.DeleteEvent(eventToDelete.Id); }
public Event GetGoogleInstance(Microsoft.Office.Interop.Outlook.Exception oExcp, String gRecurringEventID, String oEntryID) { Boolean oIsDeleted = exceptionIsDeleted(oExcp); log.Debug("Finding Google instance for " + (oIsDeleted ? "deleted " : "") + "Outlook exception:-"); log.Debug(" Original date: " + oExcp.OriginalDate.ToString("dd/MM/yyyy")); if (!oIsDeleted) { log.Debug(" Current date: " + oExcp.AppointmentItem.Start.ToString("dd/MM/yyyy")); } foreach (Event gExcp in googleExceptions) { if (gExcp.RecurringEventId == gRecurringEventID) { if ((!oIsDeleted && GoogleCalendar.GoogleTimeFrom(oExcp.OriginalDate) == (gExcp.OriginalStartTime.Date ?? gExcp.OriginalStartTime.DateTime) ) || (oIsDeleted && GoogleCalendar.GoogleTimeFrom(oExcp.OriginalDate) == (gExcp.OriginalStartTime.Date ?? GoogleCalendar.GoogleTimeFrom(DateTime.Parse(gExcp.OriginalStartTime.DateTime).Date)) )) { return(gExcp); } } } log.Debug("Google exception event is not cached. Retrieving all recurring instances..."); List <Event> gInstances = GoogleCalendar.Instance.GetCalendarEntriesInRecurrence(gRecurringEventID); //Add any new exceptions to local cache googleExceptions = googleExceptions.Union(gInstances.Where(ev => !String.IsNullOrEmpty(ev.RecurringEventId))).ToList(); foreach (Event gInst in gInstances) { if (gInst.RecurringEventId == gRecurringEventID) { if (((!oIsDeleted || (oIsDeleted && !oExcp.Deleted)) && /* Weirdness when exception is cancelled by organiser but not yet deleted/accepted by recipient */ GoogleCalendar.GoogleTimeFrom(oExcp.OriginalDate) == GoogleCalendar.GoogleTimeFrom(DateTime.Parse(gInst.OriginalStartTime.Date ?? gInst.OriginalStartTime.DateTime)) ) || (oIsDeleted && GoogleCalendar.GoogleTimeFrom(oExcp.OriginalDate) == GoogleCalendar.GoogleTimeFrom(DateTime.Parse(gInst.OriginalStartTime.Date ?? gInst.OriginalStartTime.DateTime).Date) )) { return(gInst); } } } return(null); }
//每10分钟执行一次 public void TimerTask(object source, ElapsedEventArgs e) { Process processes = GetCurrentProcesses(); if (processes != null) { GoogleCalendar.Report(DateTime.Now, processes.ProcessName, processes.MainWindowTitle, 10, GetEventColor(processes.ProcessName)); MainWindow.Notify("已上报 ->" + processes.ProcessName); } else { GoogleCalendar.Report(DateTime.Now, "无活跃程序", "", 10, "8"); } //屏幕截屏 ScreenShot.ShotAll(Config.GetConfig <ConfigData>().ShotPosition); }
public string GetCID(string calendarName) { string id = null; try { string AdminuserName = ConfigurationManager.AppSettings["AdminCalendarUser"].ToString(); string AdminuserPwd = ConfigurationManager.AppSettings["AdminCalendarPwd"].ToString(); GoogleCalendar calendar = new GoogleCalendar(calendarName, AdminuserName, AdminuserPwd); id = calendar.GetCalendarId(); } catch (Exception ex) { //LogManager.Instance.WriteToFlatFile("stepPage" + ex.Message); } return(id); }
private async Task <IActionResult> UpdateRequestState( int id, AbsenceRequestState newState ) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var request = await _repo.Find(id); if (request == null) { return(NotFound()); } if (request.State != AbsenceRequestState.Requested) { return(BadRequest(ModelState)); } request.State = newState; await _repo.Save(); if (newState == AbsenceRequestState.Approved) { GoogleCalendar.AddToCalendar(request.FromDate, request.ToDate); } } catch (DbUpdateConcurrencyException) { if (!await AbsenceRequestExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public RequestBuilder(SocketCommandContext context, InteractiveService interactive, DataService data, LogHandler log, GoogleCalendar calendar, PlaytestService playtestService) { _context = context; _interactive = interactive; _dataService = data; _log = log; _calendar = calendar; _playtestService = playtestService; //Make the test object _testRequest = new PlaytestRequest(); _isDms = context.IsPrivate; _workshop = new Workshop(_dataService, _log); _otherRequests = null; _scheduledTests = null; }
public static async Task <Event> CreateGoogleCalendar(GoogleCalendar request) { string[] Scopes = { "https://www.googleapis.com/auth/calendar" }; string ApplicationName = "Google Canlendar Api"; UserCredential credential; using (var stream = new FileStream(Path.Combine(Directory.GetCurrentDirectory(), "Cre", "cre.json"), FileMode.Open, FileAccess.Read)) { string credPath = "token.json"; credential = GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, Scopes, "user", CancellationToken.None, new FileDataStore(credPath, true)).Result; } // define services var services = new CalendarService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = ApplicationName, }); // define request Event eventCalendar = new Event() { Summary = request.Summary, Location = request.Location, Start = new EventDateTime { DateTime = request.Start, TimeZone = "Asia/Ho_Chi_Minh" }, End = new EventDateTime { DateTime = request.End, TimeZone = "Asia/Ho_Chi_Minh" }, Description = request.Description }; var eventRequest = services.Events.Insert(eventCalendar, "primary"); var requestCreate = await eventRequest.ExecuteAsync(); return(requestCreate); }
public Event GetGoogleMasterEvent(AppointmentItem ai) { log.Fine("Found a master Outlook recurring item outside sync date range: " + OutlookCalendar.GetEventSummary(ai)); List <Event> events = new List <Event>(); if (ai.UserProperties[OutlookCalendar.gEventID] == null) { events = GoogleCalendar.Instance.GetCalendarEntriesInRange(ai.Start.Date, ai.Start.Date.AddDays(1)); List <AppointmentItem> ais = new List <AppointmentItem>(); ais.Add(ai); GoogleCalendar.Instance.ReclaimOrphanCalendarEntries(ref events, ref ais, neverDelete: true); } else { Event ev = GoogleCalendar.Instance.GetCalendarEntry(ai.UserProperties[OutlookCalendar.gEventID].Value.ToString()); if (ev != null) { events.Add(ev); } } for (int g = 0; g < events.Count(); g++) { String gEntryID; Event ev = events[g]; if (GoogleCalendar.GetOGCSproperty(ev, GoogleCalendar.oEntryID, out gEntryID)) { if (gEntryID == ai.EntryID) { log.Info("Migrating Master Event from EntryID to GlobalAppointmentID..."); GoogleCalendar.AddOutlookID(ref ev, ai); GoogleCalendar.Instance.UpdateCalendarEntry_save(ref ev); return(ev); } else if (gEntryID == OutlookCalendar.Instance.IOutlook.GetGlobalApptID(ai)) { log.Fine("Found master event."); return(ev); } } } log.Warn("Failed to find master Google event for: " + OutlookCalendar.GetEventSummary(ai)); return(null); }
private static string exportToCSV(AppointmentItem ai) { System.Text.StringBuilder csv = new System.Text.StringBuilder(); csv.Append(GoogleCalendar.GoogleTimeFrom(ai.Start) + ","); csv.Append(GoogleCalendar.GoogleTimeFrom(ai.End) + ","); csv.Append("\"" + ai.Subject + "\","); if (ai.Location == null) { csv.Append(","); } else { csv.Append("\"" + ai.Location + "\","); } if (ai.Body == null) { csv.Append(","); } else { String csvBody = ai.Body.Replace("\"", ""); csvBody = csvBody.Replace("\r\n", " "); csv.Append("\"" + csvBody.Substring(0, System.Math.Min(csvBody.Length, 100)) + "\","); } csv.Append("\"" + ai.Sensitivity.ToString() + "\","); csv.Append("\"" + ai.BusyStatus.ToString() + "\","); csv.Append("\"" + (ai.RequiredAttendees == null?"":ai.RequiredAttendees) + "\","); csv.Append("\"" + (ai.OptionalAttendees == null?"":ai.OptionalAttendees) + "\","); csv.Append(ai.ReminderSet + ","); csv.Append(ai.ReminderMinutesBeforeStart.ToString() + ","); csv.Append(OutlookCalendar.Instance.IOutlook.GetGlobalApptID(ai) + ","); if (ai.UserProperties[gEventID] != null) { csv.Append(ai.UserProperties[gEventID].Value.ToString()); } return(csv.ToString()); }
public ScheduleHandler(DataService data, DiscordSocketClient client, LogHandler log, PlaytestService playtestService , UserHandler userHandler, Random random, ReservationService reservationService, GoogleCalendar calendar) { Console.WriteLine("Setting up ScheduleHandler..."); _playtestService = playtestService; _log = log; _dataService = data; _client = client; _userHandler = userHandler; _random = random; _reservationService = reservationService; _calendar = calendar; //Fluent Scheduler init and events JobManager.Initialize(new Registry()); JobManager.JobStart += FluentJobStart; JobManager.JobEnd += FluentJobEnd; JobManager.JobException += FluentJobException; }
private static void createCalendarEntry_save(AppointmentItem ai, Event ev) { if (Settings.Instance.SyncDirection == SyncDirection.Bidirectional) { log.Debug("Saving timestamp when OGCS updated appointment."); AddOGCSproperty(ref ai, Program.OGCSmodified, DateTime.Now); } ai.Save(); Boolean oKeyExists = false; try { oKeyExists = ev.ExtendedProperties.Private.ContainsKey(GoogleCalendar.oEntryID); } catch {} if (Settings.Instance.SyncDirection == SyncDirection.Bidirectional || oKeyExists) { log.Debug("Storing the Outlook appointment ID in Google event."); GoogleCalendar.AddOutlookID(ref ev, ai, Environment.MachineName); GoogleCalendar.Instance.UpdateCalendarEntry_save(ev); } }