예제 #1
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            this.DataContext = _viewModel.Items;

            var dragReOrderInteraction = new DragReOrderInteraction(dragImageControl);

            dragReOrderInteraction.Initialise(todoList, _viewModel.Items);

            var swipeInteraction = new SwipeInteraction();

            swipeInteraction.Initialise(todoList, _viewModel.Items);

            var tapEditInteraction = new TapEditInteraction();

            tapEditInteraction.Initialise(todoList, _viewModel.Items);

            var addItemInteraction = new PullDownToAddNewInteraction(tapEditInteraction, pullDownItemInFront);

            addItemInteraction.Initialise(todoList, _viewModel.Items);

            _pinchAddNewItemInteraction = new PinchAddNewInteraction(tapEditInteraction, pullDownItemBehind);
            _pinchAddNewItemInteraction.Initialise(todoList, _viewModel.Items);

            _interactionManager.AddInteraction(swipeInteraction);
            _interactionManager.AddInteraction(dragReOrderInteraction);
            _interactionManager.AddInteraction(addItemInteraction);
            _interactionManager.AddInteraction(tapEditInteraction);
            _interactionManager.AddInteraction(_pinchAddNewItemInteraction);

            FrameworkDispatcher.Update();
        }
예제 #2
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            _viewModel.Items.Add(new ToDoItemViewModel("Feed the cat"));
            _viewModel.Items.Add(new ToDoItemViewModel("Buy eggs"));
            _viewModel.Items.Add(new ToDoItemViewModel("Pack bags for WWDC conference"));
            _viewModel.Items.Add(new ToDoItemViewModel("Rule the web"));
            _viewModel.Items.Add(new ToDoItemViewModel("Order business cards"));
            _viewModel.Items.Add(new ToDoItemViewModel("Fix laptop"));
            _viewModel.Items.Add(new ToDoItemViewModel("Get some dollars for trip"));
            _viewModel.Items.Add(new ToDoItemViewModel("Shirts"));
            _viewModel.Items.Add(new ToDoItemViewModel("Shopping"));
            _viewModel.Items.Add(new ToDoItemViewModel("Contact PR company"));
            _viewModel.Items.Add(new ToDoItemViewModel("Extension plans"));
            _viewModel.Items.Add(new ToDoItemViewModel("Choose colour scheme"));
            _viewModel.Items.Add(new ToDoItemViewModel("Create new website"));
            _viewModel.Items.Add(new ToDoItemViewModel("Write-up blog post"));
            _viewModel.Items.Add(new ToDoItemViewModel("Choose life"));
            _viewModel.Items.Add(new ToDoItemViewModel("Simplify my life"));

            this.DataContext = _viewModel.Items;

            var dragReOrderInteraction = new DragReOrderInteraction(dragImageControl);

            dragReOrderInteraction.Initialise(todoList, _viewModel.Items);

            var swipeInteraction = new SwipeInteraction();

            swipeInteraction.Initialise(todoList, _viewModel.Items);

            var tapEditInteraction = new TapEditInteraction();

            tapEditInteraction.Initialise(todoList, _viewModel.Items);

            var addItemInteraction = new PullDownToAddNewInteraction(tapEditInteraction, pullDownItemInFront);

            addItemInteraction.Initialise(todoList, _viewModel.Items);

            var pinchAddNewItemInteraction = new PinchAddNewInteraction(tapEditInteraction, pullDownItemBehind);

            pinchAddNewItemInteraction.Initialise(todoList, _viewModel.Items);

            _interactionManager.AddInteraction(swipeInteraction);
            _interactionManager.AddInteraction(dragReOrderInteraction);
            _interactionManager.AddInteraction(addItemInteraction);
            _interactionManager.AddInteraction(tapEditInteraction);
            _interactionManager.AddInteraction(pinchAddNewItemInteraction);

            FrameworkDispatcher.Update();
        }
예제 #3
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (this.DataContext == null)
            {
                Guid messageId;

                messageId = Guid.Parse(NavigationContext.QueryString["clientmessageid"]);

                message = DataSync.Instance.GetMessageFromClientId(messageId);

                if (message != null)
                {
                    Messenger.Default.Register<NewMessageEvent>(this, this.MessageSavedEvent);
                    this.DataContext = message;

                    message.LoadTaskList();
                    if (message.TaskItemList != null)
                    {
                        message.TaskItemList = new ObservableSortedList<MessageModel>(message.TaskItemList, new TaskListComparer<MessageModel>());
                    }
                    else
                    {
                        message.TaskItemList = new ObservableSortedList<MessageModel>(4, new TaskListComparer<MessageModel>());
                    }

                    this.TasksListSelector.ItemsSource = message.TaskItemList;

                    dragReOrderInteraction = new DragReOrderInteraction<MessageModel>(dragImageControl);
                    dragReOrderInteraction.Initialize(this.TasksListSelector, itemManager, message.TaskItemList);

                    swipeInteraction = new SwipeInteraction<MessageModel>();
                    swipeInteraction.Initialize(this.TasksListSelector, itemManager, message.TaskItemList);

                    tapEditInteraction = new TapEditInteraction<MessageModel>();
                    tapEditInteraction.Initialize(this.TasksListSelector, itemManager, message.TaskItemList);
                    tapEditInteraction.SaveEditText = this.SaveTaskItemName;

                    //addItemInteraction = new PullDownToAddNewInteraction<MessageModel>(tapEditInteraction, pullDownItemInFront);
                    //addItemInteraction.Initialize(this.TasksListSelector, itemManager, message.TaskItemList);

                    pinchAddNewItemInteraction = new PinchAddNewInteraction<MessageModel>(tapEditInteraction, pullDownItemBehind);
                    pinchAddNewItemInteraction.Initialize(this.TasksListSelector, itemManager, message.TaskItemList);

                    _interactionManager.AddInteraction(swipeInteraction);
                    _interactionManager.AddInteraction(dragReOrderInteraction);
                    //_interactionManager.AddInteraction(addItemInteraction);
                    _interactionManager.AddInteraction(tapEditInteraction);
                    _interactionManager.AddInteraction(pinchAddNewItemInteraction);

                    if (this.message.TaskItemCount == 0)
                    {
                        MessageModel newItem = itemManager.CreateTaskMessage();
                        newItem.ItemOrder = itemManager.GetItemOrder(null, null);
                        this.message.TaskItemList.Add(newItem);
                        this.TasksListSelector.InvokeOnNextLayoutUpdated(() => this.tapEditInteraction.EditItem(newItem));
                    }

                    FrameworkDispatcher.Update();
                }
            }

            this._interactionManager.EnableInteractions();

            if (DataContext != null)
            {
                if (message.TaskItemList != null &&
                    (message.TaskItemList.Count > 0 && message.TaskItemList[0].CompareTo(pullMeDownMessage) != 0) ||
                    message.TaskItemList.Count == 0)
                {
                    //message.TaskItemList.Add(pullMeDownMessage);
                }

                this.ApplicationBar = (ApplicationBar)this.Resources["ShareTaskApplicationBar"];
            }
        }
예제 #4
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (this.DataContext == null)
            {
                Guid messageId;

                messageId = Guid.Parse(NavigationContext.QueryString["clientmessageid"]);

                message = DataSync.Instance.GetMessageFromClientId(messageId);

                if (message != null)
                {
                    Messenger.Default.Register <NewMessageEvent>(this, this.MessageSavedEvent);
                    this.DataContext = message;

                    message.LoadTaskList();
                    if (message.TaskItemList != null)
                    {
                        message.TaskItemList = new ObservableSortedList <MessageModel>(message.TaskItemList, new TaskListComparer <MessageModel>());
                    }
                    else
                    {
                        message.TaskItemList = new ObservableSortedList <MessageModel>(4, new TaskListComparer <MessageModel>());
                    }

                    this.TasksListSelector.ItemsSource = message.TaskItemList;

                    dragReOrderInteraction = new DragReOrderInteraction <MessageModel>(dragImageControl);
                    dragReOrderInteraction.Initialize(this.TasksListSelector, itemManager, message.TaskItemList);

                    swipeInteraction = new SwipeInteraction <MessageModel>();
                    swipeInteraction.Initialize(this.TasksListSelector, itemManager, message.TaskItemList);

                    tapEditInteraction = new TapEditInteraction <MessageModel>();
                    tapEditInteraction.Initialize(this.TasksListSelector, itemManager, message.TaskItemList);
                    tapEditInteraction.SaveEditText = this.SaveTaskItemName;

                    //addItemInteraction = new PullDownToAddNewInteraction<MessageModel>(tapEditInteraction, pullDownItemInFront);
                    //addItemInteraction.Initialize(this.TasksListSelector, itemManager, message.TaskItemList);

                    pinchAddNewItemInteraction = new PinchAddNewInteraction <MessageModel>(tapEditInteraction, pullDownItemBehind);
                    pinchAddNewItemInteraction.Initialize(this.TasksListSelector, itemManager, message.TaskItemList);

                    _interactionManager.AddInteraction(swipeInteraction);
                    _interactionManager.AddInteraction(dragReOrderInteraction);
                    //_interactionManager.AddInteraction(addItemInteraction);
                    _interactionManager.AddInteraction(tapEditInteraction);
                    _interactionManager.AddInteraction(pinchAddNewItemInteraction);


                    if (this.message.TaskItemCount == 0)
                    {
                        MessageModel newItem = itemManager.CreateTaskMessage();
                        newItem.ItemOrder = itemManager.GetItemOrder(null, null);
                        this.message.TaskItemList.Add(newItem);
                        this.TasksListSelector.InvokeOnNextLayoutUpdated(() => this.tapEditInteraction.EditItem(newItem));
                    }

                    FrameworkDispatcher.Update();
                }
            }

            this._interactionManager.EnableInteractions();

            if (DataContext != null)
            {
                if (message.TaskItemList != null &&
                    (message.TaskItemList.Count > 0 && message.TaskItemList[0].CompareTo(pullMeDownMessage) != 0) ||
                    message.TaskItemList.Count == 0)
                {
                    //message.TaskItemList.Add(pullMeDownMessage);
                }

                this.ApplicationBar = (ApplicationBar)this.Resources["ShareTaskApplicationBar"];
            }
        }