/// <summary>
        /// Initializes a new instance of the AppShell, sets the static 'Current' reference,
        /// adds callbacks for Back requests and changes in the SplitView's DisplayMode, and
        /// provide the nav menu list with the data to display.
        /// </summary>
        public AppShell()
        {
            this.InitializeComponent();

            this.Loaded += async(sender, args) =>
            {
                Current = this;
                this.TogglePaneButton.Focus(FocusState.Programmatic);
                await ActionItemManager.ReloadAsync();
            };

            this.RootSplitView.RegisterPropertyChangedCallback(
                SplitView.DisplayModeProperty,
                (s, a) =>
            {
                // Ensure that we update the reported size of the TogglePaneButton when the SplitView's
                // DisplayMode changes.
                this.CheckTogglePaneButtonSizeChanged();
            });

            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(320, 500));

            SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested;

            // If on a phone device that has hardware buttons then we hide the app's back button.
            if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            {
                this.BackButton.Visibility = Visibility.Collapsed;
            }

            NavMenuList.ItemsSource = navlist;
        }
Beispiel #2
0
        private async void IsComplete_Click(object sender, RoutedEventArgs e)
        {
            // There is two way data binding going on - so what we don't need to do is worry
            // about storing the data. This is purely about refreshing the view on the basis
            // of changes

            // The thing being clicked isn't necessarily selected. So we need to fix that
            CheckBox     checkbox  = e.OriginalSource as CheckBox;
            ListViewItem container = checkbox.AllAncestry().First(el => el is ListViewItem) as ListViewItem;

            // It is really important we mark the container as selected. If we don't then we
            // get crashes on sort.
            container.IsSelected = true;

            // Similarly we need to make a note of the selected action
            ActionItemManager.Selected = this.ActionItems.ItemFromContainer(container) as ActionItem;
            this.AlterSelectionIfRequired();

            // Now sort and select
            ActionItemManager.Actions.Sort();
            this.SelectActionItemAndScroll();

            // And save
            await ActionItemManager.SaveAsync();
        }
Beispiel #3
0
 private void Create()
 {
     ActionItemManager.Selected = ActionItemManager.Create();
     ActionItemManager.Actions.Add(ActionItemManager.Selected);
     this.ActionItems.SelectedItem = ActionItemManager.Selected;
     this.Edit();
 }
        protected override async void OnNavigatedFrom(NavigationEventArgs e)
        {
            if (string.IsNullOrEmpty(this.ActionItem.Raw))
            {
                ActionItemManager.Delete(this.ActionItem);
            }
            else
            {
                // Try and save first...
                await ActionItemManager.SaveAsync();
            }

            // As you were
            base.OnNavigatedFrom(e);
            SystemNavigationManager.GetForCurrentView().BackRequested -= EditPage_BackRequested;
        }
Beispiel #5
0
        private async void SelectedIsComplete_Toggle()
        {
            // Only do anything if something is selected otherwise badness will happen
            if (ActionItemManager.Selected != null)
            {
                // We do need to worry about setting data here since this is non-standard
                ActionItemManager.Selected.IsComplete = !ActionItemManager.Selected.IsComplete;
                this.AlterSelectionIfRequired();

                // And save
                await ActionItemManager.SaveAsync();

                // Now sort
                ActionItemManager.Actions.Sort();
                this.SelectActionItemAndScroll();
            }
        }
Beispiel #6
0
        private async Task DeleteAsync()
        {
            IList <ActionItem> toBeDeleted = new List <ActionItem>();

            // We have to make a temporary list of things to delete as doing so in the loop
            // will invalidate the IEnumerable
            foreach (ActionItem actionItem in this.ActionItems.SelectedItems)
            {
                toBeDeleted.Add(actionItem);
            }

            foreach (var actionItem in toBeDeleted)
            {
                ActionItemManager.Delete(actionItem);
            }

            await ActionItemManager.SaveAsync();
        }
        private async void ChangeStorageLocation_Click(object sender, RoutedEventArgs e)
        {
            await Settings.SelectLocalFileAsync();

            await ActionItemManager.ReloadAsync();
        }
Beispiel #8
0
        private async void Refresh_Click(object sender, RoutedEventArgs e)
        {
            await ActionItemManager.ReloadAsync();

            this.SelectActionItemAndScroll();
        }