コード例 #1
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(0, 2, true);
            WriteLiteral("\r\n");
            EndContext();
#line 2 "C:\Users\HKD44\Documents\GitHub\NetConnect\NetConnect.Hosting.App1\Views\Home\Index.cshtml"

            ViewData["Title"] = "Index";
            Layout            = "~/Views/Shared/_Layout.cshtml";

#line default
#line hidden
            BeginContext(90, 2, true);
            WriteLiteral("\r\n");
            EndContext();
#line 7 "C:\Users\HKD44\Documents\GitHub\NetConnect\NetConnect.Hosting.App1\Views\Home\Index.cshtml"

            var userId = User.GetChatUsers().UserId;

#line default
#line hidden
            BeginContext(146, 43, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("link", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "b4026c203c79406fb262d46396a16761", async() => {
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(189, 1040, true);
            WriteLiteral(@"

<div class=""container"">
    <h3 class="" text-center"">Messaging</h3>
    <div class=""messaging"">
        <div class=""inbox_msg"">
            <div class=""inbox_people"">
                <div class=""headind_srch"">
                    <div class=""recent_heading"">
                        <h4>Users</h4>
                    </div>

                </div>
                <div class=""inbox_chat"" id=""users"">

                </div>
            </div>
            <div class=""mesgs"" >
                <div class=""msg_history"" id=""messages"">

                </div>
                <div class=""type_msg"">
                    <div class=""input_msg_write"">
                        <input type=""text"" id=""message"" class=""write_msg"" placeholder=""Mesajınız"" />
                        <button class=""msg_send_btn"" id=""sendmessage"" type=""button""><i class=""fa fa-paper-plane-o"" aria-hidden=""true""></i></button>
                    </div>
                </div>
            </div>
        </div>

    </div>
");
            WriteLiteral("</div>\r\n\r\n\r\n\r\n\r\n");
            EndContext();
            BeginContext(1229, 55, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "eccefe55814b4dc6bb7b833e4f606706", async() => {
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1284, 2, true);
            WriteLiteral("\r\n");
            EndContext();
            BeginContext(1286, 44, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "9652c1b5984944e5a9094dcf8460f2e9", async() => {
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1330, 112, true);
            WriteLiteral("\r\n<!--Add script to update the page and send messages.-->\r\n<script type=\"text/javascript\">\r\n\r\n    var userId = \'");
            EndContext();
            BeginContext(1443, 6, false);
#line 51 "C:\Users\HKD44\Documents\GitHub\NetConnect\NetConnect.Hosting.App1\Views\Home\Index.cshtml"
            Write(userId);

#line default
#line hidden
            EndContext();
            BeginContext(1449, 3525, true);
            WriteLiteral(@"';

    document.addEventListener('DOMContentLoaded', function () {

        var messageInput = document.getElementById('message');
        var uri = '/chat';
        var name = 'App1';

        messageInput.focus();

        var connection = new signalR.HubConnectionBuilder()
            .withUrl(uri)
            .build();

        connection.on('broadcastMessage', function (name, message) {
            // Html encode display name and message.

            var encodedName = name;
            var encodedMsg = message;

            var incomingMessage = '<div class=""incoming_msg"">' +
               '<div class=""received_msg"">' +
                    '<div class=""received_withd_msg"">' +
                '<p>' +
                message +
                                '</p>' +
                        '<span class=""time_date""> </span>' +
                    '</div>' +
                        '</div >' +
                '</div >';

            var outgoingMessage = ' <div class=""outgo");
            WriteLiteral(@"ing_msg"">' +
               ' < div class=""sent_msg"" >' +
                    '<p>' +
                    message +
                            '</p>' +
                    '<span class=""time_date""></span>' +
                        '</div >' +
                    '</div >';

            //incomingMessage
            var incomingMessageElement = document.createElement('div');
            incomingMessageElement.innerHTML = incomingMessage;
            document.getElementById('messages').appendChild(incomingMessageElement);
        });

        connection.on('onlineUsers', function (users) {
            console.log(users);
            $(""#users"").empty();

            users.forEach(function (entry) {
                console.log(entry);

                var nameLastname = entry.nameLastname;

                if (entry.userId != userId) {
                    var user = '******' +
                        '<div class=""chat_people"">' +
                        '");
            WriteLiteral(@"<div class=""chat_ib"">' +
                        '<h5>' + nameLastname + '<span class=""chat_date"">Çevrimiçi</span></h5>' +
                        '<p>' +
                        'Çevrimiçi' +
                        ' ' +
                        '</p>' +
                        '</div>' +
                        '</div>' +
                        '</div>';

                    var liElement = document.createElement('div');

                    liElement.innerHTML = user;

                    document.getElementById('users').appendChild(liElement);
                }

            });
        });

        // Transport fallback functionality is now built into start.
        connection.start()
            .then(function () {
                console.log(connection);

                console.log('connection started');
                //send message
                document.getElementById('sendmessage').addEventListener('click', function (event) {
                    // Call the Send meth");
            WriteLiteral(@"od on the hub.
                    connection.invoke('send', name, messageInput.value);

                    // Clear text box and reset focus for next comment.
                    messageInput.value = '';
                    messageInput.focus();
                    event.preventDefault();
                });

            })
            .catch(error => {
                console.error(error.message);
            });
    });
</script>
");
            EndContext();
        }
コード例 #2
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(0, 2, true);
            WriteLiteral("\r\n");
            EndContext();
#line 2 "C:\Users\HKD44\Documents\GitHub\NetConnect\NetConnect.Hosting.App2\Views\Home\Index.cshtml"

            ViewData["Title"] = "Index";
            Layout            = "~/Views/Shared/_Layout.cshtml";

#line default
#line hidden
            BeginContext(90, 2, true);
            WriteLiteral("\r\n");
            EndContext();
#line 7 "C:\Users\HKD44\Documents\GitHub\NetConnect\NetConnect.Hosting.App2\Views\Home\Index.cshtml"

            var userId = User.GetChatUsers().UserId;

#line default
#line hidden
            BeginContext(145, 43, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("link", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "58b3822cb31a4feebfc7db676dd524b4", async() => {
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(188, 1151, true);
            WriteLiteral(@"

<div class=""container"">
    <h3 class="" text-center"" id=""selectedUserText""></h3>
    <div class=""messaging"">
        <input type=""hidden"" id=""selectedUserId"" value=""0"" />
        <div class=""inbox_msg"">
            <div class=""inbox_people"">
                <div class=""headind_srch"">
                    <div class=""recent_heading"">
                        <h4>Kullanıcılar</h4>
                    </div>

                </div>
                <div class=""inbox_chat"" id=""users"">

                </div>
            </div>
            <div class=""mesgs"" id=""msgBox"" style=""display:none"">
                <div class=""msg_history"" id=""messages"">

                </div>
                <div class=""type_msg"">
                    <div class=""input_msg_write"">
                        <input type=""text"" id=""message"" class=""write_msg"" placeholder=""Mesajınız"" />
                        <button class=""msg_send_btn"" id=""sendmessage"" type=""button""><i class=""fa fa-paper-plane-o"" aria-hidden=""true""></");
            WriteLiteral("i></button>\r\n                    </div>\r\n                </div>\r\n            </div>\r\n        </div>\r\n\r\n    </div>\r\n</div>\r\n\r\n\r\n");
            EndContext();
            BeginContext(1339, 55, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "da6d76af6d784d1d94868bc7d5ab08d2", async() => {
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1394, 2, true);
            WriteLiteral("\r\n");
            EndContext();
            BeginContext(1396, 44, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "b5a840220c0e441ba8d5e6b51f265cda", async() => {
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1440, 2, true);
            WriteLiteral("\r\n");
            EndContext();
            BeginContext(1442, 33, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "398ff606036a4d45bc4329825d42afd8", async() => {
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1475, 57, true);
            WriteLiteral("\r\n\r\n<script type=\"text/javascript\">\r\n\r\n    var userId = \'");
            EndContext();
            BeginContext(1533, 6, false);
#line 51 "C:\Users\HKD44\Documents\GitHub\NetConnect\NetConnect.Hosting.App2\Views\Home\Index.cshtml"
            Write(userId);

#line default
#line hidden
            EndContext();
            BeginContext(1539, 40, true);
            WriteLiteral("\';\r\n\r\n    chatLoad(userId);\r\n\r\n</script>");
            EndContext();
        }