diff --git a/.github/workflows/gitleaks.yaml b/.github/workflows/gitleaks.yaml new file mode 100644 index 0000000..48a24dd --- /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 diff --git a/README.md b/README.md index 8d40911..156a3c9 100644 --- a/README.md +++ b/README.md @@ -1 +1,143 @@ -**[View document in Syncfusion Xamarin Knowledge base](https://www.syncfusion.com/kb/12201/how-to-get-the-tapped-custom-appointment-details-in-xamarin-forms-schedule-sfschedule)** +# How to get the tapped custom appointment details in Xamarin.Forms Schedule (SfSchedule) + +You can get the tapped appointment details while tapping the inline appointment of a month by using the [MonthInlineAppointmentTapped](https://help.syncfusion.com/cr/xamarin/Syncfusion.SfSchedule.XForms.SfSchedule.html#Syncfusion_SfSchedule_XForms_SfSchedule_MonthInlineAppointmentTapped) event in Xamarin [SfSchedule](https://www.syncfusion.com/xamarin-ui-controls/xamarin-scheduler). + +**C#** + +Create a custom class Meeting with mandatory fields From, To and EventName. +``` +public class Meeting +{ +    public string EventName { get; set; } +    public DateTime From { get; set; } +    public DateTime To { get; set; } +    public Color Color { get; set; } +} +``` +**C#** + +Create a ViewModel class and add the appointment details. +``` +public class SchedulerViewModel : INotifyPropertyChanged +{ +    private ObservableCollection meetings; +    private List colorCollection; +    private List currentDayMeetings; +    public SchedulerViewModel() +    { +        this.Meetings = new ObservableCollection(); +        this.AddAppointmentDetails(); +        this.AddAppointments(); +    } +    private void AddAppointmentDetails() +    { +        this.currentDayMeetings = new List(); +        this.currentDayMeetings.Add("General Meeting"); +        this.currentDayMeetings.Add("Plan Execution"); +        this.currentDayMeetings.Add("Project Plan"); +        +        this.colorCollection = new List(); +        this.colorCollection.Add(Color.FromHex("#FFA2C139")); +        this.colorCollection.Add(Color.FromHex("#FFD80073")); +        this.colorCollection.Add(Color.FromHex("#FF339933"));        +    } +    private void AddAppointments() +    { +        var today = DateTime.Now.Date; +        var random = new Random(); +        for (int month = -1; month < 2; month++) +        { +            for (int day = -5; day < 5; day++) +            { +                for (int count = 0; count < 2; count++) +                { +                    var meeting = new Meeting(); +                    meeting.From = today.AddMonths(month).AddDays(random.Next(1, 28)).AddHours(random.Next(9, 18)); +                    meeting.To = meeting.From.AddHours(1); +                    meeting.EventName = this.currentDayMeetings[random.Next(7)]; +                    meeting.Color = this.colorCollection[random.Next(14)]; +                    this.Meetings.Add(meeting); +                } +            } +        } +    } +    public event PropertyChangedEventHandler PropertyChanged; +    private void RaiseOnPropertyChanged(string propertyName) +    { +        this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); +    } +} +``` +**XAML** + +Bind the appointments to a schedule by using the DataSource property. You can map the properties of Meeting class with SfSchedule by using the AppointmentMapping. +``` + +    +        +            +                +            +  +            +                +            +        +    + +    +        +    +``` +**C#** + +In MonthInlineAppointmentTapped event, you need to cast the custom appointments to get the tapped appointment details. +``` +public class SchedulerPageBehavior : Behavior +{ +    SfSchedule schedule; +    protected override void OnAttachedTo(ContentPage bindable) +    { +        base.OnAttachedTo(bindable); +        this.schedule = bindable.Content.FindByName("Schedule"); +        this.schedule.MonthViewSettings.ShowAgendaView = true; +  +        this.WireEvents(); +    } +    private void WireEvents() +    { +        this.schedule.MonthInlineAppointmentTapped += Schedule_MonthInlineAppointmentTapped; +    } +    private void Schedule_MonthInlineAppointmentTapped(object sender, MonthInlineAppointmentTappedEventArgs e) +    { +        if (e.Appointment != null) +        { +            var app = (e.Appointment as Meeting); +            App.Current.MainPage.DisplayAlert(app.EventName, app.From.ToString(), "OK"); +  +        } +        else +        { +            App.Current.MainPage.DisplayAlert("", "No Events", "OK"); +        } +    } +    protected override void OnDetachingFrom(ContentPage bindable) +    { +        base.OnDetachingFrom(bindable); +        this.UnWireEvents(); +    } +    private void UnWireEvents() +    { +        this.schedule.MonthInlineAppointmentTapped += Schedule_MonthInlineAppointmentTapped; +    } +} +``` + +KB article - [How to get the tapped custom appointment details in Xamarin.Forms Schedule (SfSchedule)](https://www.syncfusion.com/kb/12201/how-to-get-the-tapped-custom-appointment-details-in-xamarin-forms-schedule-sfschedule)