Skip to content

Commit

Permalink
UI updates + guideme feature
Browse files Browse the repository at this point in the history
UI updates + guideme feature
  • Loading branch information
PramodKumarHK89 committed Aug 26, 2022
1 parent 413f957 commit cb8d22e
Show file tree
Hide file tree
Showing 18 changed files with 379 additions and 273 deletions.
36 changes: 35 additions & 1 deletion IdAceCodeEditor/Models/DataSource.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,46 @@
using System;
using IdAceCodeEditor.Views;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows;
using System.Windows.Input;

namespace IdAceCodeEditor
{
public class DataSource
{
public ObservableCollection<Framework> Frameworks{ get; set; }

private ICommand _guideMeCommand;

public ICommand GuideMeCommand
{
get
{
if (_guideMeCommand == null)
{
_guideMeCommand = new RelayCommand(
param => this.GuideMe(param),
param => this.CanGuideMe()
);
}
return _guideMeCommand;
}
}

private bool CanGuideMe()
{
return true;
// Verify command can be executed here
}

private void GuideMe(object o)
{
GuideMeWindow guideMe = new GuideMeWindow(this);
guideMe.Owner = (Window)o;
guideMe.ShowDialog();

}
}
}
7 changes: 5 additions & 2 deletions IdAceCodeEditor/Models/Framework.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
using System;
using IdAceCodeEditor.Views;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Input;

namespace IdAceCodeEditor
{
public class Framework
{
public string Name { get; set; }
public string DisplayName { get; set; }
public ObservableCollection<Sample> Samples{ get; set; }
public ObservableCollection<Sample> Samples { get; set; }

}
}
2 changes: 2 additions & 0 deletions IdAceCodeEditor/Models/Sample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ private void ConfigureWithAzureAd(object o)
foreach (var item in Projects)
{
AppList objWindow = new AppList(persistData, clonnedPath, item);
objWindow.Owner = (Window)o;
if (objWindow.ShowDialog() == false)
{
isCorrect = false;
Expand Down Expand Up @@ -119,6 +120,7 @@ private void ConfigureManually(object o)
foreach (var item in Projects)
{
ManualAppdetailsCollection objWindow = new ManualAppdetailsCollection(clonnedPath, item);
objWindow.Owner = (Window)o;
if (objWindow.ShowDialog() == false)
{
isCorrect = false;
Expand Down
2 changes: 1 addition & 1 deletion IdAceCodeEditor/Services/ConfigureAzureAdApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ await graphClient.
{

_project.PortalSettings.Certificate.WorkingFolder = _project.AbsoluteProjectPath;
CertificateWindow certificateWindow = new CertificateWindow(_project.PortalSettings.Certificate);
CertificateWindow certificateWindow = new CertificateWindow(_project.PortalSettings.Certificate);
if (certificateWindow.ShowDialog() == true)
{
var keyCredential = new KeyCredential
Expand Down
1 change: 1 addition & 0 deletions IdAceCodeEditor/ViewModels/AppListViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ private async void CreateApp(object o)
{
var window = (AppList)o;
AutomaticAppCreationWindow objWindow = new AutomaticAppCreationWindow(_project);
objWindow.Owner = window;
if (objWindow.ShowDialog() == true)
{
var authResult = await _ConfigureAzureAdApp.AuthenticateWithAzureAd(CREATESCOPES, window);
Expand Down
69 changes: 37 additions & 32 deletions IdAceCodeEditor/Views/AppList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,56 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:IdAceCodeEditor"
mc:Ignorable="d"
Title="AppList" Height="450" Width="800" Loaded="Window_Loaded">
Title="Configure Azure App regsitration" WindowStartupLocation="CenterOwner" Height="650" Width="800" Loaded="Window_Loaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="75"></RowDefinition>
<RowDefinition Height="90"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="75"></RowDefinition>
<RowDefinition Height="100"></RowDefinition>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="6*"></ColumnDefinition>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="180"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Margin="20,20,20,20" Grid.Column="0" Text="{Binding Name}" Grid.ColumnSpan="2">

</TextBlock>
<Button Content="Create" Height="30" Width="170" Grid.Column="2"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type Window}}}" Command="{Binding Path=CreateAppCommand}" Margin="5,22,5,23" />
</Grid>
<StackPanel Grid.Row="1" >
<Button Content="Refresh" Grid.Column="1" HorizontalAlignment="Stretch" Click="Button_Click"/>
<GroupBox Header="Azure Tenant details" Margin="10" Padding="10">
<StackPanel Orientation="Horizontal" FlowDirection="RightToLeft" >
<Button Content="Refresh" Height="25" Width="100"
Click="Button_Click" Margin="0 0 10 0"/>
<TextBlock x:Name="txtTenant" VerticalAlignment="Center" FontWeight="Bold">
</TextBlock>
<TextBlock Text=" to the tenant " VerticalAlignment="Center">
</TextBlock>
<TextBlock x:Name="txtUserName" VerticalAlignment="Center" FontWeight="Bold">
</TextBlock>
<TextBlock VerticalAlignment="Center" Text=" You are signed in as">
</TextBlock>
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="1" Header="Existing app registrations in the tenant" Margin="10" >
<ListView Margin="10" Name="lvUsers" ItemsSource="{Binding Applications,Mode=TwoWay}"
SelectedItem="{Binding SelectedApp, Mode=TwoWay}" GridViewColumnHeader.Click="lvUsers_Click">
<ListView.View>
<GridView>
<GridViewColumn Header="DisplayName" Width="200" DisplayMemberBinding="{Binding DisplayName}" />
<GridViewColumn Header="CreatedDateTime" Width="200" DisplayMemberBinding="{Binding CreatedDateTime}" />
<GridViewColumn Header="Id" Width="auto" DisplayMemberBinding="{Binding Id}" />
<GridViewColumn Header="Application Id" Width="auto" DisplayMemberBinding="{Binding Id}" />
</GridView>
</ListView.View>
</ListView>
</StackPanel>


<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="180"></ColumnDefinition>
<ColumnDefinition Width="180"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Content="Configure" Height="30" Width="170" Grid.Column="1" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type Window}}}" Command="{Binding Path=ConfigureCommand}"/>
<Button Content="Cancel" Height="30" Width="170" Grid.Column="2" Command="{Binding Path=CancelCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor,
</GroupBox>
<GroupBox Grid.Row="2" Header="Configure the application" Margin="10" Padding="10">
<StackPanel Orientation="Horizontal" FlowDirection="RightToLeft" >
<Button Content="Cancel" Height="30" Width="170" Margin="0 0 10 0"
Command="{Binding Path=CancelCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type Window}}}" />
</Grid>
<Button Content="Create new app" Height="30" Width="170" Margin="0 0 10 0"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type Window}}}" Command="{Binding Path=CreateAppCommand}" />
<Button Content="Use existing app" Height="30" Width="170" Margin="0 0 10 0"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type Window}}}" Command="{Binding Path=ConfigureCommand}"/>
<TextBlock VerticalAlignment="Center" Text="{Binding Path=Name}" FontWeight="Bold">
</TextBlock>
<TextBlock VerticalAlignment="Center" Text=" You are configuring the project">
</TextBlock>
</StackPanel>
</GroupBox>
</Grid>
</Window>
3 changes: 3 additions & 0 deletions IdAceCodeEditor/Views/AppList.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ private async void Window_Loaded(object sender, RoutedEventArgs e)
objConfigureApp = new ConfigureAzureAdApp(_persistData, _project);
authResult = await objConfigureApp.AuthenticateWithAzureAd(LISTCOPES, this);

txtUserName.Text = new System.Net.Mail.MailAddress(authResult.Account.Username).User;
txtTenant.Text = new System.Net.Mail.MailAddress(authResult.Account.Username).Host;

objViewModel = new AppListViewModel(_project, objConfigureApp, _persistData);
var listApps = await objConfigureApp.ListAppRegistrations(authResult.AccessToken);

Expand Down
22 changes: 10 additions & 12 deletions IdAceCodeEditor/Views/AutomaticAppCreationWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,26 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:IdAceCodeEditor.Views"
mc:Ignorable="d" Loaded="Window_Loaded"
Title="AutomaticAppCreationWindow" Height="450" Width="800">
Title="AutomaticAppCreationWindow" Height="550" Width="420" WindowStartupLocation="CenterOwner">
<Window.Resources>
<DataTemplate x:Key="sampleContent">
<Grid Margin="100 0 150 10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name}" Grid.Column="0" />
<TextBox Text="{Binding Value}" Grid.Column="1"/>
</Grid>
<StackPanel>
<TextBlock Text="{Binding Name}" />
<TextBox Text="{Binding Value}" Margin="0 0 0 10"/>
</StackPanel>
</DataTemplate>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="75"></RowDefinition>
</Grid.RowDefinitions>
<ItemsControl Grid.Row="0" ItemsSource="{Binding AppListSettings}"
<GroupBox Grid.Row="0" Header="Configuration fields" Margin="10" Padding="10">
<ItemsControl ItemsSource="{Binding AppListSettings}"
ItemTemplate="{StaticResource sampleContent}">
</ItemsControl>
<Grid Grid.Row="1" Margin="0 0 75 0">
</ItemsControl>
</GroupBox>
<Grid Grid.Row="1" Margin="0 0 10 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
Expand Down
68 changes: 22 additions & 46 deletions IdAceCodeEditor/Views/CertificateWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,35 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:IdAceCodeEditor.Views"
mc:Ignorable="d"
Title="CertificateWindow" Height="450" Width="800">
<Window.Resources>
<DataTemplate x:Key="sampleContent">
<Grid Margin="100 0 150 10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="75"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name}" Grid.Column="0" />
<TextBox Text="{Binding Value}" Grid.Column="1"/>
</Grid>
</DataTemplate>
</Window.Resources>
Title="CertificateWindow" Height="350" Width="440" WindowStartupLocation="CenterOwner">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="75"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="75"></RowDefinition>
<RowDefinition Height="90"></RowDefinition>
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Header="Please fill the form to create a new self signed certificate" Margin="10"
Padding="10">
<StackPanel >
<TextBlock Text="Certificate Name" />
<TextBox HorizontalAlignment="Left" Text="{Binding CertName}" Width="250" Margin="0 0 0 10" />

<TextBlock Margin="20" Grid.Row="0" Text="Please fill the form to create a new self signed certificate"></TextBlock>
<TextBlock Text="Issuer" />
<TextBox Text="{Binding Issuer}" HorizontalAlignment="Left" Width="250" Margin="0 0 0 10" />

<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>

<TextBlock Text="Certificate Name" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBox Text="{Binding CertName}" Grid.Column="1" Width="200" Height="30" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBlock Text="Subject" />
<TextBox Text="{Binding Subject}" HorizontalAlignment="Left" Width="250" Margin="0 0 0 10" />
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="1" Header="Update certificate" Margin="10"
Padding="10">
<StackPanel Orientation="Horizontal" FlowDirection="RightToLeft">
<Button Width="100" Margin="0 0 10 0" Click="Cancel_Click">Cancel</Button>

<TextBlock Text="Issuer" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBox Text="{Binding Issuer}" Grid.Row="1" Grid.Column="1" Width="200" Height="30" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<Button Width="130" Margin="0 0 10 0" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type Window}}}" Command="{Binding Path=CreateCertCommand}">Create new certificate</Button>
<Button Width="130" Click="Button_Click">Use existing certificate</Button>

<TextBlock Text="Subject" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="2" Grid.Column="0" />
<TextBox Text="{Binding Subject}" Grid.Row="2" Grid.Column="1" Width="200" Height="30" HorizontalAlignment="Left" VerticalAlignment="Center"/>
</Grid>
<Grid Grid.Row="2" Margin="0 0 0 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="150"></ColumnDefinition>
<ColumnDefinition Width="150"></ColumnDefinition>
<ColumnDefinition Width="90"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Column="1" Height="35" Margin="10" Click="Button_Click">Use existing certificate</Button>
<Button Grid.Column="2" Height="35" Margin="10" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type Window}}}" Command="{Binding Path=CreateCertCommand}">Create new certificate </Button>
<Button Grid.Column="3" Height="35" Margin="10" Click="Cancel_Click">Cancel</Button>
</Grid>
</StackPanel>
</GroupBox>
</Grid>
</Window>
1 change: 1 addition & 0 deletions IdAceCodeEditor/Views/CertificateWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ private void Button_Click(object sender, RoutedEventArgs e)
ExistingCertWindow obExsiting = new ExistingCertWindow(false,
!cert.Type.Equals("PemFile"),
!cert.Type.Equals("PfxFile"));
obExsiting.Owner = this;
if (obExsiting.ShowDialog() == true)
{
cert.CertName = obExsiting.CertFileName;
Expand Down
Loading

0 comments on commit cb8d22e

Please sign in to comment.