Esempio n. 1
0
        private void onTaskBtn_Click(object sender, RoutedEventArgs e)
        {
            check = true;
            onTaskBtn.Background   = new SolidColorBrush(Colors.Red);
            finishedBtn.Background = new SolidColorBrush(Color.FromRgb(0, 52, 114));
            canceledBtn.Background = new SolidColorBrush(Color.FromRgb(0, 52, 114));

            container.Children.Clear();
            foreach (var item in ConfigurationManager.GetTaskItems())
            {
                var control = new WpfControlLibrary.WPFControls.TaskItem(item.Content, item.StartTime, item.EndTime, item.Status);
                control.Margin = new Thickness(5);
                control.finishedCbx_CheckedHandler(new RoutedEventHandler((o, args) =>
                {
                    ConfigurationManager.AddFinishedTask(item.Id);
                    this.onTaskBtn.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, onTaskBtn));
                }));
                control.cancelCbx_CheckedHandler(new RoutedEventHandler((o, args) =>
                {
                    ConfigurationManager.AddCanceledTask(item.Id);
                    this.onTaskBtn.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, onTaskBtn));
                }));
                control.deleteBtnHandler(new RoutedEventHandler((o, args) =>
                {
                    ConfigurationManager.RemoveTaskItem(item.Id);
                    this.onTaskBtn.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, onTaskBtn));
                }));
                control.editBtnHandler(new RoutedEventHandler((o, args) =>
                {
                    if ((bool)new NewTaskWindow(item.Content, item.StartTime, item.EndTime).ShowDialog())
                    {
                        this.onTaskBtn.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, onTaskBtn));
                    }
                }));
                container.Children.Add(control);
            }
        }