Exemple #1
0
        public MainPage()
        {
            this.InitializeComponent();

            Messenger.Default.Register <GenericMessage <string> >(this, MessengerTokens.ToastToken, msg =>
            {
                ToastControl.ShowMessage(msg.Content);
            });
            Messenger.Default.Register <GenericMessage <string> >(this, MessengerTokens.CloseHam, msg =>
            {
                if (_isDrawerSlided)
                {
                    SlideOutStory.Begin();
                    HamburgerBtn.PlayHamOutStory();
                    _isDrawerSlided = false;
                }
            });
            Messenger.Default.Register <GenericMessage <string> >(this, MessengerTokens.RemoveScheduleUI, msg =>
            {
                RemoveStory.Begin();
            });
            Messenger.Default.Register <GenericMessage <string> >(this, MessengerTokens.ShowModifyUI, msg =>
            {
                AddingPane.Visibility = Visibility.Visible;
                AddStory.Begin();
            });
            Messenger.Default.Register <GenericMessage <string> >(this, MessengerTokens.ChangeCommandBarToDelete, msg =>
            {
                SwitchCommandBarToDelete.Begin();
            });
            Messenger.Default.Register <GenericMessage <string> >(this, MessengerTokens.ChangeCommandBarToDefault, msg =>
            {
                SwitchCommandBarToDefault.Begin();
            });
            Messenger.Default.Register <GenericMessage <string> >(this, MessengerTokens.GoToSort, act =>
            {
                DisplayedListView.CanDragItems    = true;
                DisplayedListView.CanReorderItems = true;
                DisplayedListView.AllowDrop       = true;
            });
            Messenger.Default.Register <GenericMessage <string> >(this, MessengerTokens.LeaveSort, act =>
            {
                DisplayedListView.CanDragItems    = false;
                DisplayedListView.CanReorderItems = false;
                DisplayedListView.AllowDrop       = true;
            });
            RemoveStory.Completed += ((senderc, ec) =>
            {
                _isAddingPaneShowed = false;
            });

            this.KeyDown += ((sender, e) =>
            {
                if (_isAddingPaneShowed && e.Key == Windows.System.VirtualKey.Enter && e.KeyStatus.RepeatCount == 1)
                {
                    Messenger.Default.Send(new GenericMessage <string>(""), MessengerTokens.EnterToAdd);
                    RemoveStory.Begin();
                }
            });
        }
Exemple #2
0
 private void MaskBorder_Tapped(object sender, TappedRoutedEventArgs e)
 {
     if (_isDrawerSlided)
     {
         _isDrawerSlided = false;
         HamburgerBtn.PlayHamOutStory();
         SlideOutStory.Begin();
     }
 }
Exemple #3
0
 protected override void OnNavigatedFrom(NavigationEventArgs e)
 {
     base.OnNavigatedFrom(e);
     if (_isDrawerSlided)
     {
         SlideOutStory.Begin();
         HamburgerBtn.PlayHamOutStory();
         _isDrawerSlided = false;
     }
 }
Exemple #4
0
 protected override void OnNavigatedFrom(NavigationEventArgs e)
 {
     base.OnNavigatedFrom(e);
     if (_isDrawerSlided && CoreWindow.GetForCurrentThread().Bounds.Width < WIDTH_THRESHOLD)
     {
         ToggleDrawerAnimation(false);
         ToggleDrawerMaskAnimation(false);
         HamburgerBtn.PlayHamOutStory();
         _isDrawerSlided = false;
     }
 }
Exemple #5
0
 private void HandleBackLogic()
 {
     if (_isAddingPaneShowed)
     {
         RemoveStory.Begin();
         _isAddingPaneShowed = false;
     }
     if (_isDrawerSlided)
     {
         SlideOutStory.Begin();
         HamburgerBtn.PlayHamOutStory();
         _isDrawerSlided = false;
     }
 }
Exemple #6
0
 private void RegisterMessenger()
 {
     Messenger.Default.Register <GenericMessage <ObservableCollection <ToDo> > >(this, MessengerTokens.UpdateTile, async msg =>
     {
         await TileControl.UpdateTileAsync(msg.Content);
     });
     Messenger.Default.Register <GenericMessage <string> >(this, MessengerTokens.CloseHam, msg =>
     {
         if (_isDrawerSlided && CoreWindow.GetForCurrentThread().Bounds.Width < 720)
         {
             ToggleDrawerAnimation(false);
             ToggleDrawerMaskAnimation(false);
             HamburgerBtn.PlayHamOutStory();
             _isDrawerSlided = false;
         }
     });
     Messenger.Default.Register(this, MessengerTokens.ChangeCommandBarToDelete, (GenericMessage <string> msg) =>
     {
         this.SwitchToDeleteCommandBar();
     });
     Messenger.Default.Register(this, MessengerTokens.ChangeCommandBarToDefault, (GenericMessage <string> msg) =>
     {
         this.SwitchToDefaultCommandBar();
     });
     Messenger.Default.Register <GenericMessage <string> >(this, MessengerTokens.GoToSort, act =>
     {
         DisplayedListView.CanDragItems       = true;
         DisplayedListView.CanReorderItems    = true;
         DisplayedListView.AllowDrop          = true;
         DisplayedListView.IsItemClickEnabled = false;
         ToastService.SendToast(ResourcesHelper.GetResString("ReorderHint"));
     });
     Messenger.Default.Register <GenericMessage <string> >(this, MessengerTokens.LeaveSort, act =>
     {
         DisplayedListView.CanDragItems       = false;
         DisplayedListView.CanReorderItems    = false;
         DisplayedListView.AllowDrop          = false;
         DisplayedListView.IsItemClickEnabled = true;
     });
 }