First pass at modal dialog
This commit is contained in:
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
namespace Aurora.Design.Views.Party.NewPartyDialog
|
||||
{
|
||||
public enum ConnectionType
|
||||
{
|
||||
Host,
|
||||
Join
|
||||
}
|
||||
|
||||
public class ConnectionDetails : DialogReturnType
|
||||
{
|
||||
public ConnectionDetails()
|
||||
{
|
||||
}
|
||||
|
||||
public string HostName { get; set; }
|
||||
public ConnectionType ConnectionType { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
#Container {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
Button {
|
||||
background-color: red;
|
||||
}
|
38
Aurora/Design/Views/Party/NewPartyDialog/NewPartyDialog.xaml
Normal file
38
Aurora/Design/Views/Party/NewPartyDialog/NewPartyDialog.xaml
Normal file
@ -0,0 +1,38 @@
|
||||
<?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="Aurora.Design.Views.Party.NewPartyDialog.NewPartyDialog">
|
||||
<ContentView.Resources>
|
||||
<StyleSheet
|
||||
Source="NewPartyDialog.css"/>
|
||||
</ContentView.Resources>
|
||||
<ContentView.Content>
|
||||
<StackLayout
|
||||
x:Name="Container"
|
||||
BackgroundColor="blue"
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="Start">
|
||||
<Label
|
||||
Text="Hostname"
|
||||
VerticalOptions="Center"/>
|
||||
<Entry
|
||||
Text="{Binding Hostname}"
|
||||
x:Name="HostnameEntry"/>
|
||||
<StackLayout
|
||||
Orientation="Horizontal"
|
||||
HorizontalOptions="Center">
|
||||
<Button
|
||||
HorizontalOptions="Center"
|
||||
x:Name="buttonHost"
|
||||
Text="Host"
|
||||
Command="{Binding HostCommand}"/>
|
||||
<Button
|
||||
HorizontalOptions="Center"
|
||||
x:Name="buttonClient"
|
||||
Text="Join"
|
||||
Command="{Binding JoinCommand}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Aurora.Design.Views.Party.NewPartyDialog
|
||||
{
|
||||
public partial class NewPartyDialog : ContentView
|
||||
{
|
||||
public NewPartyDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Aurora.Design.Views.Party.NewPartyDialog
|
||||
{
|
||||
public class NewPartyDialogViewModel : BaseDialogViewModel
|
||||
{
|
||||
public NewPartyDialogViewModel()
|
||||
{
|
||||
this.ReturnObject = new ConnectionDetails();
|
||||
HostCommand = new Command(OnHostExecute, OnHostCanExecute);
|
||||
JoinCommand = new Command(OnJoinExecute, OnJoinCanCanExecute);
|
||||
}
|
||||
|
||||
public string Hostname
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ReturnObject is ConnectionDetails)
|
||||
{
|
||||
ConnectionDetails obj = ReturnObject as ConnectionDetails;
|
||||
return obj.HostName;
|
||||
};
|
||||
return string.Empty;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (ReturnObject is ConnectionDetails)
|
||||
{
|
||||
ConnectionDetails obj = ReturnObject as ConnectionDetails;
|
||||
if (value != obj.HostName)
|
||||
{
|
||||
obj.HostName = value;
|
||||
}
|
||||
|
||||
OnPropertyChanged(Hostname);
|
||||
HostCommand.ChangeCanExecute();
|
||||
JoinCommand.ChangeCanExecute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void OnHostExecute()
|
||||
{
|
||||
ConnectionDetails obj = base.ReturnObject as ConnectionDetails;
|
||||
obj.ConnectionType = ConnectionType.Host;
|
||||
Finish();
|
||||
}
|
||||
|
||||
public Command HostCommand { get; private set; }
|
||||
public Command JoinCommand { get; private set; }
|
||||
|
||||
public bool OnHostCanExecute()
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(Hostname);
|
||||
}
|
||||
|
||||
public void OnJoinExecute()
|
||||
{
|
||||
ConnectionDetails obj = base.ReturnObject as ConnectionDetails;
|
||||
obj.ConnectionType = ConnectionType.Join;
|
||||
Finish();
|
||||
}
|
||||
|
||||
public bool OnJoinCanCanExecute()
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(Hostname);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user