private void UpdateMenuState()
 {
     if (axMesh != null)
     {
         // Disable/enable appropriate menu commands depending on Loudtalks Mesh network status
         PttLib.NETWORK_STATUS Status = axMesh.NetworkStatus;
         signInToolStripMenuItem.Enabled         = Status == PttLib.NETWORK_STATUS.NSOFFLINE;
         signOutToolStripMenuItem.Enabled        = Status == PttLib.NETWORK_STATUS.NSONLINE;
         historyToolStripMenuItem.Enabled        = Status == PttLib.NETWORK_STATUS.NSONLINE;
         changePasswordToolStripMenuItem.Enabled = Status == PttLib.NETWORK_STATUS.NSONLINE;
     }
 }
 private void buttonSignIn_Click(object sender, EventArgs e)
 {
     // "Sign in/Cancel" button was pressed
     // Sign into network if control is offline,
     // cancel if control is signing in.
     if (axMesh != null)
     {
         PttLib.NETWORK_STATUS Status = axMesh.NetworkStatus;
         if (PttLib.NETWORK_STATUS.NSSIGNINGIN == Status)
         {
             axMesh.Cancel();
         }
         else
         {
             signInToolStripMenuItem_Click(sender, e);
         }
     }
 }
 private void UpdateControlsState()
 {
     if (axMesh != null)
     {
         // Query Loudtalks Mesh network status
         PttLib.NETWORK_STATUS Status = axMesh.NetworkStatus;
         bool bShow   = Status == PttLib.NETWORK_STATUS.NSOFFLINE || Status == PttLib.NETWORK_STATUS.NSSIGNINGIN;
         bool bEnable = Status == PttLib.NETWORK_STATUS.NSOFFLINE;
         // Controls' state
         labelUsername.Visible = bShow;
         comboUsername.Visible = bShow;
         labelPassword.Visible = bShow;
         textPassword.Visible  = bShow;
         comboUsername.Enabled = bEnable;
         textPassword.Enabled  = bEnable;
         // Switch between "Sign in" and "Cancel" button modes
         if (Status == PttLib.NETWORK_STATUS.NSSIGNINGIN)
         {
             buttonSignIn.Text = "Cancel";
         }
         else
         {
             buttonSignIn.Text = "Sign in";
         }
         buttonSignIn.Visible = Status == PttLib.NETWORK_STATUS.NSOFFLINE || Status == PttLib.NETWORK_STATUS.NSSIGNINGIN;
         // Mesh control location
         Point pt = new Point(0, 0);
         if (Status == PttLib.NETWORK_STATUS.NSOFFLINE || Status == PttLib.NETWORK_STATUS.NSSIGNINGIN)
         {
             pt.Y = buttonSignIn.Location.Y + buttonSignIn.Size.Height;
         }
         else
         {
             pt.Y = 0;
         }
         Size sz = ClientRectangle.Size;
         sz.Height      -= pt.Y;
         axMesh.Location = pt;
         axMesh.Size     = sz;
     }
 }
Ejemplo n.º 4
0
        private void UpdateControlsState()
        {
            if (axMesh != null)
            {
                // Query Loudtalks Mesh network status
                PttLib.NETWORK_STATUS Status = axMesh.NetworkStatus;
                bool bShow   = Status == PttLib.NETWORK_STATUS.NSOFFLINE || Status == PttLib.NETWORK_STATUS.NSSIGNINGIN;
                bool bEnable = Status == PttLib.NETWORK_STATUS.NSOFFLINE;

                if (axMesh.Visible == bShow)
                {
                    axMesh.Dock    = DockStyle.None;
                    axMesh.Dock    = DockStyle.Fill;
                    axMesh.Visible = !bShow;
                    //split.Invalidate();
                    Invalidate(true);
                    split.Panel1.Refresh();
                }

                if (false == bShow)
                {
                    if (split.Panel2Collapsed)
                    {
                        split.Panel2Collapsed  = false;
                        ClientSize             = new Size(ClientSize.Width + 300, ClientSize.Height);
                        split.SplitterDistance = ClientSize.Width - 300;
                    }
                }
                else
                {
                    if (false == split.Panel2Collapsed)
                    {
                        Size sz = new Size(ClientSize.Width - split.Panel2.Width - split.SplitterWidth, ClientSize.Height);
                        split.Panel2Collapsed = true;
                        ClientSize            = sz;
                    }
                }

                // Controls' state
                labelUsername.Visible = bShow;
                comboUsername.Visible = bShow;
                labelPassword.Visible = bShow;
                textPassword.Visible  = bShow;
                comboUsername.Enabled = bEnable;
                textPassword.Enabled  = bEnable;
                // Switch between "Sign in" and "Cancel" button modes
                if (Status == PttLib.NETWORK_STATUS.NSSIGNINGIN)
                {
                    buttonSignIn.Text = "Cancel";
                }
                else
                {
                    buttonSignIn.Text = "Sign in";
                }
                buttonSignIn.Visible = Status == PttLib.NETWORK_STATUS.NSOFFLINE || Status == PttLib.NETWORK_STATUS.NSSIGNINGIN;
                // Mesh control location
                Point pt = menu.Location;
                if (Status == PttLib.NETWORK_STATUS.NSOFFLINE || Status == PttLib.NETWORK_STATUS.NSSIGNINGIN)
                {
                    pt.Y = buttonSignIn.Location.Y + buttonSignIn.Size.Height;
                }
                else
                {
                    pt.Y = menu.Location.Y + menu.Size.Height;
                }
                //Size sz = ClientRectangle.Size;
                //sz.Height -= pt.Y;
                //axMesh.Location = pt;
                //axMesh.Size = sz;
            }
        }