Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Skype.aspx.cs" Inherits="PlatformAdmin.Skype" %>
- <!DOCTYPE html>
- <%-- xmlns="http://www.w3.org/1999/xhtml" runat="server"--%>
- <html >
- <head >
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="description" content="">
- <meta name="author" content="">
- <title>Oztern</title>
- <!-- FAVICON -->
- <link rel="shortcut icon" href="img/favicon.ico">
- <!-- the jQuery library written by John Resig (MIT license) -->
- <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.1.min.js"></script>
- <!-- SkypeWebSDK Bootstrap Libray -->
- <script src="https://swx.cdn.skype.com/shared/v/1.1.23.0/SkypeBootstrap.min.js"></script>
- <!-- Bootstrap Core CSS -->
- <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
- <!-- Custom Fonts -->
- <link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
- <link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
- <link href='https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
- <!-- Plugin CSS -->
- <link href="vendor/magnific-popup/magnific-popup.css" rel="stylesheet">
- <!-- Theme CSS -->
- <link href="css/creative.min.css" rel="stylesheet">
- <link href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/css/bootstrap-select.min.css" rel="stylesheet">
- <link href="css/custom.css" rel="stylesheet">
- <style>
- input[type=date]::-webkit-inner-spin-button {
- -webkit-appearance: none;
- display: none;
- }
- .input {
- border: 1pt solid gray;
- padding: 2pt;
- overflow: hidden;
- white-space: nowrap;
- }
- .button {
- border: 1pt solid gray;
- cursor: pointer;
- padding: 2pt 5pt;
- margin-top:5px;
- display: inline-block;
- }
- .button:hover {
- background: lightgray;
- }
- .signinframe > .button {
- margin-top: 8pt;
- }
- .userdetails {
- border: 1pt solid lightgray;
- padding:5px;
- }
- .logoutbox, .loginbox {
- padding: 5px 0 10px 0;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <h2>Skype Web SDK Sending an Instant Message</h2>
- <div id="loginbox" class="loginbox input-group">
- <div>Login</div>
- <div id="address" contenteditable="true" class="input form-control"></div>
- <div>Password</div>
- <input type="text" id="password" name="password" class="input form-control" />
- <div id="signin" class="button">Sign In</div>
- </div>
- <div id="chatfunctions">
- <div class="row">
- <div class="col-md-6 col-sm-6 col-lg-6">
- <div class="input-group">
- <div id="the_message" contenteditable="true" class="input form-control"></div>
- <div id="send_message" class="input-group-addon btn btn-primary">Send</div>
- </div>
- <br />
- <div id="startChat" class="button">Start chatService</div>
- <div id="stopChat" class="button">Stop chatService</div>
- <br /><br />
- <div class="input-group">
- <div id="the_participant" contenteditable="true" class="input form-control"></div>
- <div id="add_participant" class="input-group-addon btn btn-primary">Add Participant</div>
- </div>
- <br />
- <div id="signout" class="button">Sign Out</div>
- </div>
- <div class="col-md-6 col-sm-6 col-lg-6">
- </div>
- </div>
- </div>
- <div class="small">
- <b>Event Logs</b><br />
- <div id="logging_box" contenteditable="false" class="code"></div>
- </div>
- </div>
- <!-- jQuery -->
- <script src="vendor/jquery/jquery.min.js"></script>
- <!-- Bootstrap Core JavaScript -->
- <script src="vendor/bootstrap/js/bootstrap.min.js"></script>
- <!-- Plugin JavaScript -->
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
- <script src="vendor/scrollreveal/scrollreveal.min.js"></script>
- <script src="vendor/magnific-popup/jquery.magnific-popup.min.js"></script>
- <!-- Theme JavaScript -->
- <script src="js/creative.min.js"></script>
- <script>
- $(document).ready(function () {
- if (parseInt(sessionStorage["UserRole"]) === 1) {
- $('#menu_report').show();
- }
- else {
- $('#menu_report').hide();
- }
- if (sessionStorage["UserRole"] === 0)
- {
- window.location = "/Login.aspx";
- }
- else if (sessionStorage["UserRole"] === undefined) {
- window.location = "/Login.aspx";
- }
- else if (sessionStorage["UserRole"] === "0") {
- window.location = "/Login.aspx";
- }
- $(".pop-up-close").click(function () {
- //$('html, body').css('overflow-y', 'auto');
- $(".position-login").hide(300);
- });
- sessionStorage["Page"] = "/ManageCourse.aspx";
- });
- /*
- Generic Functions
- */
- function log(texttolog) {
- var d = new Date();
- var time = padLeft(d.getHours(), 2) + ":" + padLeft(d.getMinutes(), 2) + ":" + padLeft(d.getSeconds(), 2) + ":" + padLeft(d.getMilliseconds(), 3);
- $('#logging_box').prepend(time + ": " + texttolog + "<br>");
- }
- function padLeft(nr, n, str) {
- return Array(n - String(nr).length + 1).join(str || '0') + nr;
- }
- /*
- How to send an Instant Message using the Skype Web SDK
- */
- $(function () {
- 'use strict';
- log("App Loaded");
- $('#chatfunctions').hide();
- var Application
- var client;
- var conversation;
- Skype.initialize({
- apiKey: 'SWX-BUILD-SDK',
- }, function (api) {
- Application = api.application;
- client = new Application();
- }, function (err) {
- log('some error occurred: ' + err);
- });
- log("Client Created");
- // when the user clicks the "Sign In" button
- $('#signin').click(function () {
- $('#signin').hide();
- log('Signing in...');
- // and invoke its asynchronous "signIn" method
- client.signInManager.signIn({
- username: $('#address').text(),
- password: $('#password').val()
- }).then(function () {
- log('Logged In Succesfully');
- $('#loginbox').hide();
- $('#chatfunctions').show();
- //create a new conversation
- log("Creating a new Conversation");
- conversation = client.conversationsManager.createConversation();
- }).then(null, function (error) {
- // if either of the operations above fails, tell the user about the problem
- log(error || 'Oops, Something went wrong.');
- $('#signin').show()
- });
- });
- $('#add_participant').click(function () {
- var the_participant = $('#the_participant').text();
- log("Adding the participant " + the_participant);
- conversation.addParticipant("sip:" + the_participant).then(function () {
- log(the_participant + " added!");
- }).then(null, function (error) {
- log("Error:" + error);
- });
- });
- $('#send_message').click(function () {
- var the_message = $('#the_message').text();
- if (the_message != "") {
- log('Sending message: ' + the_message);
- conversation.chatService.sendMessage(the_message).then(function () {
- log('Message sent.');
- }).then(null, function (error) {
- log('Error:' + error);
- });
- } else {
- log('<b><font color=red>Please enter a message to send!</font></b>');
- }
- });
- $('#startChat').click(function () {
- log('Starting chatService...');
- conversation.chatService.start().then(function () {
- log('chatService started!');
- $('#startChat').hide();
- }).then(null, function (error) {
- log('Error:' + error);
- });
- });
- $('#stopChat').click(function () {
- log('Stopping chatService...');
- conversation.chatService.stop().then(function () {
- log('chatService stopped.');
- $('#startChat').show();
- }).then(null, function (error) {
- log('Error:' + error);
- });
- });
- // when the user clicks on the "Sign Out" button
- $('#signout').click(function () {
- // start signing out
- log("Signing Out");
- client.signInManager.signOut().then(
- //onSuccess callback
- function () {
- // and report the success
- log('Signed out');
- $('#loginbox').show();
- $('#signin').show();
- $('#chatfunctions').hide();
- },
- //onFailure callback
- function (error) {
- // or a failure
- log(error || 'Cannot Sign Out');
- });
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement