public static string Convert12(PocalAppointment appt) { var ampM = appt.StartTime.ToString("tt", CultureSettings.CiEn); var result = string.Format("{0:h:mm}", appt.StartTime); return(result + " " + ampM); }
private void CalcClusterIDs(PocalAppointment currentPocalAppointment) { for (var indexInDictionary = _entriesInDictionary - 1; indexInDictionary >= 0; indexInDictionary--) { var pocalAppointment = _day.PocalApptsOfDay[indexInDictionary]; // Beim letzten Eintrag angekommen if (indexInDictionary == 0) { if (Isconfliciting(currentPocalAppointment, pocalAppointment)) { AddToClusterAccordingToOtherEntry(currentPocalAppointment, pocalAppointment, 0); break; } var lastApptInDictionary = _day.PocalApptsOfDay[_entriesInDictionary - 1]; AddToClusterAccordingToOtherEntry(currentPocalAppointment, lastApptInDictionary, +1); break; } if (!Isconfliciting(currentPocalAppointment, pocalAppointment)) { continue; } AddToClusterAccordingToOtherEntry(currentPocalAppointment, pocalAppointment, 0); break; } }
private static bool ArePocaAppointmentsEqual(PocalAppointment a, PocalAppointment b) { if (a.AllDay != b.AllDay) { return(false); } if (a.Subject != b.Subject) { return(false); } if (a.Location != b.Location) { return(false); } if (a.StartTime != b.StartTime) { return(false); } if (a.Duration != b.Duration) { return(false); } if (a.Details != b.Details) { return(false); } if (!IsRecurrenceEqual(a, b)) { return(false); } return(true); }
private static void Add(PocalAppointment pA) { SetResponsibleDays(pA); foreach (var day in _responsibleDaysOfPa) { InsertInto_PocalApptsOfDay(day, pA); } }
private static bool Isconfliciting(PocalAppointment currentAppt, PocalAppointment previousAppt) { var currentStart = currentAppt.StartTime.DateTime; var currentEnd = currentStart + currentAppt.Duration; // Wenn zwei PAs sich überschneiden, return(currentAppt != previousAppt && previousAppt.isInTimeFrame_IgnoreAllDays(currentStart, currentEnd)); }
private void AddToClusterAccordingToOtherEntry(PocalAppointment currentAppt, PocalAppointment previousAppt, int add) { int clusterOfPreviousAppt; _clusterId.TryGetValue(previousAppt, out clusterOfPreviousAppt); _clusterId.Add(currentAppt, clusterOfPreviousAppt + add); }
private bool IsCurrentConflictingWithColumn(PocalAppointment currentAppt, int columnN) { var allInColumn = GetFromColumnDicitonaryAllWith(columnN); return (allInColumn.Where(entry => entry.Key != currentAppt) .Any(entry => Isconfliciting(currentAppt, entry.Key))); }
private static void SetResponsibleDays(PocalAppointment pA) { _responsibleDaysOfPa = new List <Day>(); foreach (var day in App.ViewModel.Days.Where(day => pA.IsInTimeFrameOfDate(day.Dt))) { _responsibleDaysOfPa.Add(day); } }
private static void UpdateIfSingle(PocalAppointment oldPa, PocalAppointment newPa) { if (oldPa != null && oldPa.Appt.Recurrence == null) { RemoveAllWith(oldPa.Appt.LocalId); } if (newPa != null && newPa.Appt.Recurrence == null) { Add(newPa); } }
// ******** *************************** *********// // ******** Edits exisiting Appointment *********// // ******** *************************** *********// public static async void EditAppointment(PocalAppointment pA) { var appt = await CalendarAPI.Edit(pA.Appt); PocalAppointment newPa = null; if (appt != null) { newPa = await App.ViewModel.CreatePocalAppoinment(appt); } PocalAppointmentUpdater.Update(pA, newPa); }
private static void InsertInto_PocalApptsOfDay(Day day, PocalAppointment pA) { var nextDay = day.PocalApptsOfDay.FirstOrDefault(x => x.Appt.StartTime > pA.Appt.StartTime); if (nextDay != null) { var index = day.PocalApptsOfDay.IndexOf(nextDay); day.PocalApptsOfDay.Insert(index, pA); } else { day.PocalApptsOfDay.Insert(day.PocalApptsOfDay.Count(), pA); } }
public void SDV_AppointmentTap(object sender, System.Windows.Input.GestureEventArgs e) { PocalAppointment pocalAppointment = ((FrameworkElement)sender).DataContext as PocalAppointment; Storyboard storyboard = ((FrameworkElement)sender).Resources["tapFeedback"] as Storyboard; if (storyboard != null) { storyboard.Begin(); } Dispatcher.BeginInvoke(() => { PocalAppointmentHelper.EditAppointment(pocalAppointment); }); }
public static async void Update(PocalAppointment oldPa, PocalAppointment newPa) { // soll Aufflackern des Termins verhindern, wenn keine Änderungen gemacht wurden. if (oldPa != null && newPa != null) { if (ArePocaAppointmentsEqual(oldPa, newPa)) { return; } } UpdateIfSingle(oldPa, newPa); await UpdateIfRecurrent(oldPa, newPa); App.ViewModel.ConflictManager.SolveConflicts(); ViewSwitcher.Mainpage.SingleDayViewer.Update_PocalAppointment(oldPa, newPa); }
public void SDV_AppointmentTap(object sender, System.Windows.Input.GestureEventArgs e) { //UpdateLayout(); // Vielleicht verlangsamt das die UX! Vielleicht behebt das jedoch den TapOffset Bug. PocalAppointment pocalAppointment = ((FrameworkElement)sender).DataContext as PocalAppointment; Storyboard storyboard = ((FrameworkElement)sender).Resources["tapFeedback"] as Storyboard; if (storyboard != null) { storyboard.Begin(); } Dispatcher.BeginInvoke(() => { PocalAppointmentHelper.EditAppointment(pocalAppointment); }); }
private void CalcColumns(PocalAppointment currentAppt) { for (var columnN = 1; columnN < 5; columnN++) { if (IsCurrentConflictingWithColumn(currentAppt, columnN)) { if (columnN == 4) { InsertColumn(currentAppt, 4); } } else { InsertColumn(currentAppt, columnN); break; } } }
private static async Task UpdateIfRecurrent(PocalAppointment oldPa, PocalAppointment newPa) { if (oldPa != null && oldPa.Appt.Recurrence != null) { // Todo fixme RemoveRecurrent(oldPa.Appt); // für den fall, dass Nur ein Termin entfernt wurde, müssen alle anderen alten Recurrenztermine wieder neu geaddet werden if (newPa == null) { await AddRecurrent(oldPa.Appt); } } if (newPa != null && newPa.Appt.Recurrence != null) { await AddRecurrent(newPa.Appt); } }
public void Update_PocalAppointment(PocalAppointment oldPA, PocalAppointment newPA) { for (int i = GridAppointments.Children.Count - 1; i >= 0; i--) { FrameworkElement item = GridAppointments.Children[i] as FrameworkElement; if (item.DataContext == oldPA) { GridAppointments.Children.Remove(item); } } if (newPA != null && newPA.AllDay == false && newPA.StartTime.Date == App.ViewModel.SingleDayViewModel.TappedDay.Dt.Date) { //fixme newPA = App.ViewModel.SingleDayViewModel.TappedDay.PocalApptsOfDay.FirstOrDefault(x => x.Appt.LocalId == newPA.Appt.LocalId); SDV_Appointment_Control control = new SDV_Appointment_Control(); control.DataContext = newPA; GridAppointments.Children.Add(control); } }
private static bool IsRecurrenceEqual(PocalAppointment a, PocalAppointment b) { if (a.Appt.Recurrence == null && b.Appt.Recurrence == null) { return(true); } // Bei Änderung von Recurrence zu nicht Recurrenz, oder anders herum. if (a.Appt.Recurrence == null || b.Appt.Recurrence == null) { return(false); } if (a.Appt.Recurrence.Day != b.Appt.Recurrence.Day) { return(false); } if (a.Appt.Recurrence.DaysOfWeek != b.Appt.Recurrence.DaysOfWeek) { return(false); } if (a.Appt.Recurrence.Interval != b.Appt.Recurrence.Interval) { return(false); } if (a.Appt.Recurrence.Month != b.Appt.Recurrence.Month) { return(false); } if (a.Appt.Recurrence.RecurrenceType != b.Appt.Recurrence.RecurrenceType) { return(false); } return(true); }
private void InsertColumn(PocalAppointment currentAppt, int columnN) { _column.Add(currentAppt, columnN); }
public static void SetScrollToPa(PocalAppointment pa) { _scrollToPa = pa; }
private void InsertClusterId(PocalAppointment currentAppt, int id) { _clusterId.Add(currentAppt, id); }
public static string Convert24(PocalAppointment appt) { return(string.Format("{0:HH:mm}", appt.StartTime)); }