Revert "Refactoring"

This reverts commit 832f54a7d9360cd25400e3424f6faf147eaaf9c5.
This commit is contained in:
TheJoKlLa 2021-09-20 18:40:39 +02:00
parent 19091c6a3b
commit 7b0cf64d0e
25 changed files with 301 additions and 103 deletions

View File

@ -45,6 +45,7 @@ namespace Borepin
containerRegistry.RegisterForNavigation<MachineListPage, MachineListPageModel>(); containerRegistry.RegisterForNavigation<MachineListPage, MachineListPageModel>();
containerRegistry.RegisterForNavigation<ServerListPage, ServerListPageModel>(); containerRegistry.RegisterForNavigation<ServerListPage, ServerListPageModel>();
containerRegistry.RegisterForNavigation<ServerPage, ServerPageModel>(); containerRegistry.RegisterForNavigation<ServerPage, ServerPageModel>();
containerRegistry.RegisterForNavigation<ListPage, ListPageModel>();
containerRegistry.RegisterForNavigation<WelcomePage, WelcomePageModel>("SetUpProcess_WelcomePage"); containerRegistry.RegisterForNavigation<WelcomePage, WelcomePageModel>("SetUpProcess_WelcomePage");
containerRegistry.RegisterForNavigation<ScanPage, ScanPageModel>("SetUpProcess_ScanPage"); containerRegistry.RegisterForNavigation<ScanPage, ScanPageModel>("SetUpProcess_ScanPage");

View File

@ -68,6 +68,9 @@
<EmbeddedResource Update="Page\AddServerProcess\HostSelectPage.xaml"> <EmbeddedResource Update="Page\AddServerProcess\HostSelectPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="Page\ListPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\AddServerProcess\LoginChoosePage.xaml"> <EmbeddedResource Update="Page\AddServerProcess\LoginChoosePage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
@ -98,6 +101,9 @@
<EmbeddedResource Update="Page\StartUpDistributorPage.xaml"> <EmbeddedResource Update="Page\StartUpDistributorPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="Page\TestPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx"> <EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -109,6 +115,12 @@
<EmbeddedResource Update="Styles\LightTheme.xaml"> <EmbeddedResource Update="Styles\LightTheme.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="View\IsBusyView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="View\ListItemView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="View\ScanView.xaml"> <EmbeddedResource Update="View\ScanView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:Borepin.View"
x:Class="Borepin.Page.ListPage">
<ContentPage.Content>
<StackLayout>
<ListView ItemsSource="{Binding ListItemViewModel_List}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<views:ListItemView />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -0,0 +1,15 @@

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ListPage : ContentPage
{
public ListPage()
{
InitializeComponent();
}
}
}

View File

@ -3,26 +3,14 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.Page.SetUpProcess.ScanPage" x:Class="Borepin.Page.SetUpProcess.ScanPage"
xmlns:i18n="clr-namespace:Borepin.Helpers" xmlns:i18n="clr-namespace:Borepin.Helpers"
xmlns:views="clr-namespace:Borepin.View" xmlns:views="clr-namespace:Borepin.View">
xmlns:converters="clr-namespace:Borepin.Converter">
<NavigationPage.TitleView>
<Label Text="FabAccess" HorizontalOptions="End" Margin="0, 0, 10, 0" VerticalOptions="CenterAndExpand" FontSize="Medium" TextColor="{StaticResource FirstColor}"/>
</NavigationPage.TitleView>
<ContentPage.Resources>
<ResourceDictionary>
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content> <ContentPage.Content>
<StackLayout Padding="20"> <ScrollView>
<StackLayout IsVisible="{Binding IsBusy}"> <StackLayout Style="{StaticResource Style_StackLayout_Content}">
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
</StackLayout>
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
<views:ScanView /> <views:ScanView />
<Label Text="{i18n:Translate SetUp_ScanPage_Text}" Style="{StaticResource Style_Label_Text}"/> <Label Text="{i18n:Translate SetUp_ScanPage_Text}" Style="{StaticResource Style_Label_Text}"/>
<Button Text="{i18n:Translate SetUp_ScanPage_Button}" Command="{Binding NextCommand}" Style="{StaticResource Style_Button_Primary}"/> <Button Text="{i18n:Translate SetUp_ScanPage_Button}" Command="{Binding NextCommand}" Style="{StaticResource Style_Button_Primary}"/>
</StackLayout> </StackLayout>
</StackLayout> </ScrollView>
</ContentPage.Content> </ContentPage.Content>
</ContentPage> </ContentPage>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.Page.TestPage"
xmlns:converters="clr-namespace:Borepin.Converter">
<ContentPage.Resources>
<ResourceDictionary>
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout Padding="20">
<StackLayout IsVisible="{Binding IsBusy}">
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
</StackLayout>
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
<Label Text="TestPage"/>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class TestPage : ContentPage
{
public TestPage()
{
InitializeComponent();
}
}
}

View File

@ -31,12 +31,11 @@ namespace Borepin.PageModel.AddServerProcess
#endregion #endregion
#region LoadData #region LoadData
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true;
IsBusy = false; IsBusy = false;
await Task.CompletedTask;
return Task.CompletedTask;
} }
#endregion #endregion
@ -125,8 +124,7 @@ namespace Borepin.PageModel.AddServerProcess
public override void OnNavigatedTo(INavigationParameters parameters) public override void OnNavigatedTo(INavigationParameters parameters)
{ {
IsBusy = true;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -16,12 +16,11 @@ namespace Borepin.PageModel.AddServerProcess
#endregion #endregion
#region LoadData #region LoadData
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true;
IsBusy = false; IsBusy = false;
await Task.CompletedTask;
return Task.CompletedTask;
} }
#endregion #endregion
@ -51,8 +50,7 @@ namespace Borepin.PageModel.AddServerProcess
public override void OnNavigatedTo(INavigationParameters parameters) public override void OnNavigatedTo(INavigationParameters parameters)
{ {
IsBusy = true;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -30,12 +30,11 @@ namespace Borepin.PageModel.AddServerProcess
#endregion #endregion
#region LoadData #region LoadData
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true;
IsBusy = false; IsBusy = false;
await Task.CompletedTask;
return Task.CompletedTask;
} }
#endregion #endregion
@ -99,8 +98,7 @@ namespace Borepin.PageModel.AddServerProcess
public override void OnNavigatedTo(INavigationParameters parameters) public override void OnNavigatedTo(INavigationParameters parameters)
{ {
IsBusy = true;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -0,0 +1,57 @@
using Borepin.Model;
using Borepin.ViewModel;
using Prism.Mvvm;
using System.Collections.Generic;
using System.Windows.Input;
using Xamarin.Forms;
namespace Borepin.PageModel
{
public class ListPageModel : BindableBase
{
public ListPageModel()
{
ListItemViewModel_List = new List<ListItemViewModel>()
{
new ListItemViewModel(
new ListItem()
{
Value1 = "ListItem 1"
}),
new ListItemViewModel(
new ListItem()
{
Value1 = "ListItem 2"
}),
new ListItemViewModel(
new ListItem()
{
Value1 = "ListItem 3"
}),
};
SelectListItemCommand = new Command<object>(SelectListItemCommandExecuted);
}
private List<ListItemViewModel> _ListItemViewModel_List;
public List<ListItemViewModel> ListItemViewModel_List
{
get => _ListItemViewModel_List;
set => SetProperty(ref _ListItemViewModel_List, value);
}
private ICommand _SelectListItemCommand;
public ICommand SelectListItemCommand
{
get => _SelectListItemCommand;
set => SetProperty(ref _SelectListItemCommand, value);
}
private void SelectListItemCommandExecuted(object obj)
{
System.Diagnostics.Debugger.Break();
}
}
}

View File

@ -25,11 +25,9 @@ namespace Borepin.PageModel
} }
#endregion #endregion
#region LoadData #region Data
public override async Task LoadData() public override async Task LoadData()
{ {
IsBusy = true;
if (_BFFHService.ActiveConnection == null) if (_BFFHService.ActiveConnection == null)
{ {
IsBusy = false; IsBusy = false;

View File

@ -28,7 +28,7 @@ namespace Borepin.PageModel
} }
#endregion #endregion
#region LoadData #region Data
public override async Task LoadData() public override async Task LoadData()
{ {
IsBusy = true; IsBusy = true;

View File

@ -1,31 +1,20 @@
using Borepin.Base; using Prism.Mvvm;
using Prism.Navigation; using Prism.Navigation;
using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using Xamarin.Forms; using Xamarin.Forms;
namespace Borepin.PageModel namespace Borepin.PageModel
{ {
public class MainPagePageModel : PageModelBase public class MainPagePageModel : BindableBase
{ {
#region Constructors private INavigationService _NavigationService;
public MainPagePageModel(INavigationService navigationService) : base(navigationService)
public MainPagePageModel(INavigationService navigationService)
{ {
_NavigationService = navigationService;
NavigateCommand = new Command<string>(NavigateCommandExecuted); NavigateCommand = new Command<string>(NavigateCommandExecuted);
} }
#endregion
#region LoadData
public override async Task LoadData()
{
IsBusy = true;
IsBusy = false;
await LoadData();
}
#endregion
#region Commands
private ICommand _NavigationCommand; private ICommand _NavigationCommand;
public ICommand NavigateCommand public ICommand NavigateCommand
@ -42,19 +31,5 @@ namespace Borepin.PageModel
System.Diagnostics.Debugger.Break(); System.Diagnostics.Debugger.Break();
} }
} }
#endregion
#region INavigationService
public override void OnNavigatedFrom(INavigationParameters parameters)
{
}
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion
} }
} }

View File

@ -31,11 +31,9 @@ namespace Borepin.PageModel
} }
#endregion #endregion
#region LoadData #region Data
public override async Task LoadData() public override async Task LoadData()
{ {
IsBusy = true;
List<Connection> list = await _ConnectionService.GetConnectionList(); List<Connection> list = await _ConnectionService.GetConnectionList();
if (_BFFHService.ActiveConnection != null) if (_BFFHService.ActiveConnection != null)
{ {

View File

@ -37,13 +37,10 @@ namespace Borepin.PageModel
} }
#endregion #endregion
#region LoadData #region Data
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true; throw new System.NotImplementedException();
IsBusy = false;
await LoadData();
} }
#endregion #endregion
@ -169,8 +166,7 @@ namespace Borepin.PageModel
IsConnected = false; IsConnected = false;
} }
IsBusy = true; IsBusy = false;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -15,13 +15,10 @@ namespace Borepin.PageModel.SetUpProcess
} }
#endregion #endregion
#region LoadData #region Data
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true; return Task.CompletedTask;
IsBusy = false;
await Task.CompletedTask;
} }
#endregion #endregion
@ -50,8 +47,7 @@ namespace Borepin.PageModel.SetUpProcess
public override void OnNavigatedTo(INavigationParameters parameters) public override void OnNavigatedTo(INavigationParameters parameters)
{ {
IsBusy = true;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -15,13 +15,10 @@ namespace Borepin.PageModel.SetUpProcess
} }
#endregion #endregion
#region LoadData #region Data
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true; return Task.CompletedTask;
IsBusy = false;
await Task.CompletedTask;
} }
#endregion #endregion
@ -50,8 +47,7 @@ namespace Borepin.PageModel.SetUpProcess
public override void OnNavigatedTo(INavigationParameters parameters) public override void OnNavigatedTo(INavigationParameters parameters)
{ {
IsBusy = true;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -27,12 +27,9 @@ namespace Borepin.PageModel
#endregion #endregion
#region LoadData #region LoadData
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true; return Task.CompletedTask;
IsBusy = false;
await LoadData();
} }
#endregion #endregion
@ -78,8 +75,7 @@ namespace Borepin.PageModel
public override void OnNavigatedTo(INavigationParameters parameters) public override void OnNavigatedTo(INavigationParameters parameters)
{ {
IsBusy = true;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -0,0 +1,39 @@
using Borepin.Base;
using Prism.Navigation;
using System.Threading.Tasks;
namespace Borepin.PageModel
{
class TestPageModel : PageModelBase
{
#region Contructors
public TestPageModel(INavigationService navigationService) : base(navigationService)
{
}
#endregion
#region Data
public override Task LoadData()
{
Task.Delay(3000);
IsBusy = false;
return Task.CompletedTask;
}
#endregion
#region INavigationService
public override void OnNavigatedFrom(INavigationParameters parameters)
{
}
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.View.IsBusyView">
<ContentView.Content>
<StackLayout>
<Label Text="IsBusy" />
</StackLayout>
</ContentView.Content>
</ContentView>

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.View
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class IsBusyView : ContentView
{
public IsBusyView()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.View.ListItemView"
xmlns:pagemodel="clr-namespace:Borepin.PageModel">
<ContentView.Content>
<StackLayout Orientation="Horizontal" HorizontalOptions="Center">
<Label Text="{Binding Value}" />
<Button Text="X" Command="{Binding Source={RelativeSource AncestorType={x:Type pagemodel:ListPageModel}}, Path=SelectListItemCommand}" CommandParameter="{Binding .}" />
</StackLayout>
</ContentView.Content>
</ContentView>

View File

@ -0,0 +1,15 @@

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.View
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ListItemView : ContentView
{
public ListItemView()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,20 @@
using Borepin.Model;
using Prism.Mvvm;
namespace Borepin.ViewModel
{
public class ListItemViewModel : BindableBase
{
public ListItemViewModel(ListItem listItem)
{
Value = listItem.Value1;
}
private string _Value;
public string Value
{
get => _Value;
set => SetProperty(ref _Value, value);
}
}
}