GECKOFX VALIDAR CERTIFICADO

'Añadir evento al iniciar el formulario
  AddHandler CertOverrideService.GetService().ValidityOverride, AddressOf CertOverrideService_ValidityOverride

Sub CertOverrideService_ValidityOverride(sender As Object, e As Gecko.Events.CertOverrideEventArgs)
        e.OverrideResult = CertOverride.Mismatch Or CertOverride.Time Or CertOverride.Untrusted
        e.Temporary = True
        e.Handled = True
    End Sub

Private Sub GeckoWebBrowser1_NSSError(sender As Object, e As Events.GeckoNSSErrorEventArgs) Handles GeckoWebBrowser1.NSSError
        CertOverrideService.GetService().RememberRecentBadCert(e.Uri, e.SSLStatus)
        Dim refUrl As Uri = GeckoWebBrowser1.Url
        GeckoWebBrowser1.Navigate(e.Uri.AbsoluteUri, GeckoLoadFlags.FirstLoad, refUrl.AbsoluteUri, Nothing)
        e.Handled = True

    End Sub

https://bitbucket.org/geckofx/geckofx-33.0/issues/5/uses-an-invalid-security-certificate

COLOR HEXADECIMAL A CÓDIGO .NET

Dim b As New Button

b.BackColor = System.Drawing.ColorTranslator.FromHtml("#FF5157")

GECKOFX

Instalar el paquete Nuget de GeckoFX https://www.nuget.org/packages/GeckoFX/ o referenciar las dlls Geckofx-Core y Geckofx-Winforms.
En la barra de herramientas, elegir elementos ... seleccionar la dll Geckofx-Winforms.dll y ya dispondremos de GeckoWebBrowser para añadirlo al diseñador.

Sub New()
        InitializeComponent()
        Xpcom.Initialize("Firefox")
End Sub

Private Sub GeckoWebBrowser1_DocumentCompleted(sender As Object, e As Gecko.Events.GeckoDocumentCompletedEventArgs) Handles GeckoWebBrowser1.DocumentCompleted
     With GeckoWebBrowser1

         'login
         If .Document.GetElementById("idpage").GetAttribute("value") = "login" Then
             'inyectamos script para validarnos
             Dim script = .Document.CreateElement("script")
             script.TextContent = "function logon(){" & _
                 "document.getElementById('username').value = 'myuser';" & _
                 "document.getElementById('password').value = 'mypassword'" & _
                 ";document.getElementById('login_form').submit();}"
             .Document.GetElementsByTagName("head").First().AppendChild(script)
             .Navigate("javascript:void(logon())")
         End If

     End With

  End Sub

APLICACIÓN WPF MULTIIDIOMA

Add / New Item / Resource Dictionary (WPF) à Strings.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">

    <system:String x:Key="ResourceDictionaryName">Loc-en-US</system:String>
    <system:String x:Key="Price">Price</system:String>
    <system:String x:Key="Quantity_short">Qty.</system:String>
    <system:String x:Key="Discount_short">Disc.</system:String>
   
</ResourceDictionary>

Add / New Item / Resource Dictionary (WPF) à Strings.es-ES.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">

    <system:String x:Key="ResourceDictionaryName">Loc-es-ES</system:String>
    <system:String x:Key="Price">Precio</system:String>
    <system:String x:Key="Quantity_short">Cant.</system:String>
    <system:String x:Key="Discount_short">Desc.</system:String>
   
</ResourceDictionary>

En XAML de la pantalla à
<Button x:Name="btPrice" Content="{DynamicResource Price}">
<Button x:Name="btQty" Content="{DynamicResource Quantity_short}"
<Button x:Name="btDisc" Content="{DynamicResource Discount_short}">

Crear la función para detectr el idioma del equipo y llamarla en Loadded de la pantalla principal del programa à
Private Sub SetLanguageDictionary()
        Dim dict As New ResourceDictionary()
        Select Case System.Threading.Thread.CurrentThread.CurrentCulture.ToString()
            Case "es-ES"
                dict.Source = New Uri("Multilanguage\Strings.es-ES.xaml", UriKind.Relative)
                Exit Select
            Case Else
                dict.Source = New Uri("Multilanguage\Strings.xaml", UriKind.Relative)
                Exit Select
        End Select
        Me.Resources.MergedDictionaries.Add(dict)
       

  End Sub

SignalR - SERVIDOR Y CLIENTE CON USUARIOS REGISTRADOS

// Proyecto Servidor ------------------>
using Microsoft.AspNet.SignalR;
using Microsoft.Owin.Cors;
using Microsoft.Owin.Hosting;
using Owin;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SignalRChat
{

    public partial class PushSignalRServer : Form
    {

        private IDisposable SignalR { get; set; }
        const string ServerURI ="https://+:8082"; //--> puerto de escucha del servidor

        public List<ConnectedClients> ConnectedUsers = new List<ConnectedClients>();
      
        internal PushSignalRServer()
        {
            InitializeComponent();
        }

        private void ButtonStart_Click(object sender, EventArgs e)
        {
            WriteToConsole("Starting server..." + DateTime.Now.ToString("dd/MM/yyyy HH:mm"CultureInfo.CreateSpecificCulture("es-ES")) );
            ButtonStart.Enabled = false;
            Task.Run(() => StartServer());
        }
            
             
        private void StartServer()
        {
            try
            {
                SignalR = WebApp.Start(ServerURI);
            }
            catch (TargetInvocationException)
            {
                WriteToConsole("Server failed to start. A server is already running on " + ServerURI);
                     this.Invoke((Action)(() => ButtonStart.Enabled = true));
                return;
            }
            this.Invoke((Action)(() => ButtonStop.Enabled = true));
            WriteToConsole("Server started at " + ServerURI);
            notifyIconOff.Visible = false ;
            notifyIconOn.Visible = true ;
        }
     
        internal void WriteToConsole(String message)
        {
            if (RichTextBoxConsole.InvokeRequired)
            {
                this.Invoke((Action)(() =>
                    WriteToConsole(message)
                ));
                return;
            }

            RichTextBoxConsole.AppendText(message + Environment.NewLine);
        }

        private void WinFormsServer_FormClosing(object sender, FormClosingEventArgs e)
        {
           
            if (SignalR != null)
            {
                SignalR.Dispose();
            }
        }

        private void WinFormsServer_Load(object sender, EventArgs e)
        {
                      
            WriteToConsole("Starting server..." + DateTime.Now.ToString("dd/MM/yyyy HH:mm", CultureInfo.CreateSpecificCulture("es-ES")));
            ButtonStart.Enabled = false;
            Task.Run(() => StartServer());
        }

       
    }

    class Startup
    {
        public void Configuration(IAppBuilder app)
        {
           app.UseCors(CorsOptions.AllowAll);
           app.MapSignalR();
        }
    }
  
    public class MyHub : Hub
    {

     //Función para enviar mensaje de usuario emisor (nombre y compañia) a usuario receptor (nombre y compañia)
     public void Send(string nameFrom, string companyFrom, string message, string nameTo, string companyTo)
        {
           
            if (nameTo.ToUpper() == "ALL" || nameTo.ToUpper() == "TODOS")
                {
                  
                         Send(nameFrom, message);
                }
                else
                {
               
                    if (Program.MainForm.ConnectedUsers != null)
                    {
                       var exists =
                       from ConnectedClients e in Program.MainForm.ConnectedUsers
                       where e.Name == nameTo && e.Company == companyTo
                       select e;

                       if (exists.Count() == 0)
                        {
                        }
                        else
                        {
                            foreach (var UserExist in exists)
                            {
                                Clients.Client(UserExist.Id).addMessage(nameFrom, message);
                            }
                        }
                    }
                    else
                    {
                    }
                }
        }

        public override Task OnConnected()
        {
                               
            return base.OnConnected();
        }

         public override Task OnDisconnected(bool stopCalled)
        {
            var exists =
                from ConnectedClients e in Program.MainForm.ConnectedUsers
                where e.Id == Context.ConnectionId
                select e;
            if (exists.Count() == 0)
            {
            }
            else
            {
                foreach (var UserExist in exists)
                {
                    Program.MainForm.WriteToConsole("Client disconnected: " + UserExist.Name);
                }
            }

            Program.MainForm.ConnectedUsers.RemoveAll(u => u.Id == Context.ConnectionId);

            return base.OnDisconnected(true);
        }

        //Función para identificar al usuario en servidor (añadir al cliente a la lista ConnectedClients) -->
        public void WhoIam(string MyName, string MyCompany)
        {
            if (string.IsNullOrEmpty(MyCompany))
            {
            }
            else
            {
                if (MyCompany.Substring(MyCompany .Length -1)==".")
                {
                    MyCompany = MyCompany.Substring(0, MyCompany.Length - 1);
                }
            }
           
               if (Program.MainForm.ConnectedUsers != null)
                {
                    if (Program.MainForm.ConnectedUsers.Count()> 0 )
                    {
                            var exists =
                            from ConnectedClients e in Program.MainForm.ConnectedUsers
                            where e.Name == MyName && e.Company == MyCompany && e.Id != Context.ConnectionId
                            select e;

                            if (exists.Count() > 0)
                            {
                                Program.MainForm.ConnectedUsers.RemoveAll(u => u.Name == MyName);
                                addConnectedUsers(MyName, MyCompany);
                            }
                            else
                           {
                                addConnectedUsers(MyName, MyCompany);
                           }
                    }
                    else
                    {
                        addConnectedUsers(MyName, MyCompany);
                    }
                }
                else
                {
                    addConnectedUsers(MyName, MyCompany);
                }
        }

        private void addConnectedUsers(string Name, string Company)
        {

            ConnectedClients newUser = new ConnectedClients();
            newUser.Id = Context.ConnectionId;
            newUser.Name = Name;
            newUser.Company = Company;
            newUser.TimeStamp = DateTime.Now;

            Program.MainForm.ConnectedUsers.Add(newUser);

            Program.MainForm.WriteToConsole("Client connected: " + Name);
        }

        public void Send(string name, string message)
        {
            Clients.All.addMessage(name, message);
        }

    }

   
    public class ConnectedClients
    {
        public string Id { get; set; }
        public string Name { get; set; }
        public string Company { get; set; }
        public DateTime TimeStamp { get; set; }
              
    }
}

//Proyecto Cliente ------------à
using Microsoft.AspNet.SignalR.Client;
using System;
using System.Net.Http;
using System.Windows.Forms;

namespace WinFormsClient
{
    public partial class WinFormsClient : Form
    {

        private String UserName { get; set; }
        private String CompanyName { get; set; }
        private IHubProxy HubProxy { get; set; }
        const string ServerURI = "https://miservidor.net:8082/signalr";

        private HubConnection Connection { get; set; }

        internal WinFormsClient()
        {
            InitializeComponent();
        }
       

        private async void ConnectAsync()
        {
            Connection = new HubConnection(ServerURI);
            Connection.Closed += Connection_Closed;
            HubProxy = Connection.CreateHubProxy("MyHub");

            HubProxy.On<string, string>("AddMessage", (name, message) =>
                this.Invoke((Action)(() =>
                    RichTextBoxConsole.AppendText(String.Format("{0}: {1}" + Environment.NewLine, name, message))
                ))
            );

            try
            {
                await Connection.Start();
            }
            catch (HttpRequestException)
            {
                StatusText.Text = "Unable to connect to server: Start server before connecting clients.";
                //No connection
                return;
            }

            SignInPanel.Visible = false;
            ChatPanel.Visible = true;
            ButtonSend.Enabled = true;
            TextBoxMessage.Focus();
            RichTextBoxConsole.AppendText("Connected to server at " + ServerURI + Environment.NewLine);
            identify();
        }

        private void identify() //Me identifico (UserName + CompanyName)
        {
            HubProxy.Invoke("WhoIam", UserName, CompanyName);
            this.Text = UserName + "(" + CompanyName + ")";
        }

        private void Connection_Closed()
        {

            this.Invoke((Action)(() => ChatPanel.Visible = false));
            this.Invoke((Action)(() => ButtonSend.Enabled = false));
            this.Invoke((Action)(() => StatusText.Text = "You have been disconnected."));
            this.Invoke((Action)(() => SignInPanel.Visible = true));
        }

        //Este Botón permite conectarme al servidor
        private void SignInButton_Click(object sender, EventArgs e)
        {
            UserName = UserNameTextBox.Text;
            CompanyName = CompanyTextbox.Text;
            //Connect to server (use async method to avoid blocking UI thread)
            if (!String.IsNullOrEmpty(UserName) && !String.IsNullOrEmpty(CompanyName))
            {
                StatusText.Visible = true;
                StatusText.Text = "Connecting to server...";
                ConnectAsync();
            }
        }

        private void WinFormsClient_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (Connection != null)
            {
                Connection.Stop();
                Connection.Dispose();
            }
        }

        //Enviar mensaje --->;
        private void ButtonSend_Click(object sender, EventArgs e)
        {
            //Invocamos a Send identificándonos (usuario y empresa) e identificando al receptor (usuario y empresa)
            HubProxy.Invoke("Send", UserName, CompanyName, TextBoxMessage.Text, txtPara.Text, txtCompany.Text.Trim());
            TextBoxMessage.Text = String.Empty;
            TextBoxMessage.Focus();
        }

    }