Esempio n. 1
0
        public TodoItemComponent()
        {
            InitializeComponent();

            // Observe UI events
            CompleteButton.Events().Click
            .Subscribe(_ => Store.Dispatch(new CompleteTodoItemAction {
                Id = TodoItem.Id
            }));

            RevertCompleteButton.Events().Click
            .Subscribe(_ => Store.Dispatch(new RevertCompleteTodoItemAction {
                Id = TodoItem.Id
            }));

            RemoveButton.Events().Click
            .Subscribe(_ => Store.Dispatch(new RemoveTodoItemAction {
                Id = TodoItem.Id
            }));

            TextBox.Events().LostFocus
            .Subscribe(e => Store.Dispatch(new UpdateTodoItemAction {
                Id = TodoItem.Id, Content = TextBox.Text
            }));
        }
Esempio n. 2
0
        private void Initialize()
        {
            if (TodoItem != null)
            {
                // Initialize UI
                TextBox.Text = TodoItem.Content ?? string.Empty;

                CompleteButton.HideIf(TodoItem.Completed);
                RevertCompleteButton.ShowIf(TodoItem.Completed);
            }
        }