public MainWindow()
        {
            InitializeComponent();

            // Установка перечеркнутых (blackout) дат на элементе Calendar
            DateTime dt = DateTime.Now;
            CalendarDateRange range = new CalendarDateRange(dt.Add(new TimeSpan(2, 0, 0, 0)), dt.Add(new TimeSpan(4, 0, 0, 0)));
            calendar.BlackoutDates.Add(range);
        }
        private void CheckDatePicker(string codeVeto)
        {
            //TODO : Empecher le selectionement de dates ne comportant pas de consultation.
            var dateConsultations = BLL.Veterinaire.GetJourConsultation(codeVeto);
            var dateRange = new CalendarDateRange(DateTime.MinValue, DateTime.MaxValue);

            //dateRange.

            //DatePickerVeto.BlackoutDates.Add(dateRange);
        }
        /// <summary>
        /// Returns true if any day in the given DateTime range is contained in
        /// the current CalendarDateRange.
        /// </summary>
        /// <param name="range">Inherited code: Requires comment 1.</param>
        /// <returns>Inherited code: Requires comment 2.</returns>
        internal bool ContainsAny(CalendarDateRange range)
        {
            Debug.Assert(range != null, "range should not be null!");

            int start = DateTime.Compare(Start, range.Start);

            // Check if any part of the supplied range is contained by this
            // range or if the supplied range completely covers this range.
            return((start <= 0 && DateTime.Compare(End, range.Start) >= 0) ||
                   (start >= 0 && DateTime.Compare(Start, range.End) <= 0));
        }
        /// <summary>
        /// Returns if the date is included in the range.
        /// </summary>
        /// <param name="date">Inherited code: Requires comment 1.</param>
        /// <param name="range">Inherited code: Requires comment 2.</param>
        /// <returns>Inherited code: Requires comment 3.</returns>
        public static bool InRange(DateTime date, CalendarDateRange range)
        {
            Debug.Assert(DateTime.Compare(range.Start, range.End) < 1, "The range should start before it ends!");

            if (CompareDays(date, range.Start) > -1 && CompareDays(date, range.End) < 1)
            {
                return(true);
            }

            return(false);
        }
Example #5
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            ufoVM = (UFOCollectionVM)mainWindow.DataContext;

            // quick and dirty workaround
            CalendarDateRange cdr = new CalendarDateRange(DateTime.MinValue, new DateTime(2015, 07, 23).AddDays(-1));/*DateTime.Today.AddDays(-1);*/
            datePicker.BlackoutDates.Add(cdr);

            cmbPerformanceTime.ItemsSource = ufoVM.PerformancesTimes;
            cmbPerformanceVenue.ItemsSource = ufoVM.Venues.OrderBy(x => x.Description);
            cmbPerformanceArtist.ItemsSource = ufoVM.Artists.OrderBy(x => x.Name);
        }
 private void SetBlackOutDates()
 {
     try
     {
         var tomorrow = DateTime.Now.Date.AddDays(1);
         var farInTheFuture = DateTime.Now.Date.AddYears(500);
         var futureDateRange = new CalendarDateRange(tomorrow, farInTheFuture);
         SinceDatePicker.BlackoutDates.Add(futureDateRange);
     }
     catch (Exception ex)
     {
     }
 }
        /// <summary>
        /// Returns true if any day in the given DateTime range is contained in
        /// the current CalendarDateRange.
        /// </summary>
        /// <param name="value">The current range.</param>
        /// <param name="range">The range to compare.</param>
        /// <param name="info">The CalendarInfo.</param>
        /// <returns>
        /// A value indicating whether any day in the given DateTime range is\
        /// contained in the current CalendarDateRange.
        /// </returns>
        public static bool ContainsAny(this CalendarDateRange value, CalendarDateRange range, CalendarInfo info)
        {
            Debug.Assert(value != null, "value should not be null!");
            Debug.Assert(range != null, "range should not be null!");
            Debug.Assert(info != null, "info should not be null!");

            int start = info.Compare(value.Start, range.Start);

            // Check if any part of the supplied range is contained by this
            // range or if the supplied range completely covers this range.
            return((start <= 0 && info.Compare(value.End, range.Start) >= 0) ||
                   (start >= 0 && info.Compare(value.Start, range.End) <= 0));
        }
        private void TerminalPage_Loaded(object sender, RoutedEventArgs e)
        {
            earlyRequestDateCalendar.BlackoutDates.Clear();
            var end = ServerDateTime.Today;
            if (TerminalConfig.CurrentDayRecording)
            {
                end = end.AddDays(-1);
            }

            earlyRequestDateCalendar.BlackoutDates.Add(new CalendarDateRange(DateTime.MinValue, end));

            if (Model.SelectedService != null)
            {
                var range = new CalendarDateRange(ServerDateTime.Today.AddDays(Model.SelectedService.MaxEarlyDays + 1), DateTime.MaxValue);
                earlyRequestDateCalendar.BlackoutDates.Add(range);
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.Title = "New " + System.Enum.GetName(_type.GetType(), _type);
            // Maybe use a switch statement???
            if (_type == MainWindow.selection.Project)
            {
                label1.Content = "Project Name";
                label2.Content = "Start Date";
                label3.Content = "End Date";
                label4.Content = "Owner";
                label5.Content = "Team";
                try
                {
                    comboBox_project1.ItemsSource = _viewModel.AllManagers;
                    comboBox_project2.ItemsSource = _viewModel.AllTeams;
                }
                catch (InvalidOperationException)
                {
                    showCriticalError();
                }
                stackPanel_project.Visibility = Visibility.Visible;
            }
            if (_type == MainWindow.selection.Sprint)
            {
                label1.Content = "Sprint Name";
                label2.Content = "Start Date";
                label3.Content = "End Date";
                textBox_sprint1.Text = string.Format("Sprint {0}", _viewModel.SprintsForProject.Count);
                datePicker_sprint1.BlackoutDates.Clear();
                CalendarDateRange cdr = new CalendarDateRange();
                cdr.End = _viewModel.CurrProject.StartDate.AddDays(-1);
                datePicker_sprint1.BlackoutDates.Add(cdr);
                if (_viewModel.CurrProject.EndDate.HasValue)
                {
                    cdr = new CalendarDateRange();
                    cdr.Start = (DateTime)_viewModel.CurrProject.EndDate;
                    cdr.Start = cdr.Start.AddDays(1);
                    datePicker_sprint1.BlackoutDates.Add(cdr);
                }
                datePicker_sprint2.BlackoutDates.Clear();
                cdr = new CalendarDateRange();
                cdr.End = _viewModel.CurrProject.StartDate.AddDays(-1);
                datePicker_sprint2.BlackoutDates.Add(cdr);
                if (_viewModel.CurrProject.EndDate.HasValue)
                {
                    cdr = new CalendarDateRange();
                    cdr.Start = (DateTime)_viewModel.CurrProject.EndDate;
                    cdr.Start = cdr.Start.AddDays(1);
                    datePicker_sprint2.BlackoutDates.Add(cdr);
                }
                stackPanel_sprint.Visibility = Visibility.Visible;
            }
            if (_type == MainWindow.selection.Story)
            {
                label1.Content = "Priority Number";
                label2.Content = "Text";
                stackPanel_story.Visibility = Visibility.Visible;
            }
            if (_type == MainWindow.selection.Task)
            {
                label1.Content = "Text";
                label2.Content = "Size Complexity";
                label3.Content = "Business Value";
                label4.Content = "Owner";
                label5.Content = "Type";
                label6.Content = "State";
                comboBox_task1.ItemsSource = EnumValues.sizeComplexity;
                comboBox_task2.ItemsSource = EnumValues.businessValue;
                try
                {
                    comboBox_task3.ItemsSource = _viewModel.CurrTeamMembers;
                }
                catch (InvalidOperationException)
                {
                    showCriticalError();
                }
                comboBox_task4.ItemsSource = EnumValues.taskType;
                comboBox_task5.ItemsSource = EnumValues.taskState;
                comboBox_task5.SelectedIndex = 0;
                comboBox_task5.IsEnabled = false;
                datePicker_task1.BlackoutDates.Clear();
                CalendarDateRange cdr = new CalendarDateRange();
                cdr.End = _viewModel.CurrSprint.StartDate.AddDays(-1);
                datePicker_task1.BlackoutDates.Add(cdr);
                if (_viewModel.CurrSprint.EndDate.HasValue)
                {
                    cdr = new CalendarDateRange();
                    cdr.Start = (DateTime)_viewModel.CurrSprint.EndDate;
                    cdr.Start = cdr.Start.AddDays(1);
                    datePicker_task1.BlackoutDates.Add(cdr);
                }

                stackPanel_task.Visibility = Visibility.Visible;
            }
            if (_type == MainWindow.selection.Team)
            {
                label1.Content = "Team Name";
                label2.Content = "Manager";
                label3.Content = "Team Lead";
                try
                {
                    comboBox_team1.ItemsSource = _viewModel.AllManagers;
                    comboBox_team2.ItemsSource = _viewModel.AllManagers;
                }
                catch (InvalidOperationException)
                {
                    showCriticalError();
                }
                stackPanel_team.Visibility = Visibility.Visible;
            }
        }
 // returns if the date is included in the range
 public static bool InRange(DateTime date, CalendarDateRange range)
 {
     return(InRange(date, range.Start, range.End));
 }
        /// <summary>
        /// Returns true if any day in the given DateTime range is contained in
        /// the current CalendarDateRange.
        /// </summary>
        /// <param name="value">The current range.</param>
        /// <param name="range">The range to compare.</param>
        /// <param name="info">The CalendarInfo.</param>
        /// <returns>
        /// A value indicating whether any day in the given DateTime range is\
        /// contained in the current CalendarDateRange.
        /// </returns>
        public static bool ContainsAny(this CalendarDateRange value, CalendarDateRange range, CalendarInfo info)
        {
            Debug.Assert(value != null, "value should not be null!");
            Debug.Assert(range != null, "range should not be null!");
            Debug.Assert(info != null, "info should not be null!");

            int start = info.Compare(value.Start, range.Start);

            // Check if any part of the supplied range is contained by this
            // range or if the supplied range completely covers this range.
            return (start <= 0 && info.Compare(value.End, range.Start) >= 0) ||
                (start >= 0 && info.Compare(value.Start, range.End) <= 0);
        }
        private void PageCreateRoute_Loaded(object sender, RoutedEventArgs e)
        {
            //hide the tab for a route
            TabControl tab_main = UIHelpers.FindChild<TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
             tab_main.Items.Cast<TabItem>()
               .Where(item => item.Tag.ToString() == "Route")
               .FirstOrDefault();

                matchingItem.Visibility = System.Windows.Visibility.Collapsed;

                    var airlinerItem = tab_main.Items.Cast<TabItem>()
               .Where(item => item.Tag.ToString() == "Airliner")
               .FirstOrDefault();

                    airlinerItem.Visibility = System.Windows.Visibility.Collapsed;
            }

            //sets the selected items for the facilities
            foreach (MVVMRouteClass rClass in this.Classes)
            {
                foreach (MVVMRouteFacility rFacility in rClass.Facilities)
                    rFacility.SelectedFacility = rFacility.Facilities.OrderBy(f => f.ServiceLevel).FirstOrDefault();

            }

            CalendarDateRange daysRange = new CalendarDateRange(new DateTime(2000,1,1),GameObject.GetInstance().GameTime);

            dpStartDate.BlackoutDates.Add(daysRange);
            dpStartDate.DisplayDateStart = GameObject.GetInstance().GameTime;
            dpStartDate.DisplayDate = GameObject.GetInstance().GameTime;

            createGrouping(cbDestination1);
            createGrouping(cbDestination2);
            createGrouping(cbStopover1);
            createGrouping(cbStopover2);
        }
 /// <summary>
 /// Returns true if any day in the given DateTime range is contained in the current CalendarDateRange.
 /// </summary>
 /// <param name="range"></param>
 /// <returns></returns>
 internal bool ContainsAny(CalendarDateRange range)
 {
     return((range.End >= this.Start) && (this.End >= range.Start));
 }
Example #14
0
 // returns if the date is included in the range 
 public static bool InRange(DateTime date, CalendarDateRange range)
 {
     return InRange(date, range.Start, range.End);
 } 
        /// <summary>
        /// sets the display when viewing task
        /// </summary>
        private void UpdateTask()
        {
            button_task.FontWeight = FontWeights.Bold;
            button_project.Visibility = Visibility.Visible;
            button_sprint.Visibility = Visibility.Visible;
            button_story.Visibility = Visibility.Visible;
            button_task.Visibility = Visibility.Visible;
            button_New.Visibility = Visibility.Hidden;
            leftList.ItemsSource = new string[] { };
            grid_taskInfo.Visibility = Visibility.Visible;

            //need to manually set the contents and initial values of comboboxs
            ObservableCollection<UserView> userList = _viewModel.GetTeamMembers(_viewModel.CurrTeam).Item1;
            comboBox_task_owner.ItemsSource = userList;
            comboBox_task_owner.SelectedItem = userList.Where(user => user.UserID == _viewModel.CurrTask.OwnerID).FirstOrDefault();

            comboBox_task_type.ItemsSource = EnumValues.taskType;
            comboBox_task_type.SelectedItem = _viewModel.CurrTask.Type;

            comboBox_task_complexity.ItemsSource = EnumValues.sizeComplexity;
            comboBox_task_complexity.SelectedItem = _viewModel.CurrTask.SizeComplexity;

            comboBox_task_value.ItemsSource = EnumValues.businessValue;
            comboBox_task_value.SelectedItem = _viewModel.CurrTask.BusinessValue;

            comboBox_task_state.ItemsSource = EnumValues.taskState;
            comboBox_task_state.SelectedItem = _viewModel.CurrTask.State;

            datePicker_task_completionDate.SelectedDate = _viewModel.CurrTask.CompletionDate;
            TaskDateChanged(null, null);
            button_saveTask.Content = "Save";
            //set the blackout dates
            if (!_viewModel.HistoricMode)
            {
                if ((_viewModel.CurrTask.CompletionDate.HasValue && _viewModel.CurrTask.CompletionDate.Value < _viewModel.CurrSprint.StartDate) || (_viewModel.CurrTask.CompletionDate.HasValue && _viewModel.CurrSprint.EndDate.HasValue && _viewModel.CurrTask.CompletionDate.Value > _viewModel.CurrSprint.EndDate.Value))
                {
                    datePicker_task_completionDate.SelectedDate = null;
                    button_saveTask.Content = "Save*";
                    showInvalidDateWarning();
                }

                CalendarDateRange cdr = new CalendarDateRange();
                cdr.End = _viewModel.CurrSprint.StartDate.AddDays(-1);
                datePicker_task_completionDate.BlackoutDates.Add(cdr);
                if (_viewModel.CurrSprint.EndDate.HasValue)
                {
                    cdr = new CalendarDateRange();
                    cdr.Start = (DateTime)_viewModel.CurrSprint.EndDate;
                    cdr.Start = cdr.Start.AddDays(1);
                    datePicker_task_completionDate.BlackoutDates.Add(cdr);
                }
            }
        }
Example #16
0
        private void ProcessSelection(bool shift, DateTime? lastSelectedDate, int? index)
        {
            if (this.SelectionMode == CalendarSelectionMode.None && lastSelectedDate != null)
            {
                OnDayClick(lastSelectedDate.Value);
                return;
            }
            if (lastSelectedDate != null && IsValidKeyboardSelection(this, lastSelectedDate.Value))
            {
                if (this.SelectionMode == CalendarSelectionMode.SingleRange || this.SelectionMode == CalendarSelectionMode.MultipleRange)
                {
                    foreach (DateTime item in this.SelectedDates)
                    {
                        this._removedItems.Add(item);
                    }
                    this.SelectedDates.ClearInternal();
                    if (shift)
                    {
                        CalendarDayButton b;
                        _isShiftPressed = true;
                        if (this._hoverStart == null)
                        {
                            if (this.LastSelectedDate != null)
                            {
                                this._hoverStart = this.LastSelectedDate;
                            }
                            else
                            {
                                if (DateTimeHelper.CompareYearMonth(this.DisplayDateInternal, DateTime.Today) == 0)
                                {
                                    this._hoverStart = DateTime.Today;
                                }
                                else
                                {
                                    this._hoverStart = this.DisplayDateInternal;
                                }
                            }

                            b = FindDayButtonFromDay(this._hoverStart.Value);
                            if (b != null)
                            {
                                this._hoverStartIndex = b.Index;
                            }
                        }
                        //the index of the SelectedDate is always the last selectedDate's index
                        UnHighlightDays();
                        //If we hit a BlackOutDay with keyboard we do not update the HoverEnd
                        CalendarDateRange range;

                        if (DateTime.Compare(this._hoverStart.Value, lastSelectedDate.Value) < 0)
                        {
                            range = new CalendarDateRange(this._hoverStart.Value, lastSelectedDate.Value);
                        }
                        else
                        {
                            range = new CalendarDateRange(lastSelectedDate.Value, this._hoverStart.Value);
                        }

                        if (!this.BlackoutDates.ContainsAny(range))
                        {
                            this.HoverEnd = lastSelectedDate;

                            if (index.HasValue)
                            {
                                this._hoverEndIndex += index;
                            }
                            else
                            {
                                //
                                b = FindDayButtonFromDay(this._hoverEnd.Value);

                                if (b != null)
                                {
                                    this._hoverEndIndex = b.Index;
                                }
                            }
                        }

                        OnDayClick(this.HoverEnd.Value);
                        HighlightDays();
                    }
                    else
                    {
                        this._hoverStart = lastSelectedDate;
                        this.HoverEnd = lastSelectedDate;
                        AddSelection();
                        OnDayClick(lastSelectedDate.Value);
                    }
                }
                else
                {
                    //ON CLEAR 
                    this.LastSelectedDate = lastSelectedDate.Value;
                    if (this.SelectedDates.Count > 0)
                    {
                        this.SelectedDates[0] = lastSelectedDate.Value;
                    }
                    else
                    {
                        this.SelectedDates.Add(lastSelectedDate.Value);
                    }
                    OnDayClick(lastSelectedDate.Value);
                }
            }
        }
 /// <summary>
 /// Returns true if any day in the given DateTime range is contained in the current CalendarDateRange.
 /// </summary>
 /// <param name="range"></param>
 /// <returns></returns>
 internal bool ContainsAny(CalendarDateRange range)
 {
     return (range.End >= this.Start) && (this.End >= range.Start);
 }
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            datePicker.DisplayDateStart = DateTime.Today.Date;
            CalendarDateRange cdr = new CalendarDateRange(DateTime.MinValue, DateTime.Today.AddDays(-1));
            datePicker.BlackoutDates.Add(cdr);

            cmbTime.ItemsSource = ufoCollVM.PerformancesTimes;
            cmbVenue.ItemsSource = ufoCollVM.Venues.OrderBy(x => x.Description);
            cmbArtist.ItemsSource = ufoCollVM.Artists;
        }
Example #19
0
        private void ProcessSelection(bool shift, DateTime? lastSelectedDate)
        {
            if (this.SelectionMode == CalendarSelectionMode.None && lastSelectedDate != null) 
            {
                OnDayClick(lastSelectedDate.Value); 
                return; 
            }
 
            if (lastSelectedDate != null && IsValidKeyboardSelection(this, lastSelectedDate.Value))
            {
                if (this.SelectionMode == CalendarSelectionMode.SingleRange || this.SelectionMode == CalendarSelectionMode.MultipleRange)
                { 
                    this.SelectedDates.ClearInternal();
                    if (shift) 
                    { 
                        this._isShiftPressed = true;
                        if (!this.HoverStart.HasValue) 
                        {
                            this.HoverStart = this.HoverEnd = this.CurrentDate;
                        }
 
                        // If we hit a BlackOutDay with keyboard we do not update the HoverEnd
                        CalendarDateRange range; 
 
                        if (DateTime.Compare(this.HoverStart.Value, lastSelectedDate.Value) < 0)
                        { 
                            range = new CalendarDateRange(this.HoverStart.Value, lastSelectedDate.Value);
                        }
                        else
                        { 
                            range = new CalendarDateRange(lastSelectedDate.Value, this.HoverStart.Value);
                        } 
 
                        if (!this.BlackoutDates.ContainsAny(range))
                        { 
                            this._currentDate = lastSelectedDate;
                            this.HoverEnd = lastSelectedDate;
                        }
 
                        OnDayClick(this.CurrentDate);
                    } 
                    else 
                    {
                        this.HoverStart = this.HoverEnd = this.CurrentDate = lastSelectedDate.Value; 
                        AddKeyboardSelection();
                        OnDayClick(lastSelectedDate.Value);
                    }
                } 
                else
                { 
                    // ON CLEAR 
                    this.CurrentDate = lastSelectedDate.Value;
                    this.HoverStart = this.HoverEnd = null; 
                    if (this.SelectedDates.Count > 0)
                    {
                        this.SelectedDates[0] = lastSelectedDate.Value;
                    } 
                    else
                    { 
                        this.SelectedDates.Add(lastSelectedDate.Value); 
                    }
 
                    OnDayClick(lastSelectedDate.Value);
                }

                UpdateCellItems(); 
            }
        } 
        /// <summary>
        /// Inherited code: Requires comment.
        /// </summary>
        /// <param name="shift">Inherited code: Requires comment 1.</param>
        /// <param name="lastSelectedDate">Inherited code: Requires comment 2.</param>
        /// <param name="index">Inherited code: Requires comment 3.</param>
        private void ProcessSelection(bool shift, DateTime? lastSelectedDate, int? index)
        {
            if (SelectionMode == CalendarSelectionMode.None && lastSelectedDate != null)
            {
                OnDayClick(lastSelectedDate.Value);
                return;
            }
            if (lastSelectedDate != null && IsValidKeyboardSelection(this, lastSelectedDate.Value))
            {
                if (SelectionMode == CalendarSelectionMode.SingleRange ||
                    SelectionMode == CalendarSelectionMode.MultipleRange)
                {
                    foreach (DateTime item in SelectedDates)
                    {
                        RemovedItems.Add(item);
                    }
                    SelectedDates.ClearInternal();
                    if (shift)
                    {
                        GlobalCalendarDayButton b;
                        _isShiftPressed = true;
                        if (HoverStart == null)
                        {
                            if (LastSelectedDate != null)
                            {
                                HoverStart = LastSelectedDate;
                            }
                            else
                            {
                                if (Info.GetMonthDifference(DisplayDateInternal, DateTime.Today) == 0)
                                {
                                    HoverStart = DateTime.Today;
                                }
                                else
                                {
                                    HoverStart = DisplayDateInternal;
                                }
                            }

                            b = FindDayButtonFromDay(HoverStart.Value);
                            if (b != null)
                            {
                                HoverStartIndex = b.Index;
                            }
                        }
                        // the index of the SelectedDate is always the last
                        // selectedDate's index
                        UnHighlightDays();
                        // If we hit a BlackOutDay with keyboard we do not
                        // update the HoverEnd
                        CalendarDateRange range;

                        if (Info.Compare(HoverStart.Value, lastSelectedDate.Value) < 0)
                        {
                            range = new CalendarDateRange(HoverStart.Value, lastSelectedDate.Value);
                        }
                        else
                        {
                            range = new CalendarDateRange(lastSelectedDate.Value, HoverStart.Value);
                        }

                        if (!BlackoutDates.ContainsAny(range))
                        {
                            HoverEnd = lastSelectedDate;

                            if (index.HasValue)
                            {
                                HoverEndIndex += index;
                            }
                            else
                            {
                                // For Home, End, PageUp and PageDown Keys there
                                // is no easy way to predict the index value
                                b = FindDayButtonFromDay(HoverEndInternal.Value);

                                if (b != null)
                                {
                                    HoverEndIndex = b.Index;
                                }
                            }
                        }

                        OnDayClick(HoverEnd.Value);
                        HighlightDays();
                    }
                    else
                    {
                        HoverStart = lastSelectedDate;
                        HoverEnd = lastSelectedDate;
                        AddSelection();
                        OnDayClick(lastSelectedDate.Value);
                    }
                }
                else
                {
                    // ON CLEAR 
                    LastSelectedDate = lastSelectedDate.Value;
                    if (SelectedDates.Count > 0)
                    {
                        SelectedDates[0] = lastSelectedDate.Value;
                    }
                    else
                    {
                        SelectedDates.Add(lastSelectedDate.Value);
                    }
                    OnDayClick(lastSelectedDate.Value);
                }
            }
        }
 /// <summary>
 /// sets the display when viewing sprint
 /// </summary>
 private void UpdateSprint()
 {
     button_sprint.FontWeight = FontWeights.Bold;
     button_project.Visibility = Visibility.Visible;
     button_sprint.Visibility = Visibility.Visible;
     leftList.ItemsSource = _viewModel.StoriesForSprint;
     grid_sprintInfo.Visibility = Visibility.Visible;
     button_burndown.IsEnabled = _viewModel.CurrSprint.EndDate.HasValue && _viewModel.StoriesForSprint.Count > 0;
     button_saveSprint.Content = "Save";
     //sets blackout dates on the start and end date
     if (!_viewModel.HistoricMode)
     {
         if (_viewModel.CurrSprint.StartDate < _viewModel.CurrProject.StartDate || (_viewModel.CurrProject.EndDate.HasValue && _viewModel.CurrSprint.StartDate > _viewModel.CurrProject.EndDate.Value))
         {
             datePicker_sprint_start.SelectedDate = null;
             button_saveSprint.Content = "Save*";
             if ((_viewModel.CurrSprint.EndDate.HasValue && _viewModel.CurrSprint.EndDate.Value < _viewModel.CurrProject.StartDate) || (_viewModel.CurrProject.EndDate.HasValue && _viewModel.CurrSprint.EndDate.HasValue && _viewModel.CurrSprint.EndDate.Value > _viewModel.CurrProject.EndDate.Value))
             {
                 datePicker_sprint_end.SelectedDate = null;
                 showInvalidDateWarning();
             }
             else
             {
                 showInvalidDateWarning();
             }
         }
         else if ((_viewModel.CurrSprint.EndDate.HasValue && _viewModel.CurrSprint.EndDate.Value < _viewModel.CurrProject.StartDate) || (_viewModel.CurrProject.EndDate.HasValue && _viewModel.CurrSprint.EndDate.HasValue && _viewModel.CurrSprint.EndDate.Value > _viewModel.CurrProject.EndDate.Value))
         {
             datePicker_sprint_end.SelectedDate = null;
             button_saveSprint.Content = "Save*";
             showInvalidDateWarning();
         }
         CalendarDateRange cdr = new CalendarDateRange();
         cdr.End = _viewModel.CurrProject.StartDate.AddDays(-1);
         datePicker_sprint_start.BlackoutDates.Add(cdr);
         if (_viewModel.CurrProject.EndDate.HasValue)
         {
             cdr = new CalendarDateRange();
             cdr.Start = (DateTime)_viewModel.CurrProject.EndDate;
             cdr.Start = cdr.Start.AddDays(1);
             datePicker_sprint_start.BlackoutDates.Add(cdr);
         }
         cdr = new CalendarDateRange();
         cdr.End = _viewModel.CurrProject.StartDate.AddDays(-1);
         datePicker_sprint_end.BlackoutDates.Add(cdr);
         if (_viewModel.CurrProject.EndDate.HasValue)
         {
             cdr = new CalendarDateRange();
             cdr.Start = (DateTime)_viewModel.CurrProject.EndDate;
             cdr.Start = cdr.Start.AddDays(1);
             datePicker_sprint_end.BlackoutDates.Add(cdr);
         }
     }
 }
Example #22
0
        //returns if the date is included in the range
        public static bool InRange(DateTime date, CalendarDateRange range)
        {
            Debug.Assert(DateTime.Compare(range.Start, range.End) < 1);
            
            if (CompareDays(date, range.Start) > -1 && CompareDays(date, range.End) < 1)
            {
                return true;
            }

            return false;
        }
        /// <summary>
        /// Miguel Santana
        /// Created: 2015/04/06
        /// Method is used to initialize the screen to the default presentation.
        /// Merged add and edit ui screens
        /// </summary>
        private void Setup()
        {
            InitializeComponent();
            try
            {
                EventCbox.Items.Clear();
                EventCbox.ItemsSource = DataCache._currentEventList;
                EventCbox.DisplayMemberPath = "EventItemName";
                EventCbox.SelectedValue = "EventItemID";

                SupplierCbox.Items.Clear();
                SupplierCbox.ItemsSource = _supplierManager.RetrieveSupplierList();
            }
            catch (Exception ex)
            {
                throw new WanderingTurtleException(this, ex);
            }

            CalendarDateRange cdr = new CalendarDateRange(DateTime.MinValue, DateTime.Now);
            DateStart.BlackoutDates.Add(cdr);
            DateEnd.BlackoutDates.Add(cdr);
            PopulateFields();
        }