Inheritance: INotifyPropertyChanged
コード例 #1
0
        public WorkMonth(int year, int month, GermanSpecialDays specialDays, WorkDayParserSettings parserSettings, float hoursPerDay)
        {
            this.year              = year;
            this.month             = month;
            this.hoursPerDay       = hoursPerDay;
            this.Weeks             = new ObservableCollection <WorkWeek>();
            this.Days              = new ObservableCollection <WorkDay>();
            this.ShortCutStatistic = new QuickFillObservableCollection <ShortCutStatistic>();
            // TODO which date should i take?
            this.ReloadShortcutStatistic(parserSettings.ShortCuts);

            var      cal      = CultureInfo.CurrentCulture.Calendar;
            WorkWeek lastWeek = null;

            for (int day = 1; day <= cal.GetDaysInMonth(year, month); day++)
            {
                var dt = new DateTime(year, month, day);

                WorkDay wd = new WorkDay(year, month, day, specialDays);
                this.Days.Add(wd);
                var weekOfYear = cal.GetWeekOfYear(dt);
                if (lastWeek == null || lastWeek.WeekOfYear != weekOfYear)
                {
                    lastWeek = new WorkWeek(this, weekOfYear);
                    lastWeek.PropertyChanged += new PropertyChangedEventHandler(this.WeekPropertyChanged);
                    this.Weeks.Add(lastWeek);
                }
                lastWeek.AddDay(wd);
            }
        }
コード例 #2
0
ファイル: WorkMonth.cs プロジェクト: vipwolf/moni
        public WorkMonth(int year, int month, GermanSpecialDays specialDays, IEnumerable<ShortCut> shortCuts, float hoursPerDay)
        {
            this.year = year;
              this.month = month;
              this.hoursPerDay = hoursPerDay;
              this.Weeks = new ObservableCollection<WorkWeek>();
              this.Days = new ObservableCollection<WorkDay>();
              this.ShortCutStatistic = new ObservableCollection<KeyValuePair<string, ShortCutStatistic>>();
              // TODO which date should i take?
              this.ReloadShortcutStatistic(shortCuts);

              var cal = new GregorianCalendar();
              WorkWeek lastWeek = null;
              for (int day = 1; day <= cal.GetDaysInMonth(year, month); day++) {
            var dt = new DateTime(year, month, day);

            WorkDay wd = new WorkDay(year, month, day, specialDays);
            this.Days.Add(wd);
            var weekOfYear = cal.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
            if (lastWeek == null || lastWeek.WeekOfYear != weekOfYear) {
              lastWeek = new WorkWeek(this, weekOfYear);
              lastWeek.PropertyChanged += new PropertyChangedEventHandler(this.WeekPropertyChanged);
              this.Weeks.Add(lastWeek);
            }
            lastWeek.AddDay(wd);
              }
        }
コード例 #3
0
ファイル: ShortcutViewModel.cs プロジェクト: vipwolf/moni
 public ShortcutViewModel(ShortCut shortCut, WorkWeek workWeek, MoniSettings settings, Action closeAction)
 {
     this.viewcloseAction = closeAction;
       this.moniSettings = settings;
       this.workWeek = workWeek;
       this.Model = shortCut ?? new ShortCut();
       this.IsNew = shortCut == null;
       this.ShortCutKey = this.Model.Key;
 }
コード例 #4
0
ファイル: ShortcutViewModel.cs プロジェクト: dotob/moni
 public ShortcutViewModel(ShortCut shortCut, WorkWeek workWeek, MoniSettings settings, Action closeAction)
 {
     this.viewcloseAction = closeAction;
     this.MoniSettings = settings;
     this.workWeek = workWeek;
     this.Model = shortCut ?? new ShortCut();
     this.IsNew = shortCut == null;
     this.ShortCutKey = this.Model.Key;
     this.ShortCutGroup = settings.ParserSettings.ShortCutGroups.FirstOrDefault(sg => Equals(sg.Key, this.Model.Group));
     this.ShortCutGroupKey = this.Model.Group;
 }