public ShellViewModel(IPageManager pageManager)
        {
            this.ViewAware = pageManager as PageManagerViewModel;

            TreeItems.AddRange(MainMenuTreeItemsProvider.GetDatas());
            TreeItems.FirstOrDefault().IsSelected = true;
            TreeViewSelectedChanged(TreeItems.FirstOrDefault());
        }
Esempio n. 2
0
        private async void OnMarkAllAsRead()
        {
            if (TreeItems == null)
            {
                return;
            }

            var item = TreeItems.FirstOrDefault();

            if (item == null)
            {
                return;
            }

            var dlg = new MessageDialog(Strings.Resources.MarkAllAsReadDialogContent);

            dlg.Commands.Add(new UICommand(Strings.Resources.DialogCommandYes)
            {
                Id = 1
            });
            dlg.Commands.Add(new UICommand(Strings.Resources.DialogCommandNo)
            {
                Id = 0
            });
            var x = await dlg.ShowAsync();

            if ((int)x.Id != 1)
            {
                return;
            }

            Exception error = null;

            try
            {
                _telemetryClient.TrackEvent(TelemetryEvents.MarkAllAsRead);

                var timestamp = GetUnixTimeStamp();
                await _apiClient.MarkAllAsReadAsync(item.Id, timestamp);

                LoadSubscriptions();
            }
            catch (Exception ex)
            {
                error = ex;
                _telemetryClient.TrackException(ex);
            }

            if (error == null)
            {
                return;
            }

            MessageDialog msgbox = new MessageDialog(error.Message, Strings.Resources.ErrorDialogTitle);
            await msgbox.ShowAsync();
        }
Esempio n. 3
0
        private void UpdateSelectedTreeItem(long?selectedTreeItemId)
        {
            TreeItemViewModel findSelectedTreeItem = null;

            if (selectedTreeItemId.HasValue)
            {
                findSelectedTreeItem = TreeItems.FirstOrDefault(item => item.Id.Equals(selectedTreeItemId.Value) && item.Visibility);
            }

            if (findSelectedTreeItem == null)
            {
                findSelectedTreeItem = TreeItems.FirstOrDefault(item => item.Visibility);
            }

            SelectedTreeItem = findSelectedTreeItem;
        }