Skip to content

Commit

Permalink
UI Modification and guide me window
Browse files Browse the repository at this point in the history
  • Loading branch information
PramodKumarHK89 committed Sep 15, 2022
1 parent cb8d22e commit 1444e12
Show file tree
Hide file tree
Showing 11 changed files with 1,996 additions and 931 deletions.
2 changes: 1 addition & 1 deletion IdAceCodeEditor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32228.430
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IdAceCodeEditor", "IdAceCodeEditor\IdAceCodeEditor.csproj", "{43C2BF53-26B0-4DF8-ADD3-C42F31DE4044}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IDAceCodeEditor", "IdAceCodeEditor\IDAceCodeEditor.csproj", "{43C2BF53-26B0-4DF8-ADD3-C42F31DE4044}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2,689 changes: 1,793 additions & 896 deletions IdAceCodeEditor/Config/appsettings.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions IdAceCodeEditor/IdAceCodeEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<BaseOutputPath>bin</BaseOutputPath>
<ApplicationIcon>getsitelogo.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
Expand All @@ -13,6 +14,10 @@
<None Remove="bin\**" />
<Page Remove="bin\**" />
</ItemGroup>

<ItemGroup>
<Content Include="getsitelogo.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="LibGit2Sharp" Version="0.26.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
Expand Down
24 changes: 22 additions & 2 deletions IdAceCodeEditor/Models/DataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,35 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Text;
using System.Windows;
using System.Windows.Input;

namespace IdAceCodeEditor
{
public class DataSource
public class DataSource : INotifyPropertyChanged
{
public ObservableCollection<Framework> Frameworks{ get; set; }
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
public ObservableCollection<Framework> Frameworks{ get; set; }

Framework _SelectedFramework;
public Framework SelectedFramework
{
get { return _SelectedFramework; }
set
{
_SelectedFramework = value;
// Call OnPropertyChanged whenever the property is updated
OnPropertyChanged();
}
}
public ObservableCollection<Sample> Samples { get; set; }

private ICommand _guideMeCommand;

Expand Down
1 change: 1 addition & 0 deletions IdAceCodeEditor/Models/Framework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class Framework
{
public string Name { get; set; }
public string DisplayName { get; set; }
public string Type { get; set; }
public ObservableCollection<Sample> Samples { get; set; }

}
Expand Down
22 changes: 20 additions & 2 deletions IdAceCodeEditor/Models/Sample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,36 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Text;
using System.Windows;
using System.Windows.Input;

namespace IdAceCodeEditor
{
public class Sample
public class Sample : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
bool _IsSelected;
public bool IsSelected
{
get { return _IsSelected; }
set
{
_IsSelected = value;
// Call OnPropertyChanged whenever the property is updated
OnPropertyChanged();
}
}
public string Name { get; set; }
public string DisplayName { get; set; }
public string Type { get; set; }

public string PlatformType { get; set; }
public string WorkingFolder { get; set; }
public GitHubRepo GitHubRepoSettings{ get; set; }
public ObservableCollection<Project> Projects { get; set; }
Expand Down
78 changes: 52 additions & 26 deletions IdAceCodeEditor/Views/GuideMeWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,71 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:IdAceCodeEditor.Views"
mc:Ignorable="d"
Title="GuideMeWindow" Height="650" Width="420" WindowStartupLocation="CenterOwner">
Title="GuideMeWindow" Height="655" Width="700" Closing="Window_Closing" WindowStartupLocation="CenterOwner">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"></RowDefinition>
<RowDefinition Height="110" ></RowDefinition>
<RowDefinition Height="150" ></RowDefinition>
<RowDefinition Height="130" ></RowDefinition>
<RowDefinition Height="105"></RowDefinition>
<RowDefinition Height="105" ></RowDefinition>
<RowDefinition Height="130" ></RowDefinition>
<RowDefinition Height="185" ></RowDefinition>
<RowDefinition Height="95" ></RowDefinition>
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Header="Platform" Margin="10" Padding="10">
<StackPanel>
<TextBlock>Select the aplication platform</TextBlock>
<ComboBox ></ComboBox>
</StackPanel>
<GroupBox Name="Type" Grid.Row="0" Header="Step 1 - Choose your application type" Margin="5"
Padding="5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*" ></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<RadioButton Tag="Web" GroupName="Type" Checked="RadioButton_Checked" Margin="0 0 0 10">Web Application</RadioButton>
<RadioButton Tag="Spa" GroupName="Type" Checked="RadioButton_Checked" >SPA - Single page application</RadioButton>
</StackPanel>
<StackPanel Grid.Column="1">
<RadioButton Tag="PublicClient" Checked="RadioButton_Checked" GroupName="Type" Margin="0 0 0 10">Public Client - Mobile/Desktop</RadioButton>
<RadioButton Tag="Daemon" Checked="RadioButton_Checked" GroupName="Type">Daemon - No user involved</RadioButton>
</StackPanel>
</Grid>
</GroupBox>
<GroupBox Grid.Row="1" Header="Application Type" Margin="10" Padding="10">
<GroupBox Grid.Row="1" Header="Step 2 - Choose your framework" Margin="5" Padding="5">
<StackPanel>
<RadioButton Margin="0 0 0 10">If the application interactive and user is involved, then please select this option </RadioButton>
<RadioButton>If the application daemon and operates without UI, then please select this option</RadioButton>
<TextBlock>Select your aplication framework</TextBlock>
<ComboBox Name="cmbFramework" ItemsSource="{Binding Frameworks}" DisplayMemberPath="Name"
SelectionChanged="cmbFramework_SelectionChanged" SelectedItem="{Binding Path=SelectedFramework}" ></ComboBox>
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="2" Header="Scenario" Margin="10" Padding="10">
<StackPanel>
<RadioButton Margin="0 0 0 10">Application implements sign-in feature to the users</RadioButton>
<RadioButton Margin="0 0 0 10">Application implements sign-in feature to the users and then calls graph resources</RadioButton>
<RadioButton>Application implements sign-in feature to the users and then calls custom API</RadioButton>
</StackPanel>
<GroupBox Grid.Row="2" Header="Step 3 - Choose your scenario" Margin="5" Padding="5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*" ></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<CheckBox Margin="0 0 0 10">User should Sign In to app</CheckBox>
<CheckBox Margin="0 0 0 10">App Calls Graph Api</CheckBox>
<CheckBox Margin="0 0 0 10">App calls custom Api</CheckBox>
</StackPanel>
<StackPanel Grid.Column="1">
<CheckBox Margin="0 0 0 10" Checked="CheckBox_Checked" >Usage of certificate over secret</CheckBox>
<CheckBox Margin="0 0 0 10">Integration with Azure KeyVault</CheckBox>
<CheckBox Margin="0 0 0 10">CAE enabled client</CheckBox>
</StackPanel>
</Grid>
</GroupBox>
<GroupBox Grid.Row="3" Header="Add in features" Margin="10" Padding="10">
<GroupBox Grid.Row="3" Header="Step 4 - Choose your sample" Margin="5" Padding="5">
<StackPanel>
<CheckBox Margin="0 0 0 10">Usage of certificate</CheckBox>
<CheckBox Margin="0 0 0 10">Store Certificate in Azure KeyVault</CheckBox>
<CheckBox Margin="0 0 0 10">CAE</CheckBox>
<StackPanel>
<TextBlock TextWrapping="Wrap">Based on your creteria, below samples are most relavent in the order of sequence. Select one and click submit button</TextBlock>
<ListBox Height="120" Name="lstScenario"
ItemsSource="{Binding Samples}" DisplayMemberPath="Name"
SelectedItem="{Binding IsSelected, Mode=TwoWay}"></ListBox>
</StackPanel>
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="4" Header="Search" Margin="10" Padding="10">
<GroupBox Grid.Row="4" Header="Search" Margin="5" Padding="5">
<StackPanel>
<Button Margin="0 0 0 10">Submit</Button>
<Button Margin="0 0 0 10">Cancel</Button>
<Button Margin="0 0 0 10" Click="Submit_Click">Submit</Button>
<Button Margin="0 0 0 10" Click="Cancel_Click">Cancel</Button>
</StackPanel>
</GroupBox>
</Grid>
Expand Down
97 changes: 97 additions & 0 deletions IdAceCodeEditor/Views/GuideMeWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
Expand All @@ -9,6 +11,7 @@
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Windows.Devices.Lights;

namespace IdAceCodeEditor.Views
{
Expand All @@ -20,6 +23,100 @@ public partial class GuideMeWindow : Window
public GuideMeWindow(DataSource framework)
{
InitializeComponent();
ObservableCollection<Sample> allSamples = new ObservableCollection<Sample>();
foreach (var frame in framework.Frameworks)
{
foreach (var samp in frame.Samples)
{
allSamples.Add(samp);
}
}
framework.Samples = allSamples;
this.DataContext = framework;
}

private void RadioButton_Checked(object sender, RoutedEventArgs e)
{
var radioButton = sender as RadioButton;
var framworks = cmbFramework.ItemsSource;

CollectionView itemsViewOriginal = (CollectionView)CollectionViewSource.GetDefaultView(cmbFramework.Items);
itemsViewOriginal.Filter = ((o) =>
{
return ((Framework)o).Type.Equals(radioButton.Tag);
});
itemsViewOriginal.Refresh();

CollectionView itemsViewOriginal2 = (CollectionView)CollectionViewSource.GetDefaultView(lstScenario.Items);
itemsViewOriginal2.Filter = ((o) =>
{
return ((Sample)o).PlatformType.Equals(radioButton.Tag);
});
itemsViewOriginal2.Refresh();
}

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
CollectionView itemsViewOriginal = (CollectionView)CollectionViewSource.GetDefaultView(cmbFramework.Items);
itemsViewOriginal.Filter = ((o) =>
{
return true;
});
itemsViewOriginal.Refresh();
}
private void cmbFramework_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var comboBox = sender as ComboBox;
Framework framework= comboBox.SelectedItem as Framework;

if (framework != null && comboBox!=null)
{
CollectionView itemsViewOriginal2 = (CollectionView)CollectionViewSource.GetDefaultView(lstScenario.Items);
itemsViewOriginal2.Filter = ((o) =>
{
return ((Sample)o).Type.Contains(framework.Name) ||
framework.Name.Contains(((Sample)o).Type);
});
itemsViewOriginal2.Refresh();
}
}

private void Submit_Click(object sender, RoutedEventArgs e)
{
Framework framework= cmbFramework.SelectedItem as Framework;
Sample sample = lstScenario.SelectedItem as Sample;

if (sample != null && framework.Samples != null)
{
foreach (var item in framework.Samples)
{
if (item.Name.Equals(sample.Name))
item.IsSelected = true;
}
}
this.Close();
}

private void Cancel_Click(object sender, RoutedEventArgs e)
{
this.Close();
}

private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
Framework framework = cmbFramework.SelectedItem as Framework;

if (framework != null )
{
CollectionView itemsViewOriginal2 = (CollectionView)CollectionViewSource.GetDefaultView(
lstScenario.Items);
itemsViewOriginal2.Filter = ((o) =>
{
return ((Sample)o).Tags.Any(o=> o.Name.Equals("WithCertificate"));
});
itemsViewOriginal2.Refresh();
}
}
}
}

9 changes: 5 additions & 4 deletions IdAceCodeEditor/Views/IdAceCodeEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:local="clr-namespace:IdAceCodeEditor"
mc:Ignorable="d"
Loaded="Window_Loaded"
Title="IdAceCodeEditor" Height="500" Width="800">
Title="IDAceCodeEditor" Height="500" Width="800">
<Window.Resources>
<Style TargetType="TabItem">
<Setter Property="Template">
Expand Down Expand Up @@ -62,7 +62,7 @@
</Setter>
</Style>
<DataTemplate x:Key="tagContent">
<Border BorderBrush="Black" Background="Bisque" Margin="5" BorderThickness="1">
<Border BorderBrush="Black" Background="Cornsilk" Margin="5" Padding="3" BorderThickness="1">
<TextBlock Text="{Binding Name}" FontSize="10"
HorizontalAlignment="Center"
VerticalAlignment="Center">
Expand All @@ -71,7 +71,7 @@
</DataTemplate>
<DataTemplate x:Key="sampleContent">
<Expander HorizontalAlignment="Left" Header="{Binding Name}" Background="AliceBlue"
ExpandDirection="Down" IsExpanded="False"
ExpandDirection="Down" IsExpanded="{Binding IsSelected}"
Width="{Binding ActualWidth, ElementName=gridName}"
FontSize="20" >
<Grid>
Expand Down Expand Up @@ -163,7 +163,8 @@
<GroupBox Grid.Row="1" Header="List of samples available across multiple platforms"
Margin="10" Padding="10">

<TabControl Name="tab" ItemTemplate="{StaticResource tabItemTemplate}"
<TabControl Name="tab" ItemTemplate="{StaticResource tabItemTemplate}"
SelectedItem="{Binding Path=SelectedFramework}"
ContentTemplate="{StaticResource contentTemplate}"
ItemsSource="{Binding Frameworks}" >
</TabControl>
Expand Down
Binary file added IdAceCodeEditor/getsitelogo.ico
Binary file not shown.
Binary file added IdAceCodeEditor/getsitelogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1444e12

Please sign in to comment.