Skip to content

Commit

Permalink
Merge pull request #233 from trimble-oss/179-Alert-Dialogue
Browse files Browse the repository at this point in the history
179 alert dialogue
  • Loading branch information
Sofiya-kumar authored Sep 6, 2023
2 parents af1ec30 + 63674d7 commit ac33512
Show file tree
Hide file tree
Showing 21 changed files with 1,116 additions and 979 deletions.
3 changes: 3 additions & 0 deletions DemoApp/DemoApp/DemoApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@
</ItemGroup>

<ItemGroup>
<MauiXaml Update="Views\DisplayAlertSamplePage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\ProgressBarSamplePage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
Expand Down
10 changes: 8 additions & 2 deletions DemoApp/DemoApp/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public MainPage()
"CheckBox",
"Chips",
"DataGrid",
"Display Alert",
"Input",
"MultiLineInput",
"NumberInput",
Expand All @@ -30,8 +31,10 @@ public MainPage()
"Spinner",
"Switch",
"TabbedPage",
"Toast"

"Accordion",
"Chips",
"Switch",
"ProgressBar",
};
BindingContext = this;
}
Expand Down Expand Up @@ -101,6 +104,9 @@ private void ItemTapped(object sender, ItemTappedEventArgs e)
case "Switch":
Navigation.PushAsync(new SwitchSamplePage());
break;
case "Display Alert":
Navigation.PushAsync(new DisplayAlertSamplePage());
break;
default:
Console.WriteLine("Default Case");
break;
Expand Down
12 changes: 6 additions & 6 deletions DemoApp/DemoApp/Platforms/Android/Resources/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#0063a3</color>
<color name="colorPrimaryDark">#0063a3</color>
<color name="colorAccent">#0063a3</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#0063a3</color>
<color name="colorPrimaryDark">#0063a3</color>
<color name="colorAccent">#0063a3</color>
</resources>
18 changes: 9 additions & 9 deletions DemoApp/DemoApp/Resources/AppIcon/appicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions DemoApp/DemoApp/Resources/AppIcon/appiconfg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions DemoApp/DemoApp/Resources/Splash/splash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions DemoApp/DemoApp/ViewModels/DisplayAlertSampleViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Trimble.Modus.Components;

namespace DemoApp.ViewModels
{
public partial class DisplayAlertSampleViewModel : ObservableObject
{
[ObservableProperty] string _title;
[ObservableProperty] string _message;
[ObservableProperty] string _primaryButtonText;
[ObservableProperty] string _secondaryButtonText;
public DisplayAlertSampleViewModel()
{
Title = "Alert";
Message = "Do you want to delete?";
PrimaryButtonText = "Okay";
SecondaryButtonText = "";
}

[RelayCommand]
async Task ShowAlert()
{
var confirmationDialog = new AlertDialogue(Title, Message, PrimaryButtonText, SecondaryButtonText);
try
{
var result = await confirmationDialog.Show();
Console.WriteLine(result ? "Primary button tapped" : "Secondary button tapped");
} catch (Exception ex)
{
Console.WriteLine("Invalid result " + ex.Message);
}
}
}
}
20 changes: 20 additions & 0 deletions DemoApp/DemoApp/Views/DisplayAlertSamplePage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:modus="http://modus.trimble.com/components"
x:Class="DemoApp.Views.DisplayAlertSamplePage"
Title="DisplayAlertSamplePage">
<VerticalStackLayout Spacing="10" Padding="10">
<modus:TMButton Title="Show Display Alert"
Command="{Binding ShowAlertCommand}"
HorizontalOptions="Center" />
<modus:TMInput Placeholder="Title"
Text="{Binding Title}" />
<modus:TMInput Placeholder="Message"
Text="{Binding Message}" />
<modus:TMInput Placeholder="Primary text"
Text="{Binding PrimaryButtonText}" />
<modus:TMInput Placeholder="Secondary text"
Text="{Binding SecondaryButtonText}" />
</VerticalStackLayout>
</ContentPage>
13 changes: 13 additions & 0 deletions DemoApp/DemoApp/Views/DisplayAlertSamplePage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using DemoApp.ViewModels;

namespace DemoApp.Views;

public partial class DisplayAlertSamplePage : ContentPage
{
DisplayAlertSampleViewModel _viewModel = new DisplayAlertSampleViewModel();
public DisplayAlertSamplePage()
{
InitializeComponent();
BindingContext = _viewModel;
}
}
184 changes: 92 additions & 92 deletions DemoApp/DemoApp/Views/ListViewSamplePage.xaml
Original file line number Diff line number Diff line change
@@ -1,92 +1,92 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="DemoApp.Views.ListViewSamplePage"
xmlns:local ="clr-namespace:DemoApp.Views"
xmlns:constants="clr-namespace:DemoApp.Constant"
xmlns:modus="http://modus.trimble.com/components"
Title="ListViewSamplePage">
<ContentPage.Resources>
<DataTemplate x:Name="TextCell" x:Key="textCellKey">
<modus:TextCell
Title="{Binding Name}"
Description="{Binding Address}"
LeftIconSource="{Binding ProfilePic}"
RightIconSource="{Binding ProfilePic}">
</modus:TextCell>
</DataTemplate>
<DataTemplate x:Name="ViewCell" x:Key="viewCellKey">
<modus:TemplateCell>
<modus:TemplateCell.Content>
<Grid RowSpacing="10" Padding="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<Border HeightRequest="80"
WidthRequest="80"
VerticalOptions="Center"
Stroke="{Binding Color}"
StrokeShape="RoundRectangle 40"
StrokeThickness="8"
Grid.RowSpan="3"
Margin="0,0,0,0">
<Image Source="{Binding ProfilePic}"
Margin="10,0,10,0"
VerticalOptions="Center" HorizontalOptions="Center" HeightRequest="80" WidthRequest="80"/>

</Border>

<Label Text="{Binding Name}" Grid.Row="0" Grid.Column="1" FontSize="Medium"/>
<Label Text="{Binding DateofBirth, StringFormat='DateofBirth: {0:dd/MM/yyyy}'}" Grid.Row="1" Grid.Column="1" FontSize="Small"/>
<Label Text="{Binding Address}" Grid.Row="2" Grid.Column="1" FontSize="Micro"/>
<StackLayout Grid.Column="2" Grid.Row="1" HorizontalOptions="Center" Orientation="Horizontal" Spacing="5" VerticalOptions="Center" >
<ImageButton Source="{x:Static constants:ImageConstants.Email}" HeightRequest="20" WidthRequest="20" Command="{Binding EmailClickedCommand}"/>
<ImageButton Source="{x:Static constants:ImageConstants.Phone}" HeightRequest="20" WidthRequest="20" Command="{Binding PhoneClickedCommand}"/>
</StackLayout>

</Grid>
</modus:TemplateCell.Content>
</modus:TemplateCell>
</DataTemplate>

</ContentPage.Resources>
<StackLayout Orientation="Vertical">
<Label Text="Select View Type" FontSize="Medium" Padding="10"></Label>
<modus:TMRadioButtonGroup x:Name="CellGroup"
Padding="10"
SelectedIndex="0"
HorizontalOptions="Center"
SelectedRadioButtonChanged="OnCellGroupButtonChanged"
Orientation="Horizontal">
<modus:TMRadioButton Text="Text Cell" />
<modus:TMRadioButton Text="Template Cell" />
</modus:TMRadioButtonGroup>
<Label Text="Selection Mode" FontSize="Medium" Padding="10"></Label>
<modus:TMRadioButtonGroup x:Name="SelectionGroup"
Padding="10"
SelectedIndex="0"
HorizontalOptions="Center"
SelectedRadioButtonChangedCommand="{Binding SelectionGroupCommand}"
Orientation="Horizontal">
<modus:TMRadioButton Text="Single" />
<modus:TMRadioButton Text="Multiple" />
<modus:TMRadioButton Text="None" />
</modus:TMRadioButtonGroup>
<modus:TMListView x:Name="textCellList"
IsVisible="True"
SelectionMode="{Binding SelectionMode}"
SelectionChangedCommand="{Binding ItemSelectedCommand}"
ItemsSource="{Binding ItemSource}">
</modus:TMListView>

</StackLayout>
</ContentPage>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="DemoApp.Views.ListViewSamplePage"
xmlns:local ="clr-namespace:DemoApp.Views"
xmlns:constants="clr-namespace:DemoApp.Constant"
xmlns:modus="http://modus.trimble.com/components"
Title="ListViewSamplePage">
<ContentPage.Resources>
<DataTemplate x:Name="TextCell" x:Key="textCellKey">
<modus:TextCell
Title="{Binding Name}"
Description="{Binding Address}"
LeftIconSource="{Binding ProfilePic}"
RightIconSource="{Binding ProfilePic}">
</modus:TextCell>
</DataTemplate>
<DataTemplate x:Name="ViewCell" x:Key="viewCellKey">
<modus:TemplateCell>
<modus:TemplateCell.Content>
<Grid RowSpacing="10" Padding="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<Border HeightRequest="80"
WidthRequest="80"
VerticalOptions="Center"
Stroke="{Binding Color}"
StrokeShape="RoundRectangle 40"
StrokeThickness="8"
Grid.RowSpan="3"
Margin="0,0,0,0">
<Image Source="{Binding ProfilePic}"
Margin="10,0,10,0"
VerticalOptions="Center" HorizontalOptions="Center" HeightRequest="80" WidthRequest="80"/>

</Border>

<Label Text="{Binding Name}" Grid.Row="0" Grid.Column="1" FontSize="Medium"/>
<Label Text="{Binding DateofBirth, StringFormat='DateofBirth: {0:dd/MM/yyyy}'}" Grid.Row="1" Grid.Column="1" FontSize="Small"/>
<Label Text="{Binding Address}" Grid.Row="2" Grid.Column="1" FontSize="Micro"/>
<StackLayout Grid.Column="2" Grid.Row="1" HorizontalOptions="Center" Orientation="Horizontal" Spacing="5" VerticalOptions="Center" >
<ImageButton Source="{x:Static constants:ImageConstants.Email}" HeightRequest="20" WidthRequest="20" Command="{Binding EmailClickedCommand}"/>
<ImageButton Source="{x:Static constants:ImageConstants.Phone}" HeightRequest="20" WidthRequest="20" Command="{Binding PhoneClickedCommand}"/>
</StackLayout>

</Grid>
</modus:TemplateCell.Content>
</modus:TemplateCell>
</DataTemplate>

</ContentPage.Resources>
<StackLayout Orientation="Vertical">
<Label Text="Select View Type" FontSize="Medium" Padding="10"></Label>
<modus:TMRadioButtonGroup x:Name="CellGroup"
Padding="10"
SelectedIndex="0"
HorizontalOptions="Center"
SelectedRadioButtonChanged="OnCellGroupButtonChanged"
Orientation="Horizontal">
<modus:TMRadioButton Text="Text Cell" />
<modus:TMRadioButton Text="Template Cell" />
</modus:TMRadioButtonGroup>
<Label Text="Selection Mode" FontSize="Medium" Padding="10"></Label>
<modus:TMRadioButtonGroup x:Name="SelectionGroup"
Padding="10"
SelectedIndex="0"
HorizontalOptions="Center"
SelectedRadioButtonChangedCommand="{Binding SelectionGroupCommand}"
Orientation="Horizontal">
<modus:TMRadioButton Text="Single" />
<modus:TMRadioButton Text="Multiple" />
<modus:TMRadioButton Text="None" />
</modus:TMRadioButtonGroup>
<modus:TMListView x:Name="textCellList"
IsVisible="True"
SelectionMode="{Binding SelectionMode}"
SelectionChangedCommand="{Binding ItemSelectedCommand}"
ItemsSource="{Binding ItemSource}">
</modus:TMListView>

</StackLayout>
</ContentPage>
Loading

0 comments on commit ac33512

Please sign in to comment.