示例#1
0
        private void applyFilterButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Regex regex = new Regex(contentsOfFilter.Text, RegexOptions.IgnoreCase);
            Dictionary <string, string> namesApplication = ActiveApplication_db.GetNameApplicationDictionaryWithoutGroup();
            List <int> idApplicationFiltered             = new List <int>();
            int        count = 0;

            foreach (KeyValuePair <string, string> name in namesApplication)
            {
                if (regex.Matches(name.Value).Count > 0)
                {
                    idApplicationFiltered.Add(Convert.ToInt32(name.Key));
                    count++;
                }
            }
            if (idApplicationFiltered.Count > 0)
            {
                if (ActiveApplication_db.AddGroupToApplications(idApplicationFiltered, selectGroupId.ToString()))
                {
                    resultsApplyFilter.SetContent("Znaleziono " + count + " element" + ((count == 1) ? "" : "ów."));
                }
                else
                {
                    resultsApplyFilter.SetContent("Wystąpił błąd z filtrem.");
                }
            }
            else
            {
                resultsApplyFilter.SetContent("Znaleziono " + count + " element" + ((count == 1) ? "" : "ów."));
            }
            resultsApplyFilter.Visibility = System.Windows.Visibility.Visible;
        }
示例#2
0
        private void CreateChartActiveApplication(List <ActiveApplication> activeApplication, List <ActiveApplication> otherActivity)
        {
            if (activeApplication.Any())
            {
                activeApplication = activeApplication.OrderBy(x => x.Date).ToList();
                int maxValue = activeApplication.Max(x => x.ActivityTime);
                List <Tuple <int, string> > activeApplicationTupleList = GetTupleList(activeApplication);
                List <int> sumDateList        = GetSumTimeList(activeApplicationTupleList);
                double     scaleMultiplier    = ActionOnNumbers.DivisionD(300, maxValue);
                int        width              = 10;
                int        space              = 0;
                int        lenghtLabelDate    = 0;
                int        positionXLabelDate = 16;
                int        numberElement      = 0;
                int        numberDateLabel    = 0;
                chartContentCanvas.Width = 0;
                for (int i = 0; i < activeApplication.Count; i++)
                {
                    if (i > 0)
                    {
                        if (!activeApplication[i].Date.Equals(activeApplication[i - 1].Date))
                        {
                            space           += 10;
                            lenghtLabelDate += 11;
                            DrawDateLabel(activeApplication[i - 1].Date.Remove(10), lenghtLabelDate, positionXLabelDate, otherActivity, ref numberDateLabel);
                            positionXLabelDate += lenghtLabelDate - 1;
                            lenghtLabelDate     = 0;
                        }
                    }
                    if (!string.IsNullOrEmpty(searchingNames.Text) && !searchingNames.Text.Equals("Wpisz nazwę aktywności") && indexResultFilter > -1)
                    {
                        if (activeApplication[i].ID == Convert.ToInt32(foundList.ElementAt(indexResultFilter).Key))
                        {
                            MyRectangle r = new MyRectangle(chartContentCanvas, width, (int)(activeApplication[i].ActivityTime * scaleMultiplier),
                                                            colorTable[i % 4], 40 + space + ((width + 40) * numberElement) + 2, 320 - activeApplication[i].ActivityTime * scaleMultiplier, 1);
                            SetStrokeAndToolTip(r, activeApplication, i);
                            chartContentCanvas.Width += width * 5;
                            lenghtLabelDate          += width * 5;
                            numberElement++;
                        }
                    }
                    else
                    {
                        MyRectangle r = new MyRectangle(chartContentCanvas, width, (int)(activeApplication[i].ActivityTime * scaleMultiplier),
                                                        colorTable[i % 4], 20 + space + ((width + 2) * i) + 2, 320 - activeApplication[i].ActivityTime * scaleMultiplier, 1);
                        SetStrokeAndToolTip(r, activeApplication, i);
                        chartContentCanvas.Width += (width + 2);
                        lenghtLabelDate          += width + 2;
                    }
                }
                lenghtLabelDate += 21;
                DrawDateLabel(activeApplication[activeApplication.Count - 1].Date.Remove(10), lenghtLabelDate, positionXLabelDate, otherActivity, ref numberDateLabel);
                chartContentCanvas.Width += space + 50;
                SetScalePercent(maxValue, sumDateList.Max());

                countTitleApplication.SetContent(activeApplication.Select(x => x.Title).Distinct().Count().ToString());
                countActivityApplication.SetContent(activeApplication.Select(x => x.IdNameActivity).Distinct().Count().ToString());
            }
        }
 private void Update()
 {
     viewActivityID = NameActivity_db.GetIDForNameActivity(namesActivity[index]);
     nameActivity.SetContent(namesActivity[index]);
     UpdateListOfAddedApps();
     UpdateChart();
     UpdateTableWithInformation();
     UpdateActivityFooter(index);
 }
        private void GetAllNotJoinedApplication()
        {
            string allNotJoinedApplicationString = ActiveApplication_db.GetAllNotJoinedApplication();
            int    allNotJoinedApplicationInt;

            if (int.TryParse(allNotJoinedApplicationString, out allNotJoinedApplicationInt))
            {
                notJoinedApplications.SetContent(allNotJoinedApplicationInt.ToString());
                SetColorLabel(allNotJoinedApplicationInt, notJoinedApplications);
            }
            else
            {
                notJoinedApplications.SetContent("-1");
            }
        }
示例#5
0
 private void deleteApplicationWithFilterButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (selectGroupId != 0)
     {
         string count = ActiveApplication_db.GetAllAutoGroupingApplication(selectGroupId);
         if (ActiveApplication_db.DeleteAllApplicationsWithGroup(selectGroupId, true, true))
         {
             resultsDeleteApplication.SetContent("Usunięto " + count + " element" + ((string.Equals(count, "1")) ? "" : "ów."));
         }
         else
         {
             resultsDeleteApplication.SetContent("Wystąpił błąd podczas usuwania.");
         }
         resultsDeleteApplication.Visibility = System.Windows.Visibility.Visible;
     }
 }
示例#6
0
 public void Update(string title)
 {
     if (!string.IsNullOrEmpty(title) && !string.Equals(title, "-"))
     {
         int idTitle = Convert.ToInt32(ActiveApplication_db.GetIdActivityByName(SqlValidator.Validate(title)));
         nameGroup.SetContent(ActiveApplication_db.GetNameGroupByIdTitle(idTitle));
         nameActivity.SetContent(ActiveApplication_db.GetNameActivityByIdTitle(idTitle));
     }
 }
示例#7
0
        public void UpdateTitleApllication()
        {
            ActiveWindow activeWindow = new ActiveWindow();
            string       title        = activeWindow.GetNameActiveWindow();

            if (title != "Brak aktywnego okna")
            {
                titleAplication.SetContent(title);
            }
        }
        public void Update(string title)
        {
            double timeApp    = dailyUseOfApplication_db.GetTimeForTitle(title);
            double timeAllApp = dailyUseOfApplication_db.GetTimeForAllTitle();

            if (timeAllApp > 0)
            {
                circleBar.SetValue((timeApp / timeAllApp));
                valueBarUsingApplication.SetContent((int)((timeApp / timeAllApp) * 100) + " %");
            }
        }
示例#9
0
        private void buttonOpenChooseGroup(object sender, MouseButtonEventArgs e)
        {
            Dictionary <string, string> namesGroup = Membership_db.GetNameGroupsDictionaryWithoutConfiguration();

            chooseGroup.MouseLeftButtonDown -= buttonOpenChooseGroup;
            chooseGroup.MouseLeftButtonDown += buttonCloseChooseGroup;
            chooseGroup.Content              = "Ukryj grupy";
            int nextIndex = 0;

            chooseGroupCanvas.Height = 126;

            contentsOfFilter.Visibility         = System.Windows.Visibility.Hidden;
            contentsOfFilter.Text               = string.Empty;
            addFiltrAccept.Visibility           = System.Windows.Visibility.Hidden;
            applyFilterButton.Visibility        = System.Windows.Visibility.Hidden;
            resultsApplyFilter.Visibility       = System.Windows.Visibility.Hidden;
            resultsDeleteApplication.Visibility = System.Windows.Visibility.Hidden;
            ifActivity.Visibility               = System.Windows.Visibility.Hidden;
            buttonChangeActivity.Foreground     = new SolidColorBrush(Color.FromArgb(255, 155, 155, 155));
            treatAsOne.Visibility               = System.Windows.Visibility.Hidden;
            buttonTreatAsOne.Foreground         = new SolidColorBrush(Color.FromArgb(255, 155, 155, 155));
            applicationInGroup.SetContent("0");
            addingByFilter.SetContent("0");
            effectivenessFilter.SetContent("0.00 %");

            foreach (KeyValuePair <string, string> name in namesGroup)
            {
                Label group = ButtonCreator.CreateButton(chooseGroupCanvas, name.Value, 200, 29, 12, 0, 0 + (nextIndex * 32),
                                                         Color.FromArgb(255, 255, 255, 255), Color.FromArgb(255, 155, 155, 155));
                group.Background           = new SolidColorBrush(Color.FromArgb((byte)(50 + (nextIndex % 2 * 30)), 0, 125, 255));
                group.Name                 = "ID_" + name.Key;
                group.MouseEnter          += buttonContent_MouseEnter;
                group.MouseLeave          += buttonContent_MouseLeave;
                group.MouseLeftButtonDown += buttonChooseGroup_MouseLeftButtonDown;

                chooseGroupCanvas.Height += 32;
                nextIndex++;
            }
            chooseGroupCanvas.Height = ((chooseGroupCanvas.Height - 126) < 126) ? 126 : chooseGroupCanvas.Height - 125;
        }
示例#10
0
        public void Update(string title)
        {
            int timeApp    = dailyUseOfApplication_db.GetTimeForTitle(title);
            int timeAllApp = dailyUseOfApplication_db.GetTimeForAllTitle();

            if (timeApp > 0)
            {
                timeOfAplication.SetContent(ActionOnTime.GetTime(timeApp));
            }
            if (timeAllApp > 0)
            {
                totalTime.SetContent(ActionOnTime.GetTime(timeAllApp));
            }
        }
 private void GetAllConfiguredGroups()
 {
     numberOfConfiguredGroups.SetContent(Membership_db.GetNumberAllConfiguredGroups());
 }
 private void GetAllGroups()
 {
     numberGroups.SetContent(Membership_db.GetNumberAllGroups());
 }
        private void GetDaysHistoryActivity()
        {
            AllData_db allData_db = new AllData_db();

            daysHistoryActivity.SetContent((Convert.ToInt32(allData_db.GetDayWorkingApplication()) + 1).ToString().Replace("-", string.Empty));
        }
 private void GetAllActivityAndSetLabel()
 {
     numberActivity.SetContent(NameActivity_db.GetAllNameActivity());
 }
示例#15
0
 public void Update()
 {
     remainingTime.SetContent(ActionOnTime.GetRemainingTime());
     remainingTimePercent.SetContent(ActionOnTime.GetRemainingTimePercent());
     UpdateLookAnimatedClock();
 }