mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-04-20 18:36:31 +02:00
Added: Machine List
This commit is contained in:
parent
809d85f6d4
commit
f0bb467e77
@ -7,10 +7,6 @@
|
||||
mc:Ignorable="d"
|
||||
x:Class="Borepin.App">
|
||||
<Application.Resources>
|
||||
<Color x:Key="FirstColor">#FF00D4AA</Color>
|
||||
<Color x:Key="SecondColor">#FF3C474D</Color>
|
||||
<Color x:Key="ThirdColor">#FF333333</Color>
|
||||
<Color x:Key="FourthColor">#FF555555</Color>
|
||||
<Color x:Key="FifthColor">#FFCCCCCC</Color>
|
||||
<ResourceDictionary Source="Styles/LightTheme.xaml" />
|
||||
</Application.Resources>
|
||||
</prism:PrismApplication>
|
@ -28,10 +28,10 @@ namespace Borepin
|
||||
protected override void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
containerRegistry.RegisterForNavigation<NavigationPage>();
|
||||
containerRegistry.RegisterForNavigation<MyTabbedPage>(nameof(TabbedPage));
|
||||
containerRegistry.RegisterForNavigation<MainPage, MainPageViewModel>();
|
||||
containerRegistry.RegisterForNavigation<MachinesPage>();
|
||||
containerRegistry.RegisterForNavigation<MainPage, MainPagePageModel>();
|
||||
containerRegistry.RegisterForNavigation<MachinesPage, MachinesPageModel>();
|
||||
containerRegistry.RegisterForNavigation<SettingsPage>();
|
||||
containerRegistry.RegisterForNavigation<MachinePage, MachinePageModel>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,9 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Page\MachinePage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Page\MachinesPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
|
35
Borepin/Borepin/Model/Machine.cs
Normal file
35
Borepin/Borepin/Model/Machine.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Prism.Mvvm;
|
||||
|
||||
namespace Borepin.Model
|
||||
{
|
||||
public class Machine : BindableBase
|
||||
{
|
||||
private string _ID;
|
||||
public string ID
|
||||
{
|
||||
get => _ID;
|
||||
set => SetProperty(ref _ID, value);
|
||||
}
|
||||
|
||||
private string _State;
|
||||
public string State
|
||||
{
|
||||
get => _State;
|
||||
set => SetProperty(ref _State, value);
|
||||
}
|
||||
|
||||
private string _Description;
|
||||
public string Description
|
||||
{
|
||||
get => _Description;
|
||||
set => SetProperty(ref _Description, value);
|
||||
}
|
||||
|
||||
private string _User;
|
||||
public string User
|
||||
{
|
||||
get => _User;
|
||||
set => SetProperty(ref _User, value);
|
||||
}
|
||||
}
|
||||
}
|
18
Borepin/Borepin/Page/MachinePage.xaml
Normal file
18
Borepin/Borepin/Page/MachinePage.xaml
Normal file
@ -0,0 +1,18 @@
|
||||
<?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.MachinePage">
|
||||
<ContentPage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="Welcome to Xamarin.Forms!"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
<Label Text="MachineID=" TextDecorations="Underline"></Label>
|
||||
<Label Text="{Binding Machine.MachineID}"/>
|
||||
<Label Text="Description=" TextDecorations="Underline"></Label>
|
||||
<Label Text="{Binding Machine.Description}"/>
|
||||
<Label Text="State=" TextDecorations="Underline"></Label>
|
||||
<Label Text="{Binding Machine.State}"/>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
20
Borepin/Borepin/Page/MachinePage.xaml.cs
Normal file
20
Borepin/Borepin/Page/MachinePage.xaml.cs
Normal 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 MachinePage : ContentPage
|
||||
{
|
||||
public MachinePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -5,9 +5,18 @@
|
||||
Title="Machines">
|
||||
<ContentPage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="Machines Page"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
<ListView ItemsSource="{Binding MachineList}">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<Grid>
|
||||
<Label Text="{Binding ID}" FontAttributes="Bold" />
|
||||
<Label Grid.Column="1" Text="{Binding State}" />
|
||||
</Grid>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
35
Borepin/Borepin/PageModel/MachinePageModel.cs
Normal file
35
Borepin/Borepin/PageModel/MachinePageModel.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Borepin.Model;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Navigation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
public class MachinePageModel : BindableBase
|
||||
{
|
||||
private INavigationService _NavigationService;
|
||||
|
||||
public MachinePageModel(string machineID, INavigationService navigationService)
|
||||
{
|
||||
_NavigationService = navigationService;
|
||||
|
||||
Machine = new Machine()
|
||||
{
|
||||
ID = machineID,
|
||||
Description = "This is a Discription",
|
||||
User = "Test User"
|
||||
};
|
||||
}
|
||||
|
||||
private Machine _Machine;
|
||||
public Machine Machine
|
||||
{
|
||||
get => Machine;
|
||||
set => SetProperty(ref _Machine, value);
|
||||
}
|
||||
}
|
||||
}
|
57
Borepin/Borepin/PageModel/MachinesPageModel.cs
Normal file
57
Borepin/Borepin/PageModel/MachinesPageModel.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using Borepin.Model;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Navigation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
public class Employee
|
||||
{
|
||||
public string DisplayName { get; set; }
|
||||
}
|
||||
|
||||
public class MachinesPageModel : BindableBase
|
||||
{
|
||||
private INavigationService _navigationService;
|
||||
|
||||
public MachinesPageModel(INavigationService navigationService)
|
||||
{
|
||||
_navigationService = navigationService;
|
||||
GoToMachineCommand = new Command<string>(GoToMachineCommandExecuted);
|
||||
|
||||
MachineList = new ObservableCollection<Machine>();
|
||||
MachineList.Add(new Machine() { ID = "Machine 1", State = "InUse" });
|
||||
MachineList.Add(new Machine() { ID = "Machine 1", State = "InUse" });
|
||||
MachineList.Add(new Machine() { ID = "Machine 1", State = "InUse" });
|
||||
MachineList.Add(new Machine() { ID = "Machine 1", State = "InUse" });
|
||||
}
|
||||
|
||||
private ICommand _GoToMachineCommand;
|
||||
public ICommand GoToMachineCommand
|
||||
{
|
||||
get => _GoToMachineCommand;
|
||||
set => SetProperty(ref _GoToMachineCommand, value);
|
||||
}
|
||||
|
||||
private async void GoToMachineCommandExecuted(string machineID)
|
||||
{
|
||||
var result = await _navigationService.NavigateAsync($"NavigationPage/MachinePage/MachinePage?machineID={ machineID }");
|
||||
if (!result.Success)
|
||||
{
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<Machine> _MachineList;
|
||||
public ObservableCollection<Machine> MachineList
|
||||
{
|
||||
get => _MachineList;
|
||||
set => SetProperty(ref _MachineList, value);
|
||||
}
|
||||
}
|
||||
}
|
35
Borepin/Borepin/PageModel/MainPagePageModel.cs
Normal file
35
Borepin/Borepin/PageModel/MainPagePageModel.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Prism.Mvvm;
|
||||
using Prism.Navigation;
|
||||
using System.Windows.Input;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
public class MainPagePageModel : BindableBase
|
||||
{
|
||||
private INavigationService _NavigationService;
|
||||
|
||||
public MainPagePageModel(INavigationService navigationService)
|
||||
{
|
||||
_NavigationService = navigationService;
|
||||
NavigateCommand = new Command<string>(NavigateCommandExecuted);
|
||||
}
|
||||
|
||||
private ICommand _NavigationCommand;
|
||||
|
||||
public ICommand NavigateCommand
|
||||
{
|
||||
get => _NavigationCommand;
|
||||
set => SetProperty(ref _NavigationCommand, value);
|
||||
}
|
||||
|
||||
private async void NavigateCommandExecuted(string view)
|
||||
{
|
||||
var result = await _NavigationService.NavigateAsync($"NavigationPage/{view}");
|
||||
if(!result.Success)
|
||||
{
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Navigation;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
public class MainPageViewModel : BindableBase
|
||||
{
|
||||
private INavigationService _navigationService { get; }
|
||||
|
||||
public MainPageViewModel(INavigationService navigationService)
|
||||
{
|
||||
_navigationService = navigationService;
|
||||
NavigateCommand = new DelegateCommand<string>(NavigateCommandExecuted);
|
||||
}
|
||||
|
||||
public DelegateCommand<string> NavigateCommand { get; }
|
||||
|
||||
private async void NavigateCommandExecuted(string view)
|
||||
{
|
||||
var result = await _navigationService.NavigateAsync($"NavigationPage/{view}");
|
||||
if(!result.Success)
|
||||
{
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
public class MyTabbedPage : TabbedPage
|
||||
{
|
||||
public MyTabbedPage()
|
||||
{
|
||||
Title = "Tabbed Page";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user