Пример #1
0
        private void MakeMissionFinish_Click(object sender, RoutedEventArgs e)
        {
            WorksWithFlyouts.CloseAllFlyouts();
            long id = (long)((Button)e.OriginalSource).Tag;

            Methods.idToMission[id].IsFinished = !Methods.idToMission[id].IsFinished;
            Methods.MakeChildrenFinished(Methods.idToMission[id]);

            WorkWithChart.AllConditions[0].CountCondition = WorkWithChart.GetCountActive(TreeViewModels.Root) - 1;
            WorkWithChart.AllConditions[1].CountCondition = WorkWithChart.GetCountInActive(TreeViewModels.Root);
        }
Пример #2
0
        private void MainTabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var fatherOfEvent = e.OriginalSource as TabControl;

            if (fatherOfEvent != null)
            {
                int    numb = MainTabControl.SelectedIndex;
                string name = (string)((TabItem)MainTabControl.SelectedItem).Header;
                WorkWithTabControl.InstanceTabControl.SelectedTabItem = numb;
                WorkWithTabControl.InstanceTabControl.SelectedTabName = name;

                if (numb == 5)
                {
                    if (WorkWithCalendar.CalendatInstance.calendarWay == 1)
                    {
                        WorkWithTabControl.InstanceTabControl.SelectedTabName = ((DateTime)MainCalendar.SelectedDate).ToString("m");
                    }
                    else
                    {
                        string selectedTabName = "";
                        if (WorkWithCalendar.CalendatInstance.SecondWayStartDay != DateTime.MinValue.Date)
                        {
                            selectedTabName += "От: " + WorkWithCalendar.CalendatInstance.SecondWayStartDay.ToString("m") + "   ";
                        }
                        if (WorkWithCalendar.CalendatInstance.SecondWayFinishDay != DateTime.MaxValue.Date)
                        {
                            selectedTabName += "До: " + WorkWithCalendar.CalendatInstance.SecondWayFinishDay.ToString("m");
                        }
                        WorkWithTabControl.InstanceTabControl.SelectedTabName = selectedTabName;
                    }
                }

                if (numb >= 0 && numb <= 4 || numb == 5)
                {
                    WorkWithTabControl.InstanceTabControl.ChangeTabItemMethod();

                    WorkWithChart.AllConditions[0].CountCondition = WorkWithChart.GetCountActive(TreeViewModels.Root) - 1;
                    WorkWithChart.AllConditions[1].CountCondition = WorkWithChart.GetCountInActive(TreeViewModels.Root);
                }
                WorkWithTabControl.InstanceTabControl.OnTasksEmpty();
            }
        }
Пример #3
0
        private void DeleteMissionButton_Click(object sender, RoutedEventArgs e)
        {
            long id = (long)((Button)e.OriginalSource).Tag;

            WorksWithFlyouts.CloseAllFlyouts();
            WorksWithFlyouts.ClearBlackoutsDate();

            List <long> IdsToDelete = new List <long>();

            Methods.GetAllId(Methods.idToMission[id], ref IdsToDelete);

            Methods.idToMission[id].Remove();

            Methods.RemoveMissionFromDict(IdsToDelete);

            WorkWithTabControl.InstanceTabControl.OnTasksEmpty();

            WorkWithChart.AllConditions[0].CountCondition = WorkWithChart.GetCountActive(TreeViewModels.Root) - 1;
            WorkWithChart.AllConditions[1].CountCondition = WorkWithChart.GetCountInActive(TreeViewModels.Root);
        }
Пример #4
0
        private void SaveNewMissionButton_Click(object sender, RoutedEventArgs e)
        {
            Mission newMission;

            string name = (Methods.TextIsEmpty(MissionNameTextBox.Text)) ? "Без названия" : MissionNameTextBox.Text;

            newMission             = new Mission(name, 0);
            newMission.IsImportant = (bool)ToggleSwitchIsImportant.IsChecked;

            DateTime start, finish;

            if (StartDateTimePicker.SelectedDate == null || StartDateTimePicker.SelectedDate == DateTime.MinValue.Date)
            {
                start = DateTime.MinValue.Date;
            }
            else
            {
                start = (DateTime)StartDateTimePicker.SelectedDate;
            }

            if (FinishDateTimePicker.SelectedDate == null || FinishDateTimePicker.SelectedDate == DateTime.MaxValue.Date)
            {
                finish = DateTime.MaxValue.Date;
            }
            else
            {
                finish = (DateTime)FinishDateTimePicker.SelectedDate;
            }

            DateTime helpDateTime;

            if (DateTime.Compare(finish, start) <= 0)
            {
                helpDateTime = finish;
                finish       = start;
                start        = helpDateTime;
            }

            newMission.StartDate  = start;
            newMission.FinishDate = finish;

            newMission.FirstColor  = (FirstColor.IsChecked == null) ? false : (bool)FirstColor.IsChecked;
            newMission.SecondColor = (SecondColor.IsChecked == null) ? false : (bool)SecondColor.IsChecked;
            newMission.ThirdColor  = (ThirdColor.IsChecked == null) ? false : (bool)ThirdColor.IsChecked;
            newMission.FourthColor = (FourthColor.IsChecked == null) ? false : (bool)FourthColor.IsChecked;
            newMission.FifthColor  = (FifthColor.IsChecked == null) ? false : (bool)FifthColor.IsChecked;


            for (int i = 0; i < NeedToNotifySelectedItem.Instance.NewTaskMarks.Count; i++)
            {
                newMission.Marks.Insert(0, new MiniMark(NeedToNotifySelectedItem.Instance.NewTaskMarks[i].MarkText));
            }

            long id = (long)((Button)e.OriginalSource).Tag;

            if (NeedToNotifySelectedItem.Instance.NotifyOpenFlyout)
            {
                NeedToNotifySelectedItem.Instance.NotifyOpenFlyout = false;
                newMission.FatherID = id;
            }
            else
            {
                newMission.FatherID = 0;
            }
            Methods.idToMission[newMission.FatherID].Add(newMission);
            Methods.idToMission[newMission.ID] = newMission;
            WorksWithFlyouts.CloseFlyout();
            ClearFlyout();
            WorkWithFilters.Filters.OnOtherFilters();
            WorkWithTabControl.InstanceTabControl.OnTasksEmpty();

            WorkWithChart.AllConditions[0].CountCondition = WorkWithChart.GetCountActive(TreeViewModels.Root);
            WorkWithChart.AllConditions[1].CountCondition = WorkWithChart.GetCountInActive(TreeViewModels.Root);
        }