From a56f0b46568c13afda113a08763bf5b0750a2612 Mon Sep 17 00:00:00 2001 From: John <109105353+jpeng-ms@users.noreply.github.com> Date: Wed, 17 Apr 2024 10:02:05 -0700 Subject: [PATCH] [Chat] Added Sample For File Sharing (#157) refactor existing interop samples into one solution files and added a new project for file sharing --- .../ChatTeamsInteropInlineImageQuickStart.sln | 51 --- .../ChatTeamsInteropQuickStart.sln | 162 ++++++--- ChatTeamsInteropQuickStart/README.md | 37 ++ .../App.xaml | 0 .../App.xaml.cs | 0 .../Assets/LockScreenLogo.scale-200.png | Bin .../Assets/SplashScreen.scale-200.png | Bin .../Assets/Square150x150Logo.scale-200.png | Bin .../Assets/Square44x44Logo.scale-200.png | Bin ...x44Logo.targetsize-24_altform-unplated.png | Bin .../Assets/StoreLogo.png | Bin .../Assets/Wide310x150Logo.scale-200.png | Bin ...atTeamsInteropFileSharingQuickStart.csproj | 180 ++++++++++ .../MainPage.xaml | 0 .../MainPage.xaml.cs | 335 ++++++++++++++++++ .../Package.appxmanifest | 0 .../Properties/AssemblyInfo.cs | 0 .../Properties/Default.rd.xml | 0 .../App.xaml | 7 + .../App.xaml.cs | 100 ++++++ .../Assets/LockScreenLogo.scale-200.png | Bin .../Assets/SplashScreen.scale-200.png | Bin .../Assets/Square150x150Logo.scale-200.png | Bin .../Assets/Square44x44Logo.scale-200.png | Bin ...x44Logo.targetsize-24_altform-unplated.png | Bin .../Assets/StoreLogo.png | Bin .../Assets/Wide310x150Logo.scale-200.png | Bin ...atTeamsInteropInlineImageQuickStart.csproj | 0 .../MainPage.xaml | 30 ++ .../MainPage.xaml.cs | 0 .../Package.appxmanifest | 49 +++ .../Properties/AssemblyInfo.cs | 29 ++ .../Properties/Default.rd.xml | 31 ++ .../ChatTeamsInteropQuickStart}/App.xaml | 0 .../ChatTeamsInteropQuickStart}/App.xaml.cs | 0 .../Assets/LockScreenLogo.scale-200.png | Bin 0 -> 1430 bytes .../Assets/SplashScreen.scale-200.png | Bin 0 -> 7700 bytes .../Assets/Square150x150Logo.scale-200.png | Bin 0 -> 2937 bytes .../Assets/Square44x44Logo.scale-200.png | Bin 0 -> 1647 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 0 -> 1255 bytes .../Assets/StoreLogo.png | Bin 0 -> 1451 bytes .../Assets/Wide310x150Logo.scale-200.png | Bin 0 -> 3204 bytes .../ChatTeamsInteropQuickStart.csproj | 2 +- .../ChatTeamsInteropQuickStart}/MainPage.xaml | 0 .../MainPage.xaml.cs | 0 .../Package.appxmanifest | 0 .../Properties/AssemblyInfo.cs | 0 .../Properties/Default.rd.xml | 0 .../ChatTeamsInteropQuickStart}/ReadMe.md | 0 49 files changed, 902 insertions(+), 111 deletions(-) delete mode 100644 ChatTeamsInteropInlineImageQuickStart/ChatTeamsInteropInlineImageQuickStart.sln create mode 100644 ChatTeamsInteropQuickStart/README.md rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart}/App.xaml (100%) rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart}/App.xaml.cs (100%) rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart}/Assets/LockScreenLogo.scale-200.png (100%) rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart}/Assets/SplashScreen.scale-200.png (100%) rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart}/Assets/Square150x150Logo.scale-200.png (100%) rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart}/Assets/Square44x44Logo.scale-200.png (100%) rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart}/Assets/Square44x44Logo.targetsize-24_altform-unplated.png (100%) rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart}/Assets/StoreLogo.png (100%) rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart}/Assets/Wide310x150Logo.scale-200.png (100%) create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/ChatTeamsInteropFileSharingQuickStart.csproj rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart}/MainPage.xaml (100%) create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/MainPage.xaml.cs rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart}/Package.appxmanifest (100%) rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart}/Properties/AssemblyInfo.cs (100%) rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart}/Properties/Default.rd.xml (100%) create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/App.xaml create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/App.xaml.cs rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropInlineImageQuickStart}/Assets/LockScreenLogo.scale-200.png (100%) rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropInlineImageQuickStart}/Assets/SplashScreen.scale-200.png (100%) rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropInlineImageQuickStart}/Assets/Square150x150Logo.scale-200.png (100%) rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropInlineImageQuickStart}/Assets/Square44x44Logo.scale-200.png (100%) rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropInlineImageQuickStart}/Assets/Square44x44Logo.targetsize-24_altform-unplated.png (100%) rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropInlineImageQuickStart}/Assets/StoreLogo.png (100%) rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropInlineImageQuickStart}/Assets/Wide310x150Logo.scale-200.png (100%) rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart}/ChatTeamsInteropInlineImageQuickStart.csproj (100%) create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/MainPage.xaml rename {ChatTeamsInteropInlineImageQuickStart => ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart}/MainPage.xaml.cs (100%) create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Package.appxmanifest create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Properties/AssemblyInfo.cs create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Properties/Default.rd.xml rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropQuickStart}/App.xaml (100%) rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropQuickStart}/App.xaml.cs (100%) create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropQuickStart/Assets/LockScreenLogo.scale-200.png create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropQuickStart/Assets/SplashScreen.scale-200.png create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropQuickStart/Assets/Square150x150Logo.scale-200.png create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropQuickStart/Assets/Square44x44Logo.scale-200.png create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropQuickStart/Assets/Square44x44Logo.targetsize-24_altform-unplated.png create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropQuickStart/Assets/StoreLogo.png create mode 100644 ChatTeamsInteropQuickStart/src/ChatTeamsInteropQuickStart/Assets/Wide310x150Logo.scale-200.png rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropQuickStart}/ChatTeamsInteropQuickStart.csproj (97%) rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropQuickStart}/MainPage.xaml (100%) rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropQuickStart}/MainPage.xaml.cs (100%) rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropQuickStart}/Package.appxmanifest (100%) rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropQuickStart}/Properties/AssemblyInfo.cs (100%) rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropQuickStart}/Properties/Default.rd.xml (100%) rename ChatTeamsInteropQuickStart/{ => src/ChatTeamsInteropQuickStart}/ReadMe.md (100%) diff --git a/ChatTeamsInteropInlineImageQuickStart/ChatTeamsInteropInlineImageQuickStart.sln b/ChatTeamsInteropInlineImageQuickStart/ChatTeamsInteropInlineImageQuickStart.sln deleted file mode 100644 index e1242bda..00000000 --- a/ChatTeamsInteropInlineImageQuickStart/ChatTeamsInteropInlineImageQuickStart.sln +++ /dev/null @@ -1,51 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.8.34309.116 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatTeamsInteropInlineImageQuickStart", "ChatTeamsInteropInlineImageQuickStart.csproj", "{418083DC-5EFD-4ED2-81BF-0F76B5D31696}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|ARM64 = Debug|ARM64 - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|ARM = Release|ARM - Release|ARM64 = Release|ARM64 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|ARM.ActiveCfg = Debug|ARM - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|ARM.Build.0 = Debug|ARM - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|ARM.Deploy.0 = Debug|ARM - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|ARM64.Build.0 = Debug|ARM64 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|x64.ActiveCfg = Debug|x64 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|x64.Build.0 = Debug|x64 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|x64.Deploy.0 = Debug|x64 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|x86.ActiveCfg = Debug|x86 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|x86.Build.0 = Debug|x86 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|x86.Deploy.0 = Debug|x86 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|ARM.ActiveCfg = Release|ARM - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|ARM.Build.0 = Release|ARM - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|ARM.Deploy.0 = Release|ARM - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|ARM64.ActiveCfg = Release|ARM64 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|ARM64.Build.0 = Release|ARM64 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|ARM64.Deploy.0 = Release|ARM64 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|x64.ActiveCfg = Release|x64 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|x64.Build.0 = Release|x64 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|x64.Deploy.0 = Release|x64 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|x86.ActiveCfg = Release|x86 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|x86.Build.0 = Release|x86 - {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|x86.Deploy.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {D3561CD7-F171-4F8A-896F-EFB8D3B3FB84} - EndGlobalSection -EndGlobal diff --git a/ChatTeamsInteropQuickStart/ChatTeamsInteropQuickStart.sln b/ChatTeamsInteropQuickStart/ChatTeamsInteropQuickStart.sln index 55c00c28..895b02e5 100644 --- a/ChatTeamsInteropQuickStart/ChatTeamsInteropQuickStart.sln +++ b/ChatTeamsInteropQuickStart/ChatTeamsInteropQuickStart.sln @@ -1,59 +1,103 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.8.34309.116 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatTeamsInteropQuickStart", "ChatTeamsInteropQuickStart.csproj", "{704D7753-FAC6-4A15-8E2D-15DCC270A29A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|ARM64 = Debug|ARM64 - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|ARM64 = Release|ARM64 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|ARM.ActiveCfg = Debug|ARM - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|ARM.Build.0 = Debug|ARM - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|ARM.Deploy.0 = Debug|ARM - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|ARM64.Build.0 = Debug|ARM64 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|x64.ActiveCfg = Debug|x64 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|x64.Build.0 = Debug|x64 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|x64.Deploy.0 = Debug|x64 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|x86.ActiveCfg = Debug|Win32 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|x86.Build.0 = Debug|Win32 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|x86.Deploy.0 = Debug|Win32 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|Any CPU.Build.0 = Release|Any CPU - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|Any CPU.Deploy.0 = Release|Any CPU - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|ARM.ActiveCfg = Release|ARM - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|ARM.Build.0 = Release|ARM - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|ARM.Deploy.0 = Release|ARM - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|ARM64.ActiveCfg = Release|ARM64 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|ARM64.Build.0 = Release|ARM64 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|ARM64.Deploy.0 = Release|ARM64 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|x64.ActiveCfg = Release|x64 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|x64.Build.0 = Release|x64 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|x64.Deploy.0 = Release|x64 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|x86.ActiveCfg = Release|Win32 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|x86.Build.0 = Release|Win32 - {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|x86.Deploy.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {4058607D-0757-45A8-8382-60765A228BD5} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34309.116 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatTeamsInteropQuickStart", "src\ChatTeamsInteropQuickStart\ChatTeamsInteropQuickStart.csproj", "{704D7753-FAC6-4A15-8E2D-15DCC270A29A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatTeamsInteropInlineImageQuickStart", "src\ChatTeamsInteropInlineImageQuickStart\ChatTeamsInteropInlineImageQuickStart.csproj", "{418083DC-5EFD-4ED2-81BF-0F76B5D31696}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatTeamsInteropFileSharingQuickStart", "src\ChatTeamsInteropFileSharingQuickStart\ChatTeamsInteropFileSharingQuickStart.csproj", "{3023CB60-8CE9-4DF2-98DA-5AE11B756245}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|ARM.ActiveCfg = Debug|ARM + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|ARM.Build.0 = Debug|ARM + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|ARM.Deploy.0 = Debug|ARM + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|ARM64.Build.0 = Debug|ARM64 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|x64.ActiveCfg = Debug|x64 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|x64.Build.0 = Debug|x64 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|x64.Deploy.0 = Debug|x64 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|x86.ActiveCfg = Debug|x86 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|x86.Build.0 = Debug|x86 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Debug|x86.Deploy.0 = Debug|x86 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|ARM.ActiveCfg = Release|ARM + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|ARM.Build.0 = Release|ARM + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|ARM.Deploy.0 = Release|ARM + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|ARM64.ActiveCfg = Release|ARM64 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|ARM64.Build.0 = Release|ARM64 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|ARM64.Deploy.0 = Release|ARM64 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|x64.ActiveCfg = Release|x64 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|x64.Build.0 = Release|x64 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|x64.Deploy.0 = Release|x64 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|x86.ActiveCfg = Release|x86 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|x86.Build.0 = Release|x86 + {704D7753-FAC6-4A15-8E2D-15DCC270A29A}.Release|x86.Deploy.0 = Release|x86 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|ARM.ActiveCfg = Debug|ARM + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|ARM.Build.0 = Debug|ARM + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|ARM.Deploy.0 = Debug|ARM + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|ARM64.Build.0 = Debug|ARM64 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|x64.ActiveCfg = Debug|x64 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|x64.Build.0 = Debug|x64 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|x64.Deploy.0 = Debug|x64 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|x86.ActiveCfg = Debug|x86 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|x86.Build.0 = Debug|x86 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Debug|x86.Deploy.0 = Debug|x86 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|ARM.ActiveCfg = Release|ARM + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|ARM.Build.0 = Release|ARM + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|ARM.Deploy.0 = Release|ARM + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|ARM64.ActiveCfg = Release|ARM64 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|ARM64.Build.0 = Release|ARM64 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|ARM64.Deploy.0 = Release|ARM64 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|x64.ActiveCfg = Release|x64 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|x64.Build.0 = Release|x64 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|x64.Deploy.0 = Release|x64 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|x86.ActiveCfg = Release|x86 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|x86.Build.0 = Release|x86 + {418083DC-5EFD-4ED2-81BF-0F76B5D31696}.Release|x86.Deploy.0 = Release|x86 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Debug|ARM.ActiveCfg = Debug|ARM + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Debug|ARM.Build.0 = Debug|ARM + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Debug|ARM.Deploy.0 = Debug|ARM + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Debug|ARM64.Build.0 = Debug|ARM64 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Debug|x64.ActiveCfg = Debug|x64 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Debug|x64.Build.0 = Debug|x64 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Debug|x64.Deploy.0 = Debug|x64 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Debug|x86.ActiveCfg = Debug|x86 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Debug|x86.Build.0 = Debug|x86 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Debug|x86.Deploy.0 = Debug|x86 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Release|ARM.ActiveCfg = Release|ARM + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Release|ARM.Build.0 = Release|ARM + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Release|ARM.Deploy.0 = Release|ARM + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Release|ARM64.ActiveCfg = Release|ARM64 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Release|ARM64.Build.0 = Release|ARM64 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Release|ARM64.Deploy.0 = Release|ARM64 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Release|x64.ActiveCfg = Release|x64 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Release|x64.Build.0 = Release|x64 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Release|x64.Deploy.0 = Release|x64 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Release|x86.ActiveCfg = Release|x86 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Release|x86.Build.0 = Release|x86 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245}.Release|x86.Deploy.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4058607D-0757-45A8-8382-60765A228BD5} + EndGlobalSection +EndGlobal diff --git a/ChatTeamsInteropQuickStart/README.md b/ChatTeamsInteropQuickStart/README.md new file mode 100644 index 00000000..7dd5263b --- /dev/null +++ b/ChatTeamsInteropQuickStart/README.md @@ -0,0 +1,37 @@ +--- +page_type: sample +languages: +- csharp +products: +- azure +- azure-communication-services +- communication-chat +--- + +# Chat Teams Interop QuickStart + +This quickstart contains samples for the following tutorials: + - [Join your chat app to a Teams meeting](https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/chat/meeting-interop?pivots=platform-windows) + - [Enable inline image support in your Chat app](https://learn.microsoft.com/en-us/azure/communication-services/tutorials/chat-interop/meeting-interop-features-inline-image?pivots=programming-language-csharp) + - [Enable file attachment support in your Chat app](https://learn.microsoft.com/en-us/azure/communication-services/tutorials/chat-interop/meeting-interop-features-file-attachment?pivots=programming-language-csharp) + +## Prerequisites + +* A [Teams deployment](/deployoffice/teams-install). +* An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). +* Install [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) with Universal Windows Platform development workload. +* A deployed Communication Services resource. [Create a Communication Services resource](../../create-communication-resource.md). +* A Teams Meeting Link. + +## Code Structure + +- **src\ChatTeamsInteropQuickStart:** Sample code to showcase how you can join a Teams chat using the Chat SDK. +- **src\ChatTeamsInteropInlineImageQuickStart:** Sample code to showcase how you can enable inline image support in a Teams Interoperability Chat. +- **src\ChatTeamsInteropFileSharingQuickStart:** Sample code to showcase how you can enable file sharing support in a Teams Interoperability Chat. + +## Run Locally + +1. Open `ChatTeamsInteropQuickStart.sln` in in Visual Studio +2. Choose a sample and set it as startup project +3. In `MainPage.xaml.cs`, provide required `connectionString_` +4. Run the application diff --git a/ChatTeamsInteropInlineImageQuickStart/App.xaml b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/App.xaml similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/App.xaml rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/App.xaml diff --git a/ChatTeamsInteropInlineImageQuickStart/App.xaml.cs b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/App.xaml.cs similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/App.xaml.cs rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/App.xaml.cs diff --git a/ChatTeamsInteropInlineImageQuickStart/Assets/LockScreenLogo.scale-200.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/LockScreenLogo.scale-200.png similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/Assets/LockScreenLogo.scale-200.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/LockScreenLogo.scale-200.png diff --git a/ChatTeamsInteropInlineImageQuickStart/Assets/SplashScreen.scale-200.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/SplashScreen.scale-200.png similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/Assets/SplashScreen.scale-200.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/SplashScreen.scale-200.png diff --git a/ChatTeamsInteropInlineImageQuickStart/Assets/Square150x150Logo.scale-200.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/Assets/Square150x150Logo.scale-200.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/Square150x150Logo.scale-200.png diff --git a/ChatTeamsInteropInlineImageQuickStart/Assets/Square44x44Logo.scale-200.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/Assets/Square44x44Logo.scale-200.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/Square44x44Logo.scale-200.png diff --git a/ChatTeamsInteropInlineImageQuickStart/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/Assets/Square44x44Logo.targetsize-24_altform-unplated.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/ChatTeamsInteropInlineImageQuickStart/Assets/StoreLogo.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/StoreLogo.png similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/Assets/StoreLogo.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/StoreLogo.png diff --git a/ChatTeamsInteropInlineImageQuickStart/Assets/Wide310x150Logo.scale-200.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/Assets/Wide310x150Logo.scale-200.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Assets/Wide310x150Logo.scale-200.png diff --git a/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/ChatTeamsInteropFileSharingQuickStart.csproj b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/ChatTeamsInteropFileSharingQuickStart.csproj new file mode 100644 index 00000000..70368df9 --- /dev/null +++ b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/ChatTeamsInteropFileSharingQuickStart.csproj @@ -0,0 +1,180 @@ + + + + + latest + + + Debug + x86 + {3023CB60-8CE9-4DF2-98DA-5AE11B756245} + AppContainerExe + Properties + ChatTeamsInteropInlineImageQuickStart + ChatTeamsInteropInlineImageQuickStart + en-US + UAP + 10.0.22621.0 + 10.0.22621.0 + 14 + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + true + false + + + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x86 + false + prompt + true + + + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x86 + false + prompt + true + true + + + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + ARM + false + prompt + true + + + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + ARM + false + prompt + true + true + + + true + bin\ARM64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + ARM64 + false + prompt + true + true + + + bin\ARM64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + ARM64 + false + prompt + true + true + + + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x64 + false + prompt + true + + + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x64 + false + prompt + true + true + + + PackageReference + + + + App.xaml + + + MainPage.xaml + + + + + + Designer + + + + + + + + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + + + 1.6.0 + + + 1.3.0 + + + 1.3.1 + + + 6.2.14 + + + + 14.0 + + + + \ No newline at end of file diff --git a/ChatTeamsInteropInlineImageQuickStart/MainPage.xaml b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/MainPage.xaml similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/MainPage.xaml rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/MainPage.xaml diff --git a/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/MainPage.xaml.cs b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/MainPage.xaml.cs new file mode 100644 index 00000000..b0e9fb6a --- /dev/null +++ b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/MainPage.xaml.cs @@ -0,0 +1,335 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Communication.Chat; +using Azure.Communication.Identity; +using Azure.Communication.Calling.WindowsClient; +using System.Threading.Tasks; +using Azure.Communication; +using Azure; +using Azure.Core; +using Windows.UI.Popups; +using Windows.UI.Core; +using System.Text.RegularExpressions; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml; +using PropertyChangedEventArgs = Azure.Communication.Calling.WindowsClient.PropertyChangedEventArgs; +using ChatMessage = Azure.Communication.Chat.ChatMessage; +using System.IO; +using Windows.UI.Xaml.Media.Imaging; + + + +// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 + +namespace ChatTeamsInteropInlineImageQuickStart +{ + /// + /// An empty page that can be used on its own or navigated to within a Frame. + /// + public sealed partial class MainPage : Page + { + private const int pollingDelayMs = 5000; + + //ACS resource connection string i.e = "endpoint=https://your-resource.communication.azure.net/;accesskey=your-access-key"; + private const string connectionString_ = ""; + private CommunicationCall call_; + private CallTokenCredential token_credential; + private CallClient call_client; + private CallAgent call_agent; + + private ChatClient chatClient_; + private bool keepPolling_; + + private string user_Id_; + private string user_token_; + private string thread_Id_; + + System.Net.Http.HttpClient client = new(); + + public MainPage() + { + InitializeComponent(); + call_client = new(); + } + + private async void CallButton_Click(object sender, RoutedEventArgs e) + { + CallButton.IsEnabled = false; + if (!await ValidateInput()) + { + CallButton.IsEnabled = true; + return; + } + await CreateAndSetUserAndTokenAsync(); + await JoinCallAndSetChatThreadId(); + } + + private async void SendMessageButton_Click(object sender, RoutedEventArgs e) + { + SendMessageButton.IsEnabled = false; + ChatThreadClient chatThreadClient = chatClient_.GetChatThreadClient(thread_Id_); + _ = await chatThreadClient.SendMessageAsync(TxtMessage.Text); + + TxtMessage.Text = ""; + SendMessageButton.IsEnabled = true; + } + + private async void HangupButton_Click(object sender, RoutedEventArgs e) + { + await SetInCallState(false); + await call_.HangUpAsync(new HangUpOptions()); + } + + private async Task JoinCallAndSetChatThreadId() + { + + try + { + token_credential = new CallTokenCredential(user_token_); + CallAgentOptions call_agent_options = new(); + call_agent = await call_client.CreateCallAgentAsync(token_credential, call_agent_options); + } + catch + { + _ = await new MessageDialog("It was not possible to create call agent. Please check if token is valid.").ShowAsync(); + return; + } + + // Join a Teams meeting + try + { + JoinCallOptions joinCallOptions = new(); + TeamsMeetingLinkLocator teamsMeetingLinkLocator = new(TxtTeamsLinkTextBox.Text); + call_ = await call_agent.JoinAsync(teamsMeetingLinkLocator, joinCallOptions); + } + catch + { + _ = await new MessageDialog("It was not possible to join the Teams meeting. Please check if Teams Link is valid.").ShowAsync(); + return; + } + + // set thread Id + thread_Id_ = ExtractThreadIdFromTeamsLink(); + + // Set up call callbacks + call_.StateChanged += Call_OnStateChangedAsync; + } + + private async void Call_OnStateChangedAsync(object sender, PropertyChangedEventArgs args) + { + await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => + { + CallStatusTextBlock.Text = "Call state : " + call_.State.ToString(); + }); + + switch (call_.State) + { + case CallState.Connected: + await StartPollingForChatMessages(); + break; + + case CallState.Disconnected: + case CallState.None: + await SetInCallState(false); + break; + default: + break; + } + } + + /// + /// Background task that keeps polling for chat messages while the call connection is stablished + /// + private async Task StartPollingForChatMessages() + { + CommunicationTokenCredential communicationTokenCredential = new(user_token_); + chatClient_ = new ChatClient(EndPointFromConnectionString(), communicationTokenCredential); + await Task.Run(async () => + { + keepPolling_ = true; + + ChatThreadClient chatThreadClient = chatClient_.GetChatThreadClient(thread_Id_); + int previousTextMessages = 0; + while (keepPolling_) + { + try + { + CommunicationUserIdentifier currentUser = new(user_Id_); + AsyncPageable allMessages = chatThreadClient.GetMessagesAsync(); + SortedDictionary messageList = []; + int textMessages = 0; + await foreach (ChatMessage message in allMessages) + { + // Get message attachments that are of type 'file' + IEnumerable fileAttachments = message.Content.Attachments.Where(x => x.AttachmentType == ChatAttachmentType.File); + var chatAttachmentFileUris = new List(); + foreach (var file in fileAttachments) + { + chatAttachmentFileUris.Add(file.PreviewUri); + } + + // Build message list + if (message.Type == ChatMessageType.Html || message.Type == ChatMessageType.Text) + { + textMessages++; + var userPrefix = message.Sender.Equals(currentUser) ? "[you]:" : ""; + var strippedMessage = StripHtml(message.Content.Message); + + + + var chatAttachments = fileAttachments.Count() > 0 ? "[Attachments]:\n" + string.Join(",\n", chatAttachmentFileUris) : ""; + messageList.Add(long.Parse(message.SequenceId), $"{userPrefix}{strippedMessage}\n{chatAttachments}"); + } + } + + // Update UI just when there are new messages + if (textMessages > previousTextMessages) + { + previousTextMessages = textMessages; + await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => + { + TxtChat.Text = string.Join(Environment.NewLine, messageList.Values.ToList()); + }); + + } + if (!keepPolling_) + { + return; + } + + await SetInCallState(true); + await Task.Delay(pollingDelayMs); + } + catch (Exception e) + { + await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => + { + _ = new MessageDialog($"An error ocurred while fetching messages in PollingChatMessagesAsync(). The application will shutdown. Details : {e.Message}").ShowAsync(); + throw e; + }); + await SetInCallState(false); + } + } + }); + } + + private async Task SetInCallState(bool inCallState) + { + keepPolling_ = inCallState; + await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => + { + + TxtTeamsLinkTextBox.IsEnabled = CallButton.IsEnabled = !inCallState; + HangupButton.IsEnabled = SendMessageButton.IsEnabled = inCallState; + if (!inCallState) + { + TxtChat.Text = ""; + } + }); + } + + #region Support / Helper functions + /// + /// Support function to auto-scroll chat area + /// + /// + /// + private void TxtChat_TextChanged(object sender, TextChangedEventArgs e) + { + var grid = (Grid)VisualTreeHelper.GetChild(TxtChat, 0); + for (var i = 0; i <= VisualTreeHelper.GetChildrenCount(grid) - 1; i++) + { + object obj = VisualTreeHelper.GetChild(grid, i); + if (!(obj is ScrollViewer)) continue; + ((ScrollViewer)obj).ChangeView(0.0f, ((ScrollViewer)obj).ExtentHeight, 1.0f); + break; + } + } + + /// + /// Validation for input parameters. + /// 1. Connection string. Example: "endpoint=https://your-resource.communication.azure.net/;accesskey=your-access-key"; + /// 2. Teams meeting link: Example "https://teams.microsoft.com/l/meetup-join/19:meeting_Nzk5YzNmZThtNWU3OS00YTg4LWJjOWMtOTE2YTUzM3IzYzlh@thread.v2/0?context=%7B%66Tid%22:%2272f977bf-86f1-41af-88ab-2d7cd011db47%22,%22Oid%22:%227bb5b66f-c889-420d-bc64-b34a17799e46%22%7D"; + /// + /// + private async Task ValidateInput() + { + if (string.IsNullOrEmpty(connectionString_) || !connectionString_.StartsWith("endpoint=https://", StringComparison.OrdinalIgnoreCase) || !connectionString_.Contains(";accesskey=", StringComparison.OrdinalIgnoreCase)) + { + _ = await new MessageDialog("Please enter a valid azure communication service resource connection string for variable : connectionString_ ").ShowAsync(); + return false; + } + + if (TxtTeamsLinkTextBox.Text.Trim().Length == 0 || !TxtTeamsLinkTextBox.Text.StartsWith("http")) + { + _ = await new MessageDialog("Please enter a valid Teams meeting link.").ShowAsync(); + return false; + } + + if (!TxtTeamsLinkTextBox.Text.Contains("19:meeting_", StringComparison.OrdinalIgnoreCase) && !TxtTeamsLinkTextBox.Text.Contains("19%3ameeting_", StringComparison.OrdinalIgnoreCase)) + { + _ = await new MessageDialog("Invalid teams meeting link. Missing meeting id : '19:meeting_' ").ShowAsync(); + return false; + } + + return true; + } + + /// + /// Support function to extract thread id from teams link + /// + /// + private string ExtractThreadIdFromTeamsLink() + { + //i.e : https://teams.microsoft.com/l/meetup-join/19:meeting_NTgyN + string teamsMeetingUrl = TxtTeamsLinkTextBox.Text; + int startThreadId = teamsMeetingUrl.IndexOf("19:meeting_"); + if (startThreadId < 0) + { + startThreadId = teamsMeetingUrl.IndexOf("19%3ameeting_"); // URL encoded cases + } + int endThreadId = teamsMeetingUrl.IndexOf("/", startThreadId); + return System.Net.WebUtility.UrlDecode(teamsMeetingUrl.Substring(startThreadId, endThreadId - startThreadId)); + } + + /// + /// Support function to extract URL from connection string + /// + private Uri EndPointFromConnectionString() + { + var url = connectionString_.Replace("endpoint=", ""); + var len = url.IndexOf("/;accesskey="); + return new Uri(url.Substring(0, len)); + } + + /// + /// Support function to create ACS user with chat and VOIP permissions + /// + /// + private async Task CreateAndSetUserAndTokenAsync() + { + CommunicationIdentityClient communicationIdentityClient = new(connectionString_); + Response user = await communicationIdentityClient.CreateUserAsync(); + IEnumerable scopes = new[] { CommunicationTokenScope.Chat, CommunicationTokenScope.VoIP }; + Response tokenResponseUser = await communicationIdentityClient.GetTokenAsync(user.Value, scopes); + user_Id_ = user.Value.Id; + user_token_ = tokenResponseUser.Value.Token; + } + + + /// + /// Support function to remove basic html tags introduced by teams client chat + /// + /// + /// + private string StripHtml(string html) + { + var tagsExpression = new Regex(@""); + return tagsExpression.Replace(html, " "); + } + + #endregion + } +} \ No newline at end of file diff --git a/ChatTeamsInteropInlineImageQuickStart/Package.appxmanifest b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Package.appxmanifest similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/Package.appxmanifest rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Package.appxmanifest diff --git a/ChatTeamsInteropInlineImageQuickStart/Properties/AssemblyInfo.cs b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Properties/AssemblyInfo.cs similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/Properties/AssemblyInfo.cs rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Properties/AssemblyInfo.cs diff --git a/ChatTeamsInteropInlineImageQuickStart/Properties/Default.rd.xml b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Properties/Default.rd.xml similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/Properties/Default.rd.xml rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropFileSharingQuickStart/Properties/Default.rd.xml diff --git a/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/App.xaml b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/App.xaml new file mode 100644 index 00000000..a99b7bc0 --- /dev/null +++ b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/App.xaml @@ -0,0 +1,7 @@ + + + diff --git a/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/App.xaml.cs b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/App.xaml.cs new file mode 100644 index 00000000..bc49ab1d --- /dev/null +++ b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/App.xaml.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; + +namespace ChatTeamsInteropInlineImageQuickStart +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + sealed partial class App : Application + { + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + this.InitializeComponent(); + this.Suspending += OnSuspending; + } + + /// + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used such as when the application is launched to open a specific file. + /// + /// Details about the launch request and process. + protected override void OnLaunched(LaunchActivatedEventArgs e) + { + Frame rootFrame = Window.Current.Content as Frame; + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == null) + { + // Create a Frame to act as the navigation context and navigate to the first page + rootFrame = new Frame(); + + rootFrame.NavigationFailed += OnNavigationFailed; + + if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) + { + //TODO: Load state from previously suspended application + } + + // Place the frame in the current Window + Window.Current.Content = rootFrame; + } + + if (e.PrelaunchActivated == false) + { + if (rootFrame.Content == null) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame.Navigate(typeof(MainPage), e.Arguments); + } + // Ensure the current window is active + Window.Current.Activate(); + } + } + + /// + /// Invoked when Navigation to a certain page fails + /// + /// The Frame which failed navigation + /// Details about the navigation failure + void OnNavigationFailed(object sender, NavigationFailedEventArgs e) + { + throw new Exception("Failed to load Page " + e.SourcePageType.FullName); + } + + /// + /// Invoked when application execution is being suspended. Application state is saved + /// without knowing whether the application will be terminated or resumed with the contents + /// of memory still intact. + /// + /// The source of the suspend request. + /// Details about the suspend request. + private void OnSuspending(object sender, SuspendingEventArgs e) + { + var deferral = e.SuspendingOperation.GetDeferral(); + //TODO: Save application state and stop any background activity + deferral.Complete(); + } + } +} diff --git a/ChatTeamsInteropQuickStart/Assets/LockScreenLogo.scale-200.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/LockScreenLogo.scale-200.png similarity index 100% rename from ChatTeamsInteropQuickStart/Assets/LockScreenLogo.scale-200.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/LockScreenLogo.scale-200.png diff --git a/ChatTeamsInteropQuickStart/Assets/SplashScreen.scale-200.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/SplashScreen.scale-200.png similarity index 100% rename from ChatTeamsInteropQuickStart/Assets/SplashScreen.scale-200.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/SplashScreen.scale-200.png diff --git a/ChatTeamsInteropQuickStart/Assets/Square150x150Logo.scale-200.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from ChatTeamsInteropQuickStart/Assets/Square150x150Logo.scale-200.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/Square150x150Logo.scale-200.png diff --git a/ChatTeamsInteropQuickStart/Assets/Square44x44Logo.scale-200.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from ChatTeamsInteropQuickStart/Assets/Square44x44Logo.scale-200.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/Square44x44Logo.scale-200.png diff --git a/ChatTeamsInteropQuickStart/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from ChatTeamsInteropQuickStart/Assets/Square44x44Logo.targetsize-24_altform-unplated.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/ChatTeamsInteropQuickStart/Assets/StoreLogo.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/StoreLogo.png similarity index 100% rename from ChatTeamsInteropQuickStart/Assets/StoreLogo.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/StoreLogo.png diff --git a/ChatTeamsInteropQuickStart/Assets/Wide310x150Logo.scale-200.png b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from ChatTeamsInteropQuickStart/Assets/Wide310x150Logo.scale-200.png rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/Assets/Wide310x150Logo.scale-200.png diff --git a/ChatTeamsInteropInlineImageQuickStart/ChatTeamsInteropInlineImageQuickStart.csproj b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/ChatTeamsInteropInlineImageQuickStart.csproj similarity index 100% rename from ChatTeamsInteropInlineImageQuickStart/ChatTeamsInteropInlineImageQuickStart.csproj rename to ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/ChatTeamsInteropInlineImageQuickStart.csproj diff --git a/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/MainPage.xaml b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/MainPage.xaml new file mode 100644 index 00000000..fb7a0e25 --- /dev/null +++ b/ChatTeamsInteropQuickStart/src/ChatTeamsInteropInlineImageQuickStart/MainPage.xaml @@ -0,0 +1,30 @@ + + + + + + + +