Skip to content

Commit

Permalink
settings pivot item activated
Browse files Browse the repository at this point in the history
  • Loading branch information
mediaexplorer74 committed Dec 2, 2024
1 parent 5eb2b71 commit a810cba
Show file tree
Hide file tree
Showing 20 changed files with 163 additions and 204 deletions.
Binary file modified Images/shot01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Images/shot01a.png
Binary file not shown.
Binary file modified Images/shot02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Images/shot02a.png
Binary file not shown.
Binary file modified Images/shot03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Images/shot03a.png
Binary file not shown.
Binary file modified Images/shot04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Images/shot04a.png
Binary file not shown.
Binary file added Images/shot05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ My attempt to remake fully discontinued & obsolete [ForPDA](https://4pda.to/foru
Very early bird; draft UWP application to "parse" 4PDA web site on some winphone with Windows 10 Mobile os...

## Screenshots
![](Images/shot01a.png) ![](Images/shot02a.png)
![](Images/shot03a.png) ![](Images/shot04a.png)
![](Images/shot01.png) ![](Images/shot02.png)
![](Images/shot03.png) ![](Images/shot04.png)
![](Images/shot05.png)


## Tech/dev details
Expand Down
1 change: 1 addition & 0 deletions Src/FourPDA/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace FourPDA
sealed partial class App //: Application
{
private WinRTContainer container;
internal static bool AutoNavigateAlreadyApplied = false;

public App()
{
Expand Down
20 changes: 7 additions & 13 deletions Src/FourPDA/AppServices/ViewModels/News/NewsPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ protected override async void OnActivate()
{
base.OnInitialize();

//this.LoadDataAsync();


// Load real web data set
NewsItems = await RealLoadDataAsync();

Expand All @@ -143,8 +142,8 @@ private async Task<ObservableCollection<NewsItemDataModel>> RealLoadDataAsync()

try
{
// зарегистрирует кодовые страницы Windows.
// Тогда windows-1251 будет распознана HTTP клиентом автоматически.
// It will register Windows code pages. Then windows-1251
// will be recognized by the HTTP client automatically.
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);


Expand Down Expand Up @@ -172,14 +171,13 @@ private async Task<ObservableCollection<NewsItemDataModel>> RealLoadDataAsync()
int position = 0;
foreach (HtmlNode c_node in childNodes)
{
Debug.WriteLine(c_node);
oneNode[position] = c_node;
++position;
}

if ((oneNode[0].Name=="h2") && (oneNode[1].Name=="div"))
{
Debug.WriteLine(oneNode[0].InnerText + " :: " + oneNode[1].InnerText);
//Debug.WriteLine(oneNode[0].InnerText + " :: " + oneNode[1].InnerText);


HtmlNodeCollection subNodes = oneNode[0].ChildNodes;
Expand Down Expand Up @@ -220,17 +218,13 @@ private async Task<ObservableCollection<NewsItemDataModel>> RealLoadDataAsync()
}
//**********************
/*
// парсим ноды первого вида
HtmlNodeCollection newsNodes1 =
// bad plan
// парсим ноды первого вида
HtmlNodeCollection newsNodes1 =
//htmlDocument.DocumentNode.SelectNodes("//article/ * /div[@class='v-panel']/a"); //("//div[@class='v-panel']/a");
htmlDocument.DocumentNode.SelectNodes("//article/div[@class='description']/h2[@class='list-post-title']/a");
// парсим ноды второго вида
HtmlNodeCollection newsNodes2 =
//htmlDocument.DocumentNode.SelectNodes("//article/ * /div/p[@style='text-align: justify;']");
Expand Down
12 changes: 7 additions & 5 deletions Src/FourPDA/Controls/MainControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@

<TextBlock Text="Избранное" FontSize="24" FontWeight="Bold"
Foreground="White" Margin="0,0,0,20"/>
<TextBlock Text="(не готово)"/>

<!--TextBlock Text="(не готово)"/-->
<!--ContentControl micro:View.Model="{Binding NewsPageViewModel}"/-->
</StackPanel>
</ScrollViewer>
Expand Down Expand Up @@ -140,13 +141,14 @@
FontSize="20"
Foreground="White"
VerticalAlignment="Center"/>
<ComboBox x:Name="QualityComboBox"
SelectionChanged="QualityComboBox_SelectionChanged"
<ComboBox x:Name="StartModeComboBox"
Loaded="StartModeComboBox_Loaded"
SelectionChanged="StartModeComboBox_SelectionChanged"
Margin="20,0,0,0"
Width="150">
<ComboBoxItem Content="Избранное" Tag="favorites"/>
<ComboBoxItem Content="Новости" Tag="news"/>
<ComboBoxItem Content="Форумы" Tag="forums"/>
<ComboBoxItem Content="Форум" Tag="forum"/>
</ComboBox>
</StackPanel>
<TextBlock Text="Выберите предпочитаемый раздел при старте программы."
Expand All @@ -155,7 +157,7 @@
TextWrapping="Wrap"
Margin="0,0,0,20"/>

<TextBlock Text="(не готово)"/>
<!--TextBlock Text="(не готово)"/-->
</StackPanel>
</StackPanel>

Expand Down
51 changes: 41 additions & 10 deletions Src/FourPDA/Controls/MainControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
Expand All @@ -27,11 +28,22 @@ namespace FourPDA.Controls
public sealed partial class MainControl : UserControl
{
FourPDA.ViewModels.MainPageViewModel vm = default;

string _StartMode = "";
public MainControl()
{
Frame rootFrame = Window.Current.Content as Frame;
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;

if (localSettings.Values.ContainsKey("StartMode"))
{
_StartMode = (string)localSettings.Values["StartMode"];
}

// Frame rootFrame = Window.Current.Content as Frame;


this.InitializeComponent();

//((FrameworkElement) this).Loaded += new EventHandler(this.PageLoaded);

// ---------------------------------------------------------
Expand All @@ -43,10 +55,31 @@ public MainControl()
var HomePage = $"FourPDA.HomePage";
var HomePageType = Type.GetType(HomePage);

if (localSettings.Values.ContainsKey("StartMode"))
{
_StartMode = (string)localSettings.Values["StartMode"];
}


//ContentFrame...
//rootFrame.Navigate(HomePageType);
}//

private void StartModeComboBox_Loaded(object sender, RoutedEventArgs e)
{
string ToSelect = string.IsNullOrEmpty(_StartMode) ? "favorites" : _StartMode;

foreach (ComboBoxItem item in StartModeComboBox.Items)
{
if ((string)item.Tag == ToSelect)
{
StartModeComboBox.SelectedItem = item;
break;
}
}
}




// News click handler
Expand All @@ -70,8 +103,7 @@ private void Refresh_Click(object sender, RoutedEventArgs e)
}//Refresh_Click





//private void PageLoaded(object sender, EventArgs e)
//{
// AppBar.Setup<MainPivotViewModel>((Page)this).Third((Action<IApplicationBarIconButton, MainPivotViewModel>)
Expand Down Expand Up @@ -100,8 +132,9 @@ private void AboutApp_Click(object sender, RoutedEventArgs e)
}


private void QualityComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void StartModeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;

ComboBox comboBox = sender as ComboBox;

Expand All @@ -117,13 +150,11 @@ private void QualityComboBox_SelectionChanged(object sender, SelectionChangedEve

System.Diagnostics.Debug.WriteLine("Selected item Tag: " + selectedItem.Tag.ToString());

string qualityTag = selectedItem.Tag.ToString();

System.Diagnostics.Debug.WriteLine("Quality Tag: " + qualityTag);
_StartMode = selectedItem.Tag.ToString();

//Settings._selectedQuality = qualityTag;
System.Diagnostics.Debug.WriteLine("StartMode Tag: " + _StartMode);

//Settings.SelectedQuality = qualityTag;
localSettings.Values["StartMode"] = _StartMode;

}
else
Expand Down Expand Up @@ -168,7 +199,7 @@ public void NavigateToPage(object pageTag)
rootFrame.Navigate(pageType);
}


}
}

2 changes: 1 addition & 1 deletion Src/FourPDA/FourPDA.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundle>Always</AppxBundle>
<AppxBundle>Never</AppxBundle>
<AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
</PropertyGroup>
Expand Down
77 changes: 22 additions & 55 deletions Src/FourPDA/Views/Forum/ForumPageView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,62 +193,29 @@
Icon="Globe"
Label="News"/>

<AppBarButton
x:Name="ZoomIn"
x:Uid="ZoomIn"
Click="ZoomIn_Click"
Icon="ZoomIn"
Label="Zoom in"/>
<AppBarButton
x:Name="ZoomOut"
x:Uid="ZoomOut"
Click="ZoomOut_Click"
Icon="ZoomOut"
Label="Zoom out"/>

</CommandBar.PrimaryCommands>


<CommandBar.SecondaryCommands>

<!--AppBarButton
x:Name="Refresh"
x:Uid="Refresh"
Click="Refresh_Click"
Icon="Refresh"
Label="Refresh"/-->

<AppBarButton
x:Name="Settings"
x:Uid="Settings"
Click="Settings_Click"
Icon="Setting"
Label="Settings"/>

<!--AppBarToggleButton
x:Name="UiThemeToggle"
x:Uid="UiThemeToggle"
Click="UiThemeToggle_Click"
Icon="Clock"
Label="Dark theme"/-->

<!--AppBarToggleButton
x:Name="ForumModeToggle"
x:Uid="ForumModeToggle"
Click="ForumModeToggle_Click"
Icon="Document"
Label="Forum mode"/-->

<AppBarButton
x:Name="AboutMe"
x:Uid="AboutMe"
Click="AboutApp_Click"
Icon="Contact"
Label="About"/>

</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
x:Name="ZoomIn"
x:Uid="ZoomIn"
Click="ZoomIn_Click"
Icon="ZoomIn"
Label="Zoom in"/>

<AppBarButton
x:Name="ZoomOut"
x:Uid="ZoomOut"
Click="ZoomOut_Click"
Icon="ZoomOut"
Label="Zoom out"/>

</CommandBar.PrimaryCommands>


<!--CommandBar.SecondaryCommands>
</CommandBar.SecondaryCommands-->
</CommandBar>
</Page.BottomAppBar>



Expand Down
Loading

0 comments on commit a810cba

Please sign in to comment.