コード例 #1
0
        private void SettingsSave()
        {
            try
            {
                //Color Theme
                setting_ColorTheme.SelectedIndexChanged += async (sender, e) =>
                {
                    Picker ComboBox = (Picker)sender;
                    await AppSettingSave("ColorTheme", ComboBox.SelectedIndex);

                    //Adjust the color theme
                    AppAdjust.AdjustColorTheme();
                };

                //Item Scroll Direction
                setting_ListViewDirection.SelectedIndexChanged += async (sender, e) =>
                {
                    Picker ComboBox = (Picker)sender;
                    await AppSettingSave("ListViewDirection", ComboBox.SelectedIndex);

                    //Adjust the scrolling direction
                    if (EventChangeListViewDirection != null)
                    {
                        EventChangeListViewDirection(ComboBox.SelectedIndex);
                    }
                };

                //Adjust Font Size
                setting_AdjustFontSize.ValueChanged += async (sender, e) =>
                {
                    Slider Slider = (Slider)sender;
                    await AppSettingSave("AdjustFontSize", Convert.ToInt32(Slider.Value).ToString());
                    setting_AdjustFontSizeText.Text = "Adjust the displayed font size: " + Convert.ToInt32(Slider.Value);

                    //Adjust the font sizes
                    AppAdjust.AdjustFontSizes();
                };

                //Item list view style
                setting_ListViewStyle.SelectedIndexChanged += async (sender, e) =>
                {
                    Picker ComboBox = (Picker)sender;
                    await AppSettingSave("ListViewStyle", ComboBox.SelectedIndex);

                    //Adjust the list style
                    if (EventChangeListViewStyle != null)
                    {
                        EventChangeListViewStyle(ComboBox.SelectedIndex);
                    }
                };
            }
            catch { }
        }
コード例 #2
0
        public void ClosePopup()
        {
            try
            {
                //Reset the image resources
                vBitmapImage        = null;
                image_source.Source = null;

                //Disable page events
                DisablePageEvents();

                //Adjust screen rotation
                AppAdjust.AdjustScreenRotation();

                //Close the popup
                popup_Main.IsOpen = false;
            }
            catch { }
        }
コード例 #3
0
        private async Task HideShowHeader(bool ForceClose)
        {
            try
            {
                Int32 HeaderTargetSize  = Convert.ToInt32(stackpanel_Header.Tag);
                Int32 HeaderCurrentSize = Convert.ToInt32(stackpanel_Header.Height);
                if (ForceClose || HeaderCurrentSize == HeaderTargetSize)
                {
                    AVAnimations.Ani_Height(stackpanel_Header, 0, false, 0.075);
                    await HideShowMenu(true);

                    if (!AVFunctions.DevMobile())
                    {
                        iconMenu.Margin = new Thickness(0, 0, 16, 0);
                    }

                    image_iconMenu.Source = await AVImage.LoadBitmapImage("ms-appx:///Assets/iconMenu-Dark.png", false);

                    image_iconMenu.Opacity = 0.60;

                    grid_StatusApplication.Margin     = new Thickness(0, 0, 0, 0);
                    grid_StatusApplication.Background = new SolidColorBrush(Color.FromArgb(255, 88, 88, 88))
                    {
                        Opacity = 0.60
                    };
                    border_StatusCurrentItem.Background = new SolidColorBrush(Color.FromArgb(255, 88, 88, 88))
                    {
                        Opacity = 0.50
                    };

                    //Update the current item status text
                    if (AppVariables.CurrentTotalItemsCount == 0)
                    {
                        textblock_StatusCurrentItem.Text = textblock_StatusCurrentItem.Tag.ToString();
                    }
                    else
                    {
                        textblock_StatusCurrentItem.Text = textblock_StatusCurrentItem.Tag.ToString() + "/" + AppVariables.CurrentTotalItemsCount;
                    }

                    //Adjust the title bar color
                    await AppAdjust.AdjustTitleBarColor(this.RequestedTheme, false, false);

                    AppVariables.HeaderHidden = true;
                }
                else
                {
                    AVAnimations.Ani_Height(stackpanel_Header, HeaderTargetSize, true, 0.075);

                    iconMenu.Margin = new Thickness(0, 0, 0, 0);

                    image_iconMenu.Source = await AVImage.LoadBitmapImage("ms-appx:///Assets/iconMenu.png", false);

                    image_iconMenu.Opacity = 1;

                    grid_StatusApplication.Margin     = new Thickness(0, 65, 0, 0);
                    grid_StatusApplication.Background = new SolidColorBrush((Color)Resources["SystemAccentColor"])
                    {
                        Opacity = 0.60
                    };
                    border_StatusCurrentItem.Background = new SolidColorBrush((Color)Resources["SystemAccentColor"])
                    {
                        Opacity = 0.50
                    };

                    //Update the current item status text
                    textblock_StatusCurrentItem.Text = textblock_StatusCurrentItem.Tag.ToString();

                    //Adjust the title bar color
                    await AppAdjust.AdjustTitleBarColor(this.RequestedTheme, true, false);

                    AppVariables.HeaderHidden = false;
                }
            }
            catch { }
        }
コード例 #4
0
        private void SettingsSave()
        {
            try
            {
                //Disable Landscape Display
                setting_DisableLandscapeDisplay.Click += (sender, e) =>
                {
                    CheckBox CheckBox = (CheckBox)sender;
                    if ((bool)CheckBox.IsChecked)
                    {
                        AppVariables.ApplicationSettings["DisableLandscapeDisplay"] = true;
                        DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;
                    }
                    else
                    {
                        AppVariables.ApplicationSettings["DisableLandscapeDisplay"] = false;
                        DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait | DisplayOrientations.Landscape;
                    }
                };

                //Color Theme
                setting_ColorTheme.SelectionChanged += (sender, e) =>
                {
                    ComboBox ComboBox = (ComboBox)sender;
                    AppVariables.ApplicationSettings["ColorTheme"] = ComboBox.SelectedIndex;

                    //Adjust the color theme
                    AppAdjust.AdjustColorTheme();
                };

                //Item Scroll Direction
                setting_ItemScrollDirection.SelectionChanged += (sender, e) =>
                {
                    ComboBox ComboBox = (ComboBox)sender;
                    AppVariables.ApplicationSettings["ItemScrollDirection"] = ComboBox.SelectedIndex;

                    //Adjust the scrolling direction
                    EventAdjustItemsScrollingDirection(ComboBox.SelectedIndex);
                };

                //Adjust Font Size
                setting_AdjustFontSize.ValueChanged += (sender, e) =>
                {
                    Slider Slider = (Slider)sender;
                    AppVariables.ApplicationSettings["AdjustFontSize"] = Slider.Value.ToString();

                    //Adjust the font sizes
                    AppAdjust.AdjustFontSizes();
                };

                //Item list view style
                setting_ListViewStyle.SelectionChanged += (sender, e) =>
                {
                    ComboBox ComboBox = (ComboBox)sender;
                    AppVariables.ApplicationSettings["ListViewStyle"] = ComboBox.SelectedIndex;

                    //Adjust the list style
                    EventChangeListViewStyle(ComboBox.SelectedIndex);
                };
            }
            catch { }
        }
コード例 #5
0
        //Load item into the viewer
        private async Task LoadItem(string CustomItemContent)
        {
            try
            {
                //Wait for busy database
                await ApiUpdate.WaitForBusyDatabase();

                //Load the full item
                TableItems LoadTable = await SQLConnection.Table <TableItems>().Where(x => x.item_id == vCurrentWebSource.item_id).FirstOrDefaultAsync();

                if (LoadTable != null)
                {
                    //Check if media needs to load
                    AppVariables.LoadMedia = true;
                    if (!NetworkInterface.GetIsNetworkAvailable() && !(bool)AppVariables.ApplicationSettings["DisplayImagesOffline"])
                    {
                        AppVariables.LoadMedia = false;
                    }

                    //Set the date time string
                    DateTime convertedDate    = DateTime.SpecifyKind(LoadTable.item_datetime, DateTimeKind.Utc).ToLocalTime();
                    string   DateAuthorString = convertedDate.ToString(AppVariables.CultureInfoFormat.LongDatePattern, AppVariables.CultureInfoFormat) + ", " + convertedDate.ToString(AppVariables.CultureInfoFormat.ShortTimePattern, AppVariables.CultureInfoFormat);

                    //Add the author to date time
                    if (!string.IsNullOrWhiteSpace(LoadTable.item_author))
                    {
                        DateAuthorString += " by " + LoadTable.item_author;
                    }
                    tb_ItemDateString.Text = DateAuthorString;

                    //Enable or disable text selection
                    if ((bool)AppVariables.ApplicationSettings["ItemTextSelection"])
                    {
                        tb_ItemTitle.IsTextSelectionEnabled      = true;
                        tb_ItemDateString.IsTextSelectionEnabled = true;
                        rtb_ItemContent.IsTextSelectionEnabled   = true;
                    }
                    else
                    {
                        tb_ItemTitle.IsTextSelectionEnabled      = false;
                        tb_ItemDateString.IsTextSelectionEnabled = false;
                        rtb_ItemContent.IsTextSelectionEnabled   = false;
                    }

                    //Load the item content
                    bool SetHtmlToRichTextBlock = false;
                    if (!string.IsNullOrWhiteSpace(CustomItemContent))
                    {
                        await HtmlToRichTextBlock(rtb_ItemContent, CustomItemContent, string.Empty);

                        SetHtmlToRichTextBlock = true;
                    }
                    else if (!string.IsNullOrWhiteSpace(LoadTable.item_content_full))
                    {
                        SetHtmlToRichTextBlock = await HtmlToRichTextBlock(rtb_ItemContent, LoadTable.item_content_full, string.Empty);
                    }

                    //Check if html to xaml has failed
                    if (!SetHtmlToRichTextBlock || !rtb_ItemContent.Blocks.Any())
                    {
                        //Load summary text
                        Paragraph paragraph = new Paragraph();
                        paragraph.Inlines.Add(new Run()
                        {
                            Text = AVFunctions.StringCut(LoadTable.item_content, AppVariables.MaximumItemTextLength, "...")
                        });

                        //Add paragraph to rich text block
                        rtb_ItemContent.Blocks.Clear();
                        rtb_ItemContent.Blocks.Add(paragraph);
                    }

                    //Wait for item content is loaded
                    await AppAdjust.FinishLayoutUpdateAsync(rtb_ItemContent);

                    //Check if item content contains preview image
                    await CheckItemContentContainsPreviewImage(LoadTable);

                    //Adjust the itemviewer size
                    await AdjustItemViewerSize();
                }
            }
            catch { }
        }
コード例 #6
0
        private void SettingsSave()
        {
            try
            {
                //Disable Landscape Display
                setting_DisableLandscapeDisplay.Click += (sender, e) =>
                {
                    CheckBox CheckBox = (CheckBox)sender;
                    AppVariables.ApplicationSettings["DisableLandscapeDisplay"] = (bool)CheckBox.IsChecked;

                    //Adjust screen rotation
                    AppAdjust.AdjustScreenRotation();

                    //Adjust the listview rotation
                    AppAdjust.AdjustListviewRotationEvent(null, null);
                };

                //Color Theme
                setting_ColorTheme.SelectionChanged += (sender, e) =>
                {
                    ComboBox ComboBox = (ComboBox)sender;
                    AppVariables.ApplicationSettings["ColorTheme"] = ComboBox.SelectedIndex;

                    //Adjust the color theme
                    AppAdjust.AdjustColorTheme();
                };

                //Item Scroll Direction
                setting_ItemScrollDirection.SelectionChanged += (sender, e) =>
                {
                    ComboBox ComboBox = (ComboBox)sender;
                    AppVariables.ApplicationSettings["ItemScrollDirection"] = ComboBox.SelectedIndex;

                    //Adjust the scrolling direction
                    EventAdjustItemsScrollingDirection(ComboBox.SelectedIndex);
                };

                //Adjust Font Size
                setting_AdjustFontSize.ValueChanged += (sender, e) =>
                {
                    Slider Slider = (Slider)sender;

                    string fontSize = Slider.Value.ToString();
                    AppVariables.ApplicationSettings["AdjustFontSize"] = Slider.Value.ToString();
                    textblock_AdjustFontSize.Text = textblock_AdjustFontSize.Tag.ToString() + fontSize;

                    //Adjust the font sizes
                    AppAdjust.AdjustFontSizes();
                };

                //Item list view style
                setting_ListViewStyle.SelectionChanged += (sender, e) =>
                {
                    ComboBox ComboBox = (ComboBox)sender;
                    AppVariables.ApplicationSettings["ListViewStyle"] = ComboBox.SelectedIndex;

                    //Adjust the list style
                    EventChangeListViewStyle(ComboBox.SelectedIndex);
                };
            }
            catch { }
        }