public MeetingViewModel(
            Meeting meeting, 
            IList<IToolViewModel> tools,
            VideoConfViewModel videoConf,
            ISharedDataService sharedData,
            AppMode appMode)
        {
            AppMode = appMode;
            Id = meeting.Id;
            _identifierProperty = this.WhenAnyValue(v => v.Id, p => p.ToString().Substring(0, 6).ToUpper()).ToProperty(this, p => p.Identifier);
            StartTime = meeting.StartTime;
            Duration = meeting.Duration;
            Client = new ClientInfoViewModel(meeting.Client);

            PopulateMeetingStatus(meeting.Status);
            Tools = tools;
            VideoConf = videoConf;

            ActiveTool = tools.FirstOrDefault();

            this.WhenAnyValue(p => p.StartTime, p => p.DateTime.ToString("dddd")).ToProperty(this, p => p.DayOfTheWeek, out _dayOfTheWeekProperty);
            this.WhenAnyValue(p => p.StartTime, p => p.DateTime.ToString("dd")).ToProperty(this, p => p.DayOfTheMonth, out _dayOfTheMonthProperty);
            this.WhenAnyValue(p => p.StartTime, p => p.DateTime.ToString("MMMM yyyy")).ToProperty(this, p => p.MonthAndYear, out _monthAndYearProperty);
            this.WhenAnyValue(p => p.StartTime, p => p.Duration, (s, d) =>
            {
                var start = s.DateTime;
                var end = s.DateTime.Add(d);

                var startStr = start.ToString(start.Minute == 0 ? " h " : "h:mm").Trim();
                var endStr = start.ToString(end.Minute == 0 ? "h tt" : "h:mm tt");

                if (start.ToString("tt") != end.ToString("tt"))
                {
                    startStr = startStr + " " + start.ToString("tt");
                }

                return string.Format("{0} - {1}", startStr, endStr);

            }).ToProperty(this, p => p.TimeAndDuration, out _timeAndDurationProperty);
        }
Ejemplo n.º 2
0
        public MeetingViewModel(
            Meeting meeting,
            IList <IToolViewModel> tools,
            VideoConfViewModel videoConf,
            ISharedDataService sharedData,
            AppMode appMode)
        {
            AppMode             = appMode;
            Id                  = meeting.Id;
            _identifierProperty = this.WhenAnyValue(v => v.Id, p => p.ToString().Substring(0, 6).ToUpper()).ToProperty(this, p => p.Identifier);
            StartTime           = meeting.StartTime;
            Duration            = meeting.Duration;
            Client              = new ClientInfoViewModel(meeting.Client);

            PopulateMeetingStatus(meeting.Status);
            Tools     = tools;
            VideoConf = videoConf;

            ActiveTool = tools.FirstOrDefault();

            this.WhenAnyValue(p => p.StartTime, p => p.DateTime.ToString("dddd")).ToProperty(this, p => p.DayOfTheWeek, out _dayOfTheWeekProperty);
            this.WhenAnyValue(p => p.StartTime, p => p.DateTime.ToString("dd")).ToProperty(this, p => p.DayOfTheMonth, out _dayOfTheMonthProperty);
            this.WhenAnyValue(p => p.StartTime, p => p.DateTime.ToString("MMMM yyyy")).ToProperty(this, p => p.MonthAndYear, out _monthAndYearProperty);
            this.WhenAnyValue(p => p.StartTime, p => p.Duration, (s, d) =>
            {
                var start = s.DateTime;
                var end   = s.DateTime.Add(d);

                var startStr = start.ToString(start.Minute == 0 ? " h " : "h:mm").Trim();
                var endStr   = start.ToString(end.Minute == 0 ? "h tt" : "h:mm tt");

                if (start.ToString("tt") != end.ToString("tt"))
                {
                    startStr = startStr + " " + start.ToString("tt");
                }

                return(string.Format("{0} - {1}", startStr, endStr));
            }).ToProperty(this, p => p.TimeAndDuration, out _timeAndDurationProperty);
        }