Ejemplo n.º 1
0
        private async Task EstablishCollaborationPlatform()
        {
            string userAgent        = "IFTTT/Email Lync Instant Message Sender";
            var    platformSettings = new ClientPlatformSettings(userAgent, Microsoft.Rtc.Signaling.SipTransportType.Tls);

            try
            {
                Console.WriteLine("Trying to start collab platform");
                _collabPlatform = new CollaborationPlatform(platformSettings);
                _collabPlatform.ProvisioningFailed           += _collabPlatform_ProvisioningFailed;
                _collabPlatform.AllowedAuthenticationProtocol = Microsoft.Rtc.Signaling.SipAuthenticationProtocols.Ntlm;
                await _collabPlatform.StartupAsync();

                _endpointStarted = true;
                Console.WriteLine("Collab Platform Started.");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error starting collab platform");
                Console.WriteLine(ex.ToString());
                if (ex.InnerException != null)
                {
                    Console.WriteLine(ex.InnerException.ToString());
                }
                else
                {
                    Console.WriteLine("Inner exception is empty");
                }
            }
        }
Ejemplo n.º 2
0
        private async Task EstablishCollaborationPlatform()
        {
            string userAgent = "IFTTT/Email Lync Instant Message Sender";
            var platformSettings = new ClientPlatformSettings(userAgent, Microsoft.Rtc.Signaling.SipTransportType.Tls);

            try
            {
                Console.WriteLine("Trying to start collab platform");
                _collabPlatform = new CollaborationPlatform(platformSettings);
                _collabPlatform.ProvisioningFailed += _collabPlatform_ProvisioningFailed;
                _collabPlatform.AllowedAuthenticationProtocol = Microsoft.Rtc.Signaling.SipAuthenticationProtocols.Ntlm;
                await _collabPlatform.StartupAsync();
                _endpointStarted = true;
                Console.WriteLine("Collab Platform Started.");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error starting collab platform");
                Console.WriteLine(ex.ToString());
                if (ex.InnerException != null)
                {
                    Console.WriteLine(ex.InnerException.ToString());
                }
                else
                {
                    Console.WriteLine("Inner exception is empty");
                }
            }


            
        }
 public async Task Start()
 {
     try
     {
         Console.WriteLine("Starting Collaboration Platform");
         ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings(_appUserAgent, _appID);
         _collabPlatform = new CollaborationPlatform(settings);
         _collabPlatform.RegisterForApplicationEndpointSettings(OnNewApplicationEndpointDiscovered);
         await _collabPlatform.StartupAsync();
         Console.WriteLine("Platform Started");
     }
     catch (Exception ex)
     {
         Console.WriteLine("Error establishing collaboration platform: {0}", ex.ToString());
     }
 }
Ejemplo n.º 4
0
        public async Task Start()
        {
            try
            {
                Console.WriteLine("Starting Collaboration Platform");
                ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings(_appUserAgent, _appID);
                _collabPlatform = new CollaborationPlatform(settings);
                _collabPlatform.RegisterForApplicationEndpointSettings(OnNewApplicationEndpointDiscovered);
                await _collabPlatform.StartupAsync();

                Console.WriteLine("Platform Started");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error establishing collaboration platform: {0}", ex.ToString());
            }
        }
Ejemplo n.º 5
0
        protected override async void OnStart(string[] args) {
            if (!Directory.Exists(Path.Combine(ZMachineSettings.AppDataFolder, "Saves"))) {
                Directory.CreateDirectory(Path.Combine(ZMachineSettings.AppDataFolder, "Saves"));
            }
            if (!Directory.Exists(Path.Combine(ZMachineSettings.AppDataFolder, "Games"))) {
                Log.Warn("No Z-Machine games included");
                Directory.CreateDirectory(Path.Combine(ZMachineSettings.AppDataFolder, "Games"));
            } else {
                if (!Directory.GetFiles(Path.Combine(ZMachineSettings.AppDataFolder, "Games")).Any()) {
                    Log.Warn("No Z-Machine games included");
                }
            }


            var clientPlatformSettings = new ClientPlatformSettings("LyncZMachine", SipTransportType.Tls);
            _collabPlatform = new CollaborationPlatform(clientPlatformSettings);
            await _collabPlatform.StartupAsync();

            _settings = new UserEndpointSettings(
                ZMachineSettings.Settings.Sip,
                ZMachineSettings.Settings.LyncServer
                //ConfigurationManager.AppSettings["sip"], 
                //ConfigurationManager.AppSettings["LyncServer"]
            ) {
                Credential = new NetworkCredential(
                    ZMachineSettings.Settings.Username,
                    ZMachineSettings.Settings.Password,
                    ZMachineSettings.Settings.Domain
                    //ConfigurationManager.AppSettings["username"], 
                    //ConfigurationManager.AppSettings["pw"], 
                    //ConfigurationManager.AppSettings["domain"]
                ),
                AutomaticPresencePublicationEnabled = true
            };
            _settings.Presence.UserPresenceState = PresenceState.UserAvailable;

            _endpoint = new UserEndpoint(_collabPlatform, _settings);
            await _endpoint.EstablishAsync();

            _endpoint.RegisterForIncomingCall<InstantMessagingCall>(GameStarted);

            _webServer = WebApp.Start<Startup>(string.Format("http://+:{0}/ZMachine", ZMachineSettings.Settings.Port));
        }
Ejemplo n.º 6
0
        private async void btnTest_Click(object sender, EventArgs e) {
            try {
                Cursor = Cursors.WaitCursor;
                var clientPlatformSettings = new ClientPlatformSettings("LyncZMachine", SipTransportType.Tls);
                var collabPlatform = new CollaborationPlatform(clientPlatformSettings);
                await collabPlatform.StartupAsync();

                var settings = new UserEndpointSettings(txtSip.Text, txtServer.Text) {
                    Credential = new NetworkCredential(txtUsername.Text, txtPassword.Text, txtDomain.Text),
                    AutomaticPresencePublicationEnabled = true
                };

                var endpoint = new UserEndpoint(collabPlatform, settings);

                await endpoint.EstablishAsync();
                btnSave.Enabled = true;
                MessageBox.Show("Connected successfully to " + txtServer.Text + " as " + txtSip.Text);
                try {
                    await endpoint.TerminateAsync();
                    await collabPlatform.ShutdownAsync();
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message, "An Error Occurred", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

            } catch (Exception ex) {
                MessageBox.Show(ex.Message, "An Error Occurred", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                btnSave.Enabled = false;
            } finally {
                Cursor = Cursors.Default;
            }
        }