Exemplo n.º 1
0
 private void GetNameActivityAndTitleApplication()
 {
     foundList        = new Dictionary <string, string>();
     stopwatch        = new Stopwatch();
     titleApplication = ActiveApplication_db.GetNameApplicationDictionary();
     namesActivity    = NameActivity_db.GetNameActivityDictionary();
 }
 private void buttonSaveEditActivity_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (isOnlyEditMode)
     {
         if (!NameActivity_db.CheckIfExistName(nameEditActivity.Text))
         {
             NameActivity_db.ChangeNameActivity(namesActivity[index], nameEditActivity.Text);
             namesActivity[index] = nameEditActivity.Text;
             nameActivity.SetContent(nameEditActivity.Text);
             CloseEditModeActivity(false);
         }
         else
         {
             nameEditActivity.Background = new SolidColorBrush(Color.FromArgb(220, 255, 55, 55));
         }
     }
     else
     {
         if (!NameActivity_db.CheckIfExistName(nameEditActivity.Text))
         {
             NameActivity_db.AddNewActivity(nameEditActivity.Text);
             namesActivity = NameActivity_db.GetNameActivityDictionary().Values.ToArray();
             nameActivity.SetContent(nameEditActivity.Text);
             footerActivity[footerActivity.Count - 1].Content = nameEditActivity.Text;
             index = footerActivity.Count - 1;
             CloseEditModeActivity(true);
             Update();
         }
         else
         {
             nameEditActivity.Background = new SolidColorBrush(Color.FromArgb(220, 255, 55, 55));
         }
     }
 }
        public ShowActivity(ref Canvas canvas)
        {
            this.canvas = canvas;

            mainCanvas           = CanvasCreator.CreateCanvas(canvas, 620, 410, Color.FromArgb(255, 226, 240, 255), 0, 0);
            this.canvas.KeyDown += mainCanvas_KeyDown;
            contentCanvas        = CanvasCreator.CreateCanvas(mainCanvas, 620, 320, Color.FromArgb(255, 236, 236, 236), 0, 50);

            new MyRectangle(mainCanvas, 620, 1, Color.FromArgb(30, 110, 110, 110), 0, 50);
            new MyRectangle(mainCanvas, 620, 1, Color.FromArgb(50, 110, 110, 110), 0, 370);
            new MyRectangle(contentCanvas, 185, 294, Color.FromArgb(0, 10, 10, 10), 420, 15, 2);
            new MyRectangle(contentCanvas, 390, 294, Color.FromArgb(0, 10, 10, 10), 15, 15, 2);

            nameActivity = new MyLabel(mainCanvas, "Nazwa aktywnosci", 300, 36, 16, 15, 15, Color.FromArgb(255, 160, 160, 160),
                                       Color.FromArgb(0, 100, 100, 100), horizontalAlignment: HorizontalAlignment.Left);
            nameActivity.SetFont("Verdana");

            namesActivity = NameActivity_db.GetNameActivityDictionary().Values.ToArray();
            CreateControlUser();
            CreateChart();
            CreateListOfAddedApps();
            CreateTableWithInformation();
            CreateActivityFooter();
            index = 0;
            this.canvas.Focusable = true;
            this.canvas.Focus();
            Update();
        }
 private void Update()
 {
     viewActivityID = NameActivity_db.GetIDForNameActivity(namesActivity[index]);
     nameActivity.SetContent(namesActivity[index]);
     UpdateListOfAddedApps();
     UpdateChart();
     UpdateTableWithInformation();
     UpdateActivityFooter(index);
 }
        public WindowAddTo(Canvas parent, AddTo addTo)
        {
            InitializeComponent();
            IsClosed     = false;
            parentCanvas = parent;
            windowAddTo  = addTo;

            if (parent.Tag is int)
            {
                idMembership = Convert.ToInt32(parent.Tag);
            }
            if (idMembership == 0)
            {
                idApplication = parent.Name.Replace("ID_", "");
            }

            timerAnimation          = new DispatcherTimer();
            timerAnimation.Interval = new TimeSpan(0, 0, 0, 0, 10);
            repeatIntervals         = 0;

            Canvas activity = new Canvas()
            {
                Width = 150, Height = 200,
            };
            ScrollViewer sv = ScrollViewerCreator.CreateScrollViewer(addToCanvas, 150, 200, 0, 0, activity);

            Dictionary <string, string> names = new Dictionary <string, string>();

            if (addTo == AddTo.Activity)
            {
                names = NameActivity_db.GetNameActivityDictionary();
            }
            else if (addTo == AddTo.Group)
            {
                names = Membership_db.GetNameGroupsDictionaryIfIsActive();
            }

            int nextIndex = 0;

            foreach (KeyValuePair <string, string> name in names)
            {
                Label button = ButtonCreator.CreateButton(activity, name.Value, 150, 30, 12, 0, 29 * nextIndex,
                                                          Color.FromArgb(255, 255, 255, 255), Color.FromArgb(200, 255, 255, 255), 1);
                activity.Height += 29;

                button.MouseEnter          += button_MouseEnter;
                button.MouseLeave          += button_MouseLeave;
                button.MouseLeftButtonDown += button_MouseLeftButtonDown;
                button.Name = "ID_" + name.Key;
                nextIndex++;
            }
            activity.Height = ((activity.Height - 200) < 200) ? 200 : activity.Height - 199;

            timerAnimation.Tick += new EventHandler(AnimationAddShow);
            timerAnimation.Start();
        }
Exemplo n.º 6
0
        private void SetStrokeAndToolTip(MyRectangle rectangle, List <ActiveApplication> activeApplication, int index)
        {
            Dictionary <string, string> nameActivity = NameActivity_db.GetAllNameActivityDictionary();

            rectangle.SetStroke(Color.FromArgb(100, 255, 255, 255));
            rectangle.ToolTip(activeApplication[index].Title + " \nAktywność [ " + nameActivity[activeApplication[index].IdNameActivity.ToString()] + " ][" + ActionOnTime.GetTimeAndDays(activeApplication[index].ActivityTime) + " / "
                              + ActionOnTime.GetTimeAndDays(activeApplication.Where(x => x.Title == activeApplication[index].Title).Sum(x => x.ActivityTime)) + "] [" +
                              ActionOnNumbers.DivisionI(activeApplication[index].ActivityTime * 100, activeApplication.Where(x => x.Date == activeApplication[index].Date).Sum(x => x.ActivityTime))
                              + "% / " + ActionOnNumbers.DivisionI(activeApplication.Where(x => x.Title == activeApplication[index].Title).Sum(x => x.ActivityTime) * 100, activeApplication.Sum(x => x.ActivityTime)) + "%]");
        }
 private void DeleteActivity()
 {
     if (ActiveApplication_db.DeleteAllApplicationsWithActivity(viewActivityID))
     {
         if (NameActivity_db.DeleteActivity(namesActivity[index]))
         {
             namesActivity = NameActivity_db.GetNameActivityDictionary().Values.ToArray();
             contentCanvas.Children.Remove(footerActivity[index]);
             footerActivity.RemoveAt(index);
             for (int i = index; i < footerActivity.Count; i++)
             {
                 Canvas.SetLeft(footerActivity[i], Canvas.GetLeft(footerActivity[i]) - 120);
             }
             index = index - 1;
             Update();
         }
     }
 }
 private void GetAllActivityAndSetLabel()
 {
     numberActivity.SetContent(NameActivity_db.GetAllNameActivity());
 }