deep link windows button

Eduardo Gomez 4,316 Reputation points
2024-01-27T22:18:20.7333333+00:00

so, I registered my deep link on widows and is working perfectly
Thanks @Anonymous if I type demy-ia//e it will open the app but the problem comes when sending the email

 private static string GenerateHttmlTemplate(string roomName, string meetingLink, string userName, DateTime? dateTime = null) {
     return $@"
         <html>
         <head>
             <style>
                 /* CSS for the button */
                 .button {{
                     background-color: #5C3E88; /* Button background color */
                     color: white; /* Text color */
                     text-decoration: none;
                     padding: 10px 20px; /* Padding around text */
                     border-radius: 5px; /* Rounded corners */
                     display: inline-block;
                 }}
             </style>
         </head>
         <body>
             <p>Here are the meeting details:</p>
             <br> <!-- Add a line break -->
             <p><strong>Meeting Name:</strong> {roomName}</p>
             <p><strong>Teacher Name:</strong> {userName}</p>
             <p>Click the button below to join the meeting:</p>
             <p><a class='button' href='{meetingLink}'>Join</a></p>
         </body>
         </html>";
 }

 public static async Task SendEmail(ObservableCollection<User> users, string roomName, User? user, DateTime? dateTimeMeeting) {

     try {
         var meetingLink = string.Empty;
         using(var smtpClient = new SmtpClient("smtp.gmail.com")) {
             smtpClient.Port = 587;
             smtpClient.Credentials = new System.Net.NetworkCredential(Constants.EMAIL, Constants.APP_PASSWORD);
             smtpClient.EnableSsl = true;
             smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;



             if(DeviceInfo.Platform == DevicePlatform.WinUI) {
                 string protocol = "demy-ia";
                 meetingLink = $"{protocol}://{roomName}";
             } else {
                 meetingLink = $"{Constants.BASETTING_URL}{roomName}";
             }

             Console.WriteLine(meetingLink);

             foreach(var recipient in users) {
                 var mail = new MailMessage() {
                     From = new MailAddress(Constants.EMAIL),
                     Subject = "DemyIA meeting",
                     IsBodyHtml = true,
                 };

                 var body = GenerateHttmlTemplate(roomName, meetingLink, user!.Name, dateTimeMeeting);

                 mail.Body = body;

                 // Add the recipient to the message
                 mail.To.Add(recipient.Email);

                 // Send the email asynchronously and await the task
                 smtpClient.Send(mail);
             }
         }

         Console.WriteLine("Email sent successfully to the SMTP server.");

     } catch(Exception e) {
         await Console.Out.WriteLineAsync(e.Message);
     }
 }



If I send an email to from an Android, it will generate. https://demy-ia.daily.co/e and because this is a valid URL, the button will appear.
User's image

but for windows, we have to modify the URL, to make it open my app. demy-ia://e
this is not a valid URL. so it will not show User's image

and with this I will be able to adjust the link hen the app opens, and send it to a webview in Maui

Developer technologies | .NET | .NET Multi-platform App UI

Locked Question. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,166 Reputation points Microsoft External Staff
    2024-01-29T05:36:38.7566667+00:00

    Hello,

    After investigation, you could use button instead of a label to complete the click and jump function on the Windows platform.

    For example:

    <button onclick="window.location.href='demy-ia://e'">
        Join
      </button>
    

    Use this method to jump, whether from the browser or the maui webview, you can click and wake up the Windows application normally.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    3 people found this answer helpful.