mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 23:01:52 +01:00
Added StartUpDistributerPage
This commit is contained in:
parent
d780c7c96b
commit
89660160cf
@ -26,7 +26,7 @@ namespace Borepin
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Prism.Navigation.INavigationResult result = await NavigationService.NavigateAsync("/MainPage/NavigationPage/SetUpProcess_WelcomePage");
|
||||
Prism.Navigation.INavigationResult result = await NavigationService.NavigateAsync("/MainPage/NavigationPage/StartUpDistributorPage");
|
||||
if (!result.Success)
|
||||
{
|
||||
System.Diagnostics.Debugger.Break();
|
||||
@ -36,6 +36,8 @@ namespace Borepin
|
||||
protected override void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
// Register Navigation
|
||||
containerRegistry.RegisterForNavigation<StartUpDistributorPage, StartUpDistributorPageModel>();
|
||||
|
||||
containerRegistry.RegisterForNavigation<NavigationPage>();
|
||||
containerRegistry.RegisterForNavigation<MainPage, MainPagePageModel>();
|
||||
containerRegistry.RegisterForNavigation<MachinePage, MachinePageModel>();
|
||||
@ -44,7 +46,6 @@ namespace Borepin
|
||||
containerRegistry.RegisterForNavigation<ServerListPage, ServerListPageModel>();
|
||||
containerRegistry.RegisterForNavigation<ServerPage, ServerPageModel>();
|
||||
containerRegistry.RegisterForNavigation<ListPage, ListPageModel>();
|
||||
containerRegistry.RegisterForNavigation<TestPage, TestPageModel>();
|
||||
|
||||
containerRegistry.RegisterForNavigation<WelcomePage, WelcomePageModel>("SetUpProcess_WelcomePage");
|
||||
containerRegistry.RegisterForNavigation<ScanPage, ScanPageModel>("SetUpProcess_ScanPage");
|
||||
@ -53,6 +54,7 @@ namespace Borepin
|
||||
containerRegistry.RegisterForNavigation<HostSelectPage, HostSelectPageModel>("AddServerProcess_HostSelectPage");
|
||||
containerRegistry.RegisterForNavigation<LoginChoosePage, LoginChoosePageModel>("AddServerProcess_LoginChoosePage");
|
||||
|
||||
//containerRegistry.RegisterForNavigation<TestPage, TestPageModel>();
|
||||
// Register Dialog
|
||||
containerRegistry.RegisterDialog<ConfirmDialog, ConfirmDialogModel>();
|
||||
|
||||
|
@ -7,7 +7,7 @@ namespace Borepin.Model
|
||||
public class MachineVisualize : BindableBase
|
||||
{
|
||||
#region Private Properties
|
||||
public Machine _Machine { get; private set; }
|
||||
public readonly Machine _Machine;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@ -22,8 +22,8 @@ namespace Borepin.Model
|
||||
#region Methods
|
||||
public void LoadData()
|
||||
{
|
||||
ID = _Machine.Id;
|
||||
Space = new SpaceVisualize(_Machine.Space);
|
||||
//ID = _Machine.Id;
|
||||
//Space = new SpaceVisualize(_Machine.Space);
|
||||
Name = _Machine.Name;
|
||||
Description = _Machine.Description;
|
||||
State = _Machine.State;
|
||||
|
@ -6,7 +6,7 @@ namespace Borepin.Model
|
||||
public class SpaceVisualize : BindableBase
|
||||
{
|
||||
#region Private Properties
|
||||
public Space _Space { get; private set; }
|
||||
public readonly Space _Space;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@ -20,7 +20,7 @@ namespace Borepin.Model
|
||||
#region LoadData
|
||||
public void LoadData()
|
||||
{
|
||||
ID = _Space.Id;
|
||||
//ID = _Space.Id;
|
||||
Name = _Space.Name;
|
||||
Info = _Space.Info;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace Borepin.Model
|
||||
public class UserVisualize : BindableBase
|
||||
{
|
||||
#region Private Properties
|
||||
public User _User { get; private set; }
|
||||
public readonly User _User;
|
||||
#endregion
|
||||
|
||||
#region Contructors
|
||||
@ -20,9 +20,9 @@ namespace Borepin.Model
|
||||
#region LoadData
|
||||
public void LoadData()
|
||||
{
|
||||
ID = _User.Id;
|
||||
//ID = _User.Id;
|
||||
Username = _User.Username;
|
||||
Space = new SpaceVisualize(_User.Space);
|
||||
//Space = new SpaceVisualize(_User.Space);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -4,11 +4,12 @@
|
||||
x:Class="Borepin.Page.MachinePage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter">
|
||||
<NavigationPage.TitleView>
|
||||
<Label Text="{Binding Machine.State}" FontAttributes="Bold" HorizontalOptions="End" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" WidthRequest="150" Margin="7.5" VerticalOptions="FillAndExpand" FontSize="Small" BackgroundColor="{StaticResource NinthColor}"/>
|
||||
<Label Text="{Binding MachineItem.State, Converter={StaticResource MachineStateStringConverter}}" FontAttributes="Bold" HorizontalOptions="End" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" WidthRequest="150" Margin="7.5" VerticalOptions="FillAndExpand" FontSize="Small" BackgroundColor="{Binding MachineItem.State, Converter={StaticResource MachineStateColorConverter}}"/>
|
||||
</NavigationPage.TitleView>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:MachineStateColorConverter x:Key="MachineStateColorConverter"/>
|
||||
<converters:MachineStateStringConverter x:Key="MachineStateStringConverter"/>
|
||||
<converters:IsNotNullBoolConverter x:Key="IsNotNullBoolConverter"/>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
</ResourceDictionary>
|
||||
@ -19,7 +20,7 @@
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<Label Text="{Binding Name}" Style="{StaticResource LabelStyle_Title}"/>
|
||||
<Label Text="{Binding MachineItem.Name}" Style="{StaticResource LabelStyle_Title}"/>
|
||||
|
||||
<Button Text="Use" Command="{Binding UseMachineCommand}" IsVisible="{Binding MachineItem.CanUse}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
<Button Text="GiveBack" Command="{Binding GiveBackMachineCommand}" IsVisible="{Binding MachineItem.CanInUse}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
|
@ -1,7 +1,11 @@
|
||||
using Borepin.Base;
|
||||
using Borepin.Model;
|
||||
using Borepin.Service.Connections;
|
||||
using Prism.Commands;
|
||||
using Prism.Navigation;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
@ -15,16 +19,51 @@ namespace Borepin.PageModel
|
||||
public StartUpDistributorPageModel(INavigationService navigationService, IConnectionService connectionService) : base(navigationService)
|
||||
{
|
||||
_ConnectionService = connectionService;
|
||||
|
||||
DistributePageCommand = new DelegateCommand<string>(DistributePageCommandExecuted);
|
||||
|
||||
DistributePageCommand.Execute(null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Data
|
||||
#region LoadData
|
||||
public override Task LoadData()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
private ICommand _DistributePageCommand;
|
||||
|
||||
public ICommand DistributePageCommand
|
||||
{
|
||||
get => _DistributePageCommand;
|
||||
set => SetProperty(ref _DistributePageCommand, value);
|
||||
}
|
||||
|
||||
private async void DistributePageCommandExecuted(string view)
|
||||
{
|
||||
List<Connection> connection_list = await _ConnectionService.GetConnectionList();
|
||||
if (connection_list.Count == 0)
|
||||
{
|
||||
INavigationResult result = await _NavigationService.NavigateAsync("MainPage/NavigationPage/SetUpProcess_WelcomePage");
|
||||
if (!result.Success)
|
||||
{
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
INavigationResult result = await _NavigationService.NavigateAsync("MainPage/NavigationPage/ServerListPage");
|
||||
if (!result.Success)
|
||||
{
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
#endregion
|
||||
|
||||
|
@ -1,28 +1,37 @@
|
||||
using Borepin.Model;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Mvvm;
|
||||
using FabAccessAPI.Schema;
|
||||
|
||||
namespace Borepin.ViewModel
|
||||
{
|
||||
public class ServerListItemViewModel : BindableBase
|
||||
public class MachineListItemViewModel : BindableBase
|
||||
{
|
||||
public ServerListItemViewModel(Connection instance)
|
||||
public MachineListItemViewModel(Machine instance)
|
||||
{
|
||||
_Instance = instance;
|
||||
Address = instance.Address.ToString();
|
||||
|
||||
Name = instance.Name;
|
||||
State = instance.State;
|
||||
}
|
||||
|
||||
private Connection _Instance;
|
||||
public Connection Instance
|
||||
private Machine _Instance;
|
||||
public Machine Instance
|
||||
{
|
||||
get => _Instance;
|
||||
set => SetProperty(ref _Instance, value);
|
||||
}
|
||||
|
||||
private string _Address;
|
||||
public string Address
|
||||
private string _Name;
|
||||
public string Name
|
||||
{
|
||||
get => _Address;
|
||||
set => SetProperty(ref _Address, value);
|
||||
get => _Name;
|
||||
set => SetProperty(ref _Name, value);
|
||||
}
|
||||
|
||||
private Machine.MachineState _State;
|
||||
public Machine.MachineState State
|
||||
{
|
||||
get => _State;
|
||||
set => SetProperty(ref _State, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,37 +1,28 @@
|
||||
using Prism.Mvvm;
|
||||
using FabAccessAPI.Schema;
|
||||
using Borepin.Model;
|
||||
using Prism.Mvvm;
|
||||
|
||||
namespace Borepin.ViewModel
|
||||
{
|
||||
public class MachineListItemViewModel : BindableBase
|
||||
public class ServerListItemViewModel : BindableBase
|
||||
{
|
||||
public MachineListItemViewModel(Machine instance)
|
||||
public ServerListItemViewModel(Connection instance)
|
||||
{
|
||||
_Instance = instance;
|
||||
|
||||
Name = instance.Name;
|
||||
State = instance.State;
|
||||
Address = instance.Address.ToString();
|
||||
}
|
||||
|
||||
private Machine _Instance;
|
||||
public Machine Instance
|
||||
private Connection _Instance;
|
||||
public Connection Instance
|
||||
{
|
||||
get => _Instance;
|
||||
set => SetProperty(ref _Instance, value);
|
||||
}
|
||||
|
||||
private string _Name;
|
||||
public string Name
|
||||
private string _Address;
|
||||
public string Address
|
||||
{
|
||||
get => _Name;
|
||||
set => SetProperty(ref _Name, value);
|
||||
}
|
||||
|
||||
private Machine.MachineState _State;
|
||||
public Machine.MachineState State
|
||||
{
|
||||
get => _State;
|
||||
set => SetProperty(ref _State, value);
|
||||
get => _Address;
|
||||
set => SetProperty(ref _Address, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user