diff --git a/.github/workflows/gitleaks.yaml b/.github/workflows/gitleaks.yaml new file mode 100644 index 0000000..d9a8e36 --- /dev/null +++ b/.github/workflows/gitleaks.yaml @@ -0,0 +1,38 @@ +name: Secret Value found! +on: + push: + public: +jobs: + scan: + name: gitleaks + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install the gitleaks + run: wget https://github.com/zricethezav/gitleaks/releases/download/v8.15.2/gitleaks_8.15.2_linux_x64.tar.gz + shell: pwsh + - name: Extract the tar file + run: tar xzvf gitleaks_8.15.2_linux_x64.tar.gz + - name: Generate the report + id: gitleaks + run: $GITHUB_WORKSPACE/gitleaks detect -s $GITHUB_WORKSPACE -f json -r $GITHUB_WORKSPACE/leaksreport.json + shell: bash + continue-on-error: true + - name: Setup NuGet.exe + if: steps.gitleaks.outcome != 'success' + uses: nuget/setup-nuget@v1 + with: + nuget-version: latest + - name: Install the dotnet + if: steps.gitleaks.outcome != 'success' + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '3.1.x' + - name: Install the report tool packages + if: steps.gitleaks.outcome != 'success' + run: | + nuget install "Syncfusion.Email" -source "https://nexus.syncfusion.com/repository/nuget-hosted/" + dir $GITHUB_WORKSPACE/Syncfusion.Email.1.0.0/lib/netcoreapp3.1 + dotnet $GITHUB_WORKSPACE/Syncfusion.Email.1.0.0/lib/netcoreapp3.1/Email.dll "citeam@syncfusion.com" "$GITHUB_REF_NAME" ${{ secrets.NETWORKCREDENTIALS }} ${{ secrets.NETWORKKEY }} "$GITHUB_WORKSPACE" + exit 1 \ No newline at end of file diff --git a/MultiselectComboBox/MultiselectComboBox/MainWindow.xaml b/MultiselectComboBox/MultiselectComboBox/MainWindow.xaml index 49984bb..f288580 100644 --- a/MultiselectComboBox/MultiselectComboBox/MainWindow.xaml +++ b/MultiselectComboBox/MultiselectComboBox/MainWindow.xaml @@ -6,6 +6,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:editors="using:Syncfusion.UI.Xaml.Editors" + xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" + xmlns:Interactions="using:Microsoft.Xaml.Interactions.Core" mc:Ignorable="d"> @@ -18,10 +20,14 @@ SelectionMode="Multiple" MultiSelectionDisplayMode="Token" PlaceholderText="Try anne" - InputSubmitted="OnInputSubmitted" HorizontalAlignment="Center" VerticalAlignment="Center" Width="500"> + + + + + @@ -39,37 +45,4 @@ - diff --git a/MultiselectComboBox/MultiselectComboBox/MainWindow.xaml.cs b/MultiselectComboBox/MultiselectComboBox/MainWindow.xaml.cs index 5de87c1..0e22eb8 100644 --- a/MultiselectComboBox/MultiselectComboBox/MainWindow.xaml.cs +++ b/MultiselectComboBox/MultiselectComboBox/MainWindow.xaml.cs @@ -5,7 +5,6 @@ using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Navigation; -using Syncfusion.UI.Xaml.Editors; using System; using System.Collections.Generic; using System.IO; @@ -30,43 +29,5 @@ public MainWindow() { this.InitializeComponent(); } - - private async void OnInputSubmitted(object sender, ComboBoxInputSubmittedEventArgs e) - { - var emailString = e.Text; - bool isEmail = Regex.IsMatch(emailString, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase); - - // If given input is a valid email format - if (isEmail) - { - // Create new person for selection - Person newPerson = new Person(); - newPerson.EmailID = emailString; - int atIndex = emailString.LastIndexOf('@'); - int dotIndex = emailString.IndexOf('.'); - string name = emailString.Substring(0, atIndex); - if (name.Contains('.')) - { - newPerson.FirstName = name.Substring(0, dotIndex); - newPerson.LastName = name.Substring(dotIndex + 1); - } - else - { - newPerson.FirstName = name; - } - e.Item = newPerson; - } - - // If email is id invalid, show error dialog. - else - { - var dialog = new ContentDialog(); - dialog.CloseButtonText = "Close"; - dialog.Content = "Invalid email id!"; - dialog.Title = "Error"; - dialog.XamlRoot = this.Content.XamlRoot; - await dialog.ShowAsync(); - } - } } } diff --git a/MultiselectComboBox/MultiselectComboBox/MultiselectComboBox.csproj b/MultiselectComboBox/MultiselectComboBox/MultiselectComboBox.csproj index 745e4cb..13376b4 100644 --- a/MultiselectComboBox/MultiselectComboBox/MultiselectComboBox.csproj +++ b/MultiselectComboBox/MultiselectComboBox/MultiselectComboBox.csproj @@ -25,6 +25,7 @@ + @@ -33,6 +34,6 @@ Tools extension to be activated for this project even if the Windows App SDK Nuget package has not yet been restored --> - + diff --git a/MultiselectComboBox/MultiselectComboBox/ViewModel.cs b/MultiselectComboBox/MultiselectComboBox/ViewModel.cs index 08e8eb6..21acce4 100644 --- a/MultiselectComboBox/MultiselectComboBox/ViewModel.cs +++ b/MultiselectComboBox/MultiselectComboBox/ViewModel.cs @@ -1,4 +1,6 @@ -using Syncfusion.UI.Xaml.Core; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Syncfusion.UI.Xaml.Core; using Syncfusion.UI.Xaml.Editors; using System; using System.Collections; @@ -7,7 +9,9 @@ using System.Diagnostics; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; +using System.Windows.Input; namespace MultiselectComboBox { @@ -26,6 +30,14 @@ public ViewModel() Persons.Add(createNewPerson("Nancy", "Davolio", "nancy.davolio@mail.com")); Persons.Add(createNewPerson("Robert", "King", "robert.king@mail.com")); Persons.Add(createNewPerson("Steven", "Buchanan", "steven.buchanan@mail.com")); + + InputSubmitted = new DelegateCommand(OnInputSubmitted, CanExe); + + } + + private bool CanExe(object obj) + { + return true; } private ObservableCollection persons; @@ -43,6 +55,8 @@ public ObservableCollection Persons } } + public ICommand InputSubmitted { get; set; } + private Person createNewPerson(string firstName, string lastName, string eMail) { return new Person @@ -69,7 +83,6 @@ public List GetMatchingIndexes(SfComboBox source, ComboBoxFilterInfo filter return indices; } - public List GetMatchingIndexes2(SfComboBox source, ComboBoxFilterInfo filterInfo) { var items = Persons; @@ -95,5 +108,44 @@ public List GetMatchingIndexes2(SfComboBox source, ComboBoxFilterInfo filte return indices; } + + public void OnInputSubmitted(object e) + { + var args = e as ComboBoxInputSubmittedEventArgs; + var emailString = args.Text; + bool isEmail = Regex.IsMatch(emailString, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase); + + // If given input is a valid email format + if (isEmail) + { + // Create new person for selection + Person newPerson = new Person(); + newPerson.EmailID = emailString; + int atIndex = emailString.LastIndexOf('@'); + int dotIndex = emailString.IndexOf('.'); + string name = emailString.Substring(0, atIndex); + if (name.Contains('.')) + { + newPerson.FirstName = name.Substring(0, dotIndex); + newPerson.LastName = name.Substring(dotIndex + 1); + } + else + { + newPerson.FirstName = name; + } + args.Item = newPerson; + } + + // If email is id invalid, show error dialog. + else + { + var dialog = new ContentDialog(); + dialog.CloseButtonText = "Close"; + dialog.Content = "Invalid email id!"; + dialog.Title = "Error"; + // dialog.XamlRoot = this.Content.XamlRoot; + // await dialog.ShowAsync(); + } + } } }