/// <summary> /// 画日期按钮 /// </summary> public void DrawDaysButton() { try { daybuttons.Clear(); mydates = new MyDates(); year = mydates.Days[20].year; month = mydates.Days[20].month; for (int i = 0; i < 6; i++) { for (int j = 0; j < 7; j++) { Button daybutton = new Button(); daybutton.Width = daybuttonsize; daybutton.Height = daybuttonsize; daybutton.BorderBrush = null; daybutton.BorderThickness = new Thickness(0); daybutton.FontSize = 14; daybutton.Click += new RoutedEventHandler(DayButton_Click); CalendarDays.Children.Add(daybutton); Canvas.SetTop(daybutton, i * daybuttonsize); Canvas.SetLeft(daybutton, j * daybuttonsize); daybuttons.Add(i * 7 + j, daybutton); } } } catch (Exception) { } showdays(); }
//public void DevideDateOptionsList() private void LoadListValues() { var otherDateOptionsWrapper = new List <DateOptionWrapper>(); var otherDates = new List <DateTime>(); if (DateEvent.DateOptions != null && DateEvent.DateOptions.Count != 0) { foreach (DateOption dE in DateEvent.DateOptions) { if (dE.Proposer.Equals(App.myUser)) { MyDates.Add(dE.Date); } else { otherDateOptionsWrapper.Add(new DateOptionWrapper(dE)); otherDates.Add(dE.Date); } } //It works with CompareTo(DateOptionWrapper) otherDateOptionsWrapper.Sort(); MyDates.Sort(); OtherDateOptions = new ObservableCollection <DateOptionWrapper>(otherDateOptionsWrapper); CalendarBlackoutDates = otherDates; } }
public void DevideDateOptionsList() { var dateOptions = dateEvent.DateOptions; if (dateOptions != null) { //Se cogen las fechas de los eventos propuestos por myUser foreach (DateOption dO in dateOptions) { if (dO.Proposer.Equals(App.myUser)) { MyDates.Add(dO.Date); dateOptions.Remove(dO); } } //Se introducen las fechas del resto de usuarios OtherDateOptions = dateOptions; } }
void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { mydates = new MyDates(); mydates = new MyDates(new DateTime(year, month, 1)); }