Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,5 +348,6 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/
.idea/
.DS_Store
.idea
2 changes: 1 addition & 1 deletion src/DesktopApps/O2NextGen.Shell/App.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Application x:Class="O2NextGen.Shell.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
>
<Application.Resources>
<ResourceDictionary Source="Themes/Light.xaml"/>
</Application.Resources>
Expand Down
12 changes: 12 additions & 0 deletions src/DesktopApps/O2NextGen.Shell/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using O2NextGen.Shell.ViewModels;

namespace O2NextGen.Shell
{
Expand All @@ -8,5 +9,16 @@ namespace O2NextGen.Shell
// ReSharper disable once RedundantExtendsListEntry
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);

MainWindow window = new MainWindow()
{
DataContext = new CertificateViewModel()
};

window.ShowDialog();
}
}
}
4 changes: 4 additions & 0 deletions src/DesktopApps/O2NextGen.Shell/O2NextGen.Shell.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\O2NextGen.Windows\O2NextGen.Windows.csproj" />
</ItemGroup>

</Project>
55 changes: 55 additions & 0 deletions src/DesktopApps/O2NextGen.Shell/ViewModels/CertificateViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System.ComponentModel.DataAnnotations;
using O2NextGen.Windows;

namespace O2NextGen.Shell.ViewModels
{
public class CertificateViewModel: ViewModel
{
#region Ctors


#endregion


#region Fields

private string _certificateName;

#endregion


#region Props

[Required]
[StringLength(32,MinimumLength = 4)]
public string CertificateName
{
get => _certificateName;
set
{
_certificateName = value;
OnPropertyChanged();
}
}

#endregion


#region Methods

#region Overrides of ViewModel

protected override string OnValidate(string propertyName)
{
if (CertificateName!=null && !CertificateName.Contains(""))
return "The name of the certificate must include at least 2 words";

return base.OnValidate(propertyName);
}

#endregion


#endregion
}
}
6 changes: 4 additions & 2 deletions src/DesktopApps/O2NextGen.Shell/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:O2NextGen.Shell"
xmlns:viewModels="clr-namespace:O2NextGen.Shell.ViewModels"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance viewModels:CertificateViewModel}"
Title="MainWindow" Height="450" Width="800">
<Grid>

<TextBox Margin="30"
Text="{Binding CertificateName, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</Window>
Loading