Beispiel #1
0
        public MainViewModel()
        {
            _tabs = new ObservableCollection <object>();
            GeneralViewModel generalVM = new GeneralViewModel();
            MembersViewModel membersVM = new MembersViewModel();

            membersVM.Load();
            MeetingsViewModel meetingsVM = new MeetingsViewModel(membersVM.Members);

            meetingsVM.Load();

            ReportsViewModel reportsVM = new ReportsViewModel(meetingsVM.Meetings);

            _tabs.Add(generalVM);
            _tabs.Add(membersVM);
            _tabs.Add(meetingsVM);
            _tabs.Add(reportsVM);

            DateTime today = DateTime.Today.Date;
            ObservableCollection <MeetingModel> meetings = meetingsVM.Meetings;
            var meetingsToResolve = meetings.Where(it => it.Resolved == false);

            if (meetingsToResolve.Count() > 0)
            {
                var meetingsR = meetingsToResolve.OrderBy(it => it.DayOfMeeting);

                foreach (var meeting in meetingsR)
                {
                    if (meeting.DayOfMeeting < today)
                    {
                    }
                }
            }

            DateTime lastMeeting = meetings[0].DayOfMeeting;
            // need to find the meeting(s) to resolve
            // DateTime lastMeetingResolved = meetings.w
            bool resolved = meetings[0].Resolved;

            if (!resolved)
            {
                // pop up view
                //MeetingViewModel currentMeeting = new MeetingViewModel(meetings[0]);
                meetings[0].Resolved = true;
            }
            //load data files?
            // does it exist? if not create it. if it does, load it.
            //var now = DateTime.Today.ToShortDateString();
            DateTime now2 = DateTime.Today.Date;
            // any meetings missed
        }
Beispiel #2
0
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = new MainViewModel();
            MainViewModel     a = (MainViewModel)this.DataContext;
            MeetingsViewModel b = (MeetingsViewModel)a.Tabs[2];
            ObservableCollection <MeetingModel> meetings = b.Meetings;
            DateTime lastMeeting = meetings[0].DayOfMeeting;
            bool     resolved    = meetings[0].Resolved;

            if (!resolved)
            {
                // pop up view
                //MeetingViewModel currentMeeting = new MeetingViewModel(meetings[0]);
                meetings[0].Resolved = true;
            }
            //load data files?
            // does it exist? if not create it. if it does, load it.
            //var now = DateTime.Today.ToShortDateString();
            DateTime now2 = DateTime.Today.Date;
            // any meetings missed
        }
Beispiel #3
0
        private void GenerateMeeting_Click(object sender, RoutedEventArgs e)
        {
            MeetingView mv = new MeetingView();

            //mv.ShowDialog();
            // when is the next meeting?
            DateTime          now = DateTime.Today.Date;
            MainViewModel     a   = (MainViewModel)this.DataContext;
            MeetingsViewModel b   = (MeetingsViewModel)a.Tabs[2];
            ObservableCollection <MeetingModel> meetings = b.Meetings;
            DateTime lastMeeting = meetings[0].DayOfMeeting;

            DayOfWeek dow = lastMeeting.DayOfWeek;

            if (dow == DayOfWeek.Friday) // last friday of the month?
            {
                // next meeting is Wednesday, mostly
                int month = lastMeeting.Month;
                int year  = lastMeeting.Year;

                DateTime nextMonth = new DateTime(year, ++month, 1);
            }
            var t       = this.Members;
            var Members = (MembersViewModel)a.Tabs[1];
            //List<MemberModel> members = Members.MemberList;
            ObservableCollection <MemberModel> members = Members.Members;
            DateTime dayofmeeting = now;
            var      s1           = members.OrderBy(m => m.Speaker).First();

            members.Remove(s1);
            s1.Speaker = dayofmeeting;
            var s2 = members.OrderBy(m => m.Speaker).First();

            members.Remove(s2);
            s2.Speaker = dayofmeeting;
        }