Beispiel #1
0
        public static async void ListView_Items_Tapped(object sender, TappedRoutedEventArgs e)
        {
            try
            {
                ListView SendListView = sender as ListView;
                Items    SelectedItem = ((e.OriginalSource as FrameworkElement).DataContext) as Items;
                ObservableCollection <Items> SelectedList = (ObservableCollection <Items>)SendListView.ItemsSource;
                if (SelectedItem != null)
                {
                    bool IsNetworkAvailable = NetworkInterface.GetIsNetworkAvailable();
                    if (AppVariables.ApplicationSettings["ItemOpenMethod"].ToString() == "1" && IsNetworkAvailable)
                    {
                        //Open item in webviewer
                        WebViewer webViewer = new WebViewer();
                        await webViewer.OpenPopup(null, SelectedItem);

                        //Mark the item as read
                        bool MarkedRead = await MarkItemAsReadPrompt(SelectedList, SelectedItem, false, true, true);

                        if (MarkedRead && (bool)AppVariables.ApplicationSettings["HideReadMarkedItem"])
                        {
                            await EventUpdateTotalItemsCount(null, null, false, true);
                        }
                    }
                    else if (AppVariables.ApplicationSettings["ItemOpenMethod"].ToString() == "2" && IsNetworkAvailable)
                    {
                        //Mark the item as read
                        bool MarkedRead = await MarkItemAsReadPrompt(SelectedList, SelectedItem, false, true, false);

                        if (MarkedRead && (bool)AppVariables.ApplicationSettings["HideReadMarkedItem"])
                        {
                            await EventUpdateTotalItemsCount(null, null, false, true);
                        }

                        //Open item in webbrowser
                        await Launcher.LaunchUriAsync(new Uri(SelectedItem.item_link, UriKind.RelativeOrAbsolute));
                    }
                    else
                    {
                        //Open item in itemviewer
                        ItemViewer itemViewer = new ItemViewer();
                        await itemViewer.OpenPopup(SelectedItem);

                        //Mark the item as read
                        bool MarkedRead = await MarkItemAsReadPrompt(SelectedList, SelectedItem, false, true, true);

                        if (MarkedRead && (bool)AppVariables.ApplicationSettings["HideReadMarkedItem"])
                        {
                            await EventUpdateTotalItemsCount(null, null, false, true);
                        }
                    }

                    //Reset the item selection
                    SendListView.SelectedIndex = -1;
                }
            }
            catch { }
        }
Beispiel #2
0
        //Open item in browser
        private static async Task ListItemOpenBrowser(ListView SendListView, Items SelectedItem, ObservableCollection <Items> SelectedList, string CurrentPageName)
        {
            try
            {
                int MsgBoxResult = 0;

                //Check internet connection
                if (!NetworkInterface.GetIsNetworkAvailable())
                {
                    await AVMessageBox.Popup("No internet connection", "You currently don't have an internet connection available to open this item or link in the webviewer or your webbrowser.", "Ok", "", "", "", "", false);

                    return;
                }

                //Get the target uri
                Uri targetUri = new Uri(SelectedItem.item_link, UriKind.RelativeOrAbsolute);

                //Check webbrowser only links
                if (targetUri != null)
                {
                    string TargetString = targetUri.ToString();
                    if (!TargetString.StartsWith("http"))
                    {
                        MsgBoxResult = 2;
                    }
                }

                if (MsgBoxResult != 2)
                {
                    string LowMemoryWarning = string.Empty;
                    if (AVFunctions.DevMemoryAvailableMB() < 200)
                    {
                        LowMemoryWarning = "\n\n* Your device is currently low on available memory and may cause issues when you open this link or item in the webviewer.";
                    }
                    MsgBoxResult = await AVMessageBox.Popup("Open this item or link", "Do you want to open this item or link in the webviewer or your webbrowser?" + LowMemoryWarning, "Webviewer (In-app)", "Webbrowser (Device)", "", "", "", true);
                }

                if (MsgBoxResult == 1)
                {
                    //Open item in webviewer
                    WebViewer webViewer = new WebViewer();
                    await webViewer.OpenPopup(targetUri, SelectedItem);

                    //Mark the item as read
                    await ListItemMarkRead(true, SendListView, SelectedItem, SelectedList, CurrentPageName);
                }
                else if (MsgBoxResult == 2)
                {
                    //Mark the item as read
                    await ListItemMarkRead(true, SendListView, SelectedItem, SelectedList, CurrentPageName);

                    //Open item in webbrowser
                    await Launcher.LaunchUriAsync(targetUri);
                }
            }
            catch { }
        }
Beispiel #3
0
        //Open item in browser
        private async Task OpenBrowser(Uri TargetUri, bool closePopup)
        {
            try
            {
                int MsgBoxResult = 0;

                //Check internet connection
                if (!NetworkInterface.GetIsNetworkAvailable())
                {
                    await new MessagePopup().Popup("No internet connection", "You currently don't have an internet connection available to open this item or link in the webviewer or your webbrowser.", "Ok", "", "", "", "", false);
                    return;
                }

                //Check webbrowser only links
                if (TargetUri != null)
                {
                    string TargetString = TargetUri.ToString();
                    if (!TargetString.StartsWith("http"))
                    {
                        MsgBoxResult = 2;
                    }
                }

                if (MsgBoxResult != 2)
                {
                    string LowMemoryWarning = string.Empty;
                    if (AVFunctions.DevMemoryAvailableMB() < 200)
                    {
                        LowMemoryWarning = "\n\n* Your device is currently low on available memory and may cause issues when you open this link or item in the webviewer.";
                    }
                    MsgBoxResult = await new MessagePopup().Popup("Open this item or link", "Do you want to open this item or link in the webviewer or your webbrowser?" + LowMemoryWarning, "Webviewer (In-app)", "Webbrowser (Device)", "", "", "", true);
                }

                if (MsgBoxResult == 1)
                {
                    if (closePopup)
                    {
                        ClosePopup();
                    }
                    //Open item in webviewer
                    WebViewer webViewer = new WebViewer();
                    await webViewer.OpenPopup(TargetUri, vCurrentWebSource);
                }
                else if (MsgBoxResult == 2)
                {
                    if (closePopup)
                    {
                        ClosePopup();
                    }
                    //Open item in webbrowser
                    if (TargetUri != null)
                    {
                        await Launcher.LaunchUriAsync(TargetUri);
                    }
                    else
                    {
                        await Launcher.LaunchUriAsync(new Uri(vCurrentWebSource.item_link, UriKind.RelativeOrAbsolute));
                    }
                }
            }
            catch { }
        }