Пример #1
0
        private void ColorBtn_Click(object sender, RoutedEventArgs e)
        {
            Button          btn   = sender as Button;
            SolidColorBrush brush = (SolidColorBrush)btn.Background;

            Debug.WriteLine("ColorBtn_Click");
            ColorClicked?.Invoke(brush);
        }
Пример #2
0
        public IssueRowViewModel(Issue issue, WorkLogCore workLog, CollectionEventAggregator colorClickedAggregator, IssueColors issueColors)
        {
            Issue    = issue;
            Name     = Issue.Name;
            TimeText = ProjectedObservableValue <string> .FromObservableValue(issue.TotalLoggedTime, time => time.ToString("h\\:mm"));

            Color      = issueColors.GetColor(Issue);
            Background = ProjectedObservableValue <Brush> .FromObservableValue(workLog.Logger.RunningIssue, runningIssue => runningIssue == Issue?Brushes.LightGreen : Brushes.White);

            StartStopButtonText = ProjectedObservableValue <string> .FromObservableValue(workLog.Logger.RunningIssue, runningIssue => runningIssue == Issue? "Stop" : "Start");

            StartStopButtonCommand = new DelegateCommand(() => workLog.Logger.StartStop(Issue));
            RemoveButtonCommand    = new DelegateCommand(() =>
            {
                if (MessageBox.Show($"Do you want to delete '{Name}' issue and its logged time?", "Remove issue", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    workLog.Issues.Remove(Issue);
                    issueColors.RemoveColor(Issue);
                }
            });
            ColorClickedCommand = new DelegateCommand(() => ColorClicked?.Invoke(this, EventArgs.Empty));
            colorClickedAggregator.ItemChanged += (sender, e) => IsColorChecked.Value = sender == this && IsColorChecked.Value == false;
        }
Пример #3
0
 private void OnColorClicked(int index, MouseButtons buttons)
 {
     ColorClicked?.Invoke(this, new EventArgs <Pair <int, MouseButtons> >(Pair.Create(index, buttons)));
 }