Ejemplo n.º 1
0
        private void Login()
        {
            client = new SF.ClientLibrary.SpaceClient();
            var credentials = PredefinedIdShip;

            if (credentials == 0)
            {
                credentials = LogonDialog.Execute(client.GetShipRegistry());
            }
            bool okay = credentials != 0 && client.Login(credentials);

            if (!okay)
            {
                Close();
                return;
            }
            if (ControlMode.None != PredefinedControlMode)
            {
                btnMode.Visible       = false;
                spaceGridControl.Mode = PredefinedControlMode;
            }
            else
            {
                spaceGridControl.Mode = ControlMode.Tactic;
            }
            spaceGridControl.Universe   = client.Universe;
            spaceGridControl.WorldScale = client.Universe.Constants.DefaultScale;
            toolStrip.Visible           = true;
            spaceGridControl.Visible    = true;
            timerUpdate.Enabled         = true;
            timerUpdate_Tick(this, EventArgs.Empty);
        }
Ejemplo n.º 2
0
        void OnLogon(object sender, EventArgs e)
        {
            LogonDialog dialog = new LogonDialog(m_NamespaceTextBox.Text, DefaultIssuer);

            dialog.ShowDialog();

            string serviceNamespace = m_NamespaceTextBox.Text;

            Graphs[serviceNamespace.ToLower()] = new ServiceBusGraph(serviceNamespace, dialog.Issuer, dialog.Secret);
        }
        public void LogonDialogTest()
        {
            // TODO: Remove this line once you have updated this test with Url, UserName and Password
            throw new NotImplementedException(
                      "LogonDialog() test method needs to be updated with a Url/UserName & Password before you can execute it!");

            // Add a logon dialog support with username/password
            Manager.DialogMonitor.AddDialog(LogonDialog.CreateLogonDialog(ActiveBrowser, "<username>", "<password>", DialogButton.OK));
            Manager.DialogMonitor.Start();

            // Navigate to a page that need a logon
            ActiveBrowser.NavigateTo("<Place a Url to LogOn to here>");
        }
Ejemplo n.º 4
0
        private void Login()
        {
            client = new SF.ClientLibrary.SpaceClient();
            var credentials = LogonDialog.Execute(client.GetShipNames());

            if (credentials == null)
            {
                Close();
            }
            else
            {
                client.Login(credentials.Nation, credentials.ShipName);
                helm = client.GetHelm();
                Text = helm.Name;
                spaceGridControl.OwnShip    = helm;
                spaceGridControl.WorldScale = Catalog.Instance.DefaultScale;
                scaleControl.Value          = Catalog.Instance.DefaultScale;;
                tableLayoutPanel.Visible    = true;
                timerUpdate.Enabled         = true;
            }
        }
Ejemplo n.º 5
0
        public static Uri Run(MainWindow owner)
        {
            var dialog = new LogonDialog();

            var model = new LogonModel();

            var viewModel = new LogonViewModel(model);

            dialog.Owner = owner;

            dialog.DataContext = viewModel;

            dialog.OnLoadCompleted += (s, e) =>
            {
                model.Uri = e.Item;

                dialog.Close();
            };

            dialog.ShowDialog();

            return(model.Uri);
        }
Ejemplo n.º 6
0
        public static Uri Run(MainWindow owner)
        {
            var dialog = new LogonDialog();

            var model = new LogonModel();

            var viewModel = new LogonViewModel(model);

            dialog.Owner = owner;

            dialog.DataContext = viewModel;

            dialog.OnLoadCompleted += (s, e) =>
            {
                model.Uri = e.Item;

                dialog.Close();
            };

            dialog.ShowDialog();

            return model.Uri;
        }
Ejemplo n.º 7
0
        public void OnExplore(object sender, EventArgs e)
        {
            Cursor currentCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = false;

            string serviceNamespace = m_NamespaceTextBox.Text;

            if (String.IsNullOrEmpty(serviceNamespace))
            {
                MessageBox.Show("You need to provide a service namespace", "Service Bus Explorer", MessageBoxButtons.OK, MessageBoxIcon.Error);
                m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = true;

                Cursor.Current = currentCursor;

                return;
            }

            if (Graphs.ContainsKey(serviceNamespace.ToLower()) == false)
            {
                LogonDialog dialog = new LogonDialog(m_NamespaceTextBox.Text, DefaultIssuer);
                dialog.ShowDialog();

                if (dialog.Secret == null)
                {
                    m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = true;
                    Cursor.Current = currentCursor;

                    return;
                }
                try
                {
                    Graphs[serviceNamespace.ToLower()] = new ServiceBusGraph(serviceNamespace, dialog.Issuer, dialog.Secret);
                }
                catch (Exception exception)
                {
                    MessageBox.Show("Invalid namespace name: " + exception.Message, "Service Bus Explorer", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = true;
                    Cursor.Current = currentCursor;
                    return;
                }
            }

            SplashScreen splash = new SplashScreen(Resources.Progress);

            try
            {
                Application.DoEvents();

                ServiceBusNode[] nodes = Graphs[serviceNamespace.ToLower()].Discover();

                AddNodesToTree(m_ServiceBusTree, nodes);

                DisplayNamespaceControl(serviceNamespace);
            }
            catch (Exception exception)
            {
                MessageBox.Show("Some error occurred discovering the service namespace: " + exception.Message, "Service Bus Explorer", MessageBoxButtons.OK, MessageBoxIcon.Error);

                for (int index = 0; index < m_ServiceBusTree.Nodes.Count; index++)
                {
                    if (m_ServiceBusTree.Nodes[index].Text == serviceNamespace)
                    {
                        m_ServiceBusTree.Nodes.Add(new NamespaceTreeNode(this, serviceNamespace, ServiceError));
                        m_ServiceBusTree.Nodes.RemoveAt(index);
                        break;
                    }
                }
            }
            finally
            {
                splash.Close();
                m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = true;
                Cursor.Current = currentCursor;
            }
        }
Ejemplo n.º 8
0
      void OnLogon(object sender,EventArgs e)
      {
         LogonDialog dialog = new LogonDialog(m_NamespaceTextBox.Text,DefaultIssuer);
         dialog.ShowDialog();

         string serviceNamespace = m_NamespaceTextBox.Text;

         Graphs[serviceNamespace.ToLower()] = new ServiceBusGraph(serviceNamespace,dialog.Issuer,dialog.Secret);
      }
Ejemplo n.º 9
0
      public void OnExplore(object sender,EventArgs e)
      {
         Cursor currentCursor = Cursor.Current;
         Cursor.Current = Cursors.WaitCursor;

         m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = false;
         
         string serviceNamespace = m_NamespaceTextBox.Text;

         if(String.IsNullOrEmpty(serviceNamespace))
         {
            MessageBox.Show("You need to provide a service namespace","Service Bus Explorer",MessageBoxButtons.OK,MessageBoxIcon.Error);
            m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = true;

            Cursor.Current = currentCursor;

            return;
         }

         if(Graphs.ContainsKey(serviceNamespace.ToLower()) == false)
         {
            LogonDialog dialog = new LogonDialog(m_NamespaceTextBox.Text,DefaultIssuer);
            dialog.ShowDialog();

            if(dialog.Secret == null)
            {
               m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = true;
               Cursor.Current = currentCursor;

               return;
            }
            try
            {
               Graphs[serviceNamespace.ToLower()] = new ServiceBusGraph(serviceNamespace,dialog.Issuer,dialog.Secret);
            }
            catch(Exception exception)
            {
               MessageBox.Show("Invalid namespace name: " + exception.Message,"Service Bus Explorer",MessageBoxButtons.OK,MessageBoxIcon.Error);
               m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = true;
               Cursor.Current = currentCursor;
               return;
            }
         }
          
         SplashScreen splash = new SplashScreen(Resources.Progress);         

         try
         {
            Application.DoEvents();

            ServiceBusNode[] nodes = Graphs[serviceNamespace.ToLower()].Discover();

            AddNodesToTree(m_ServiceBusTree,nodes);

            DisplayNamespaceControl(serviceNamespace);
         }
         catch(Exception exception)
         {
            MessageBox.Show("Some error occurred discovering the service namespace: " + exception.Message,"Service Bus Explorer",MessageBoxButtons.OK,MessageBoxIcon.Error);

            for(int index = 0;index < m_ServiceBusTree.Nodes.Count;index++)
            {
               if(m_ServiceBusTree.Nodes[index].Text == serviceNamespace)
               {
                  m_ServiceBusTree.Nodes.Add(new NamespaceTreeNode(this,serviceNamespace,ServiceError));
                  m_ServiceBusTree.Nodes.RemoveAt(index);
                  break;
               }
            }
         }
         finally
         {
            splash.Close();
            m_ExploreToolStripMenuItem.Enabled = m_ExploreButton.Enabled = true;
            Cursor.Current = currentCursor;
         }
      } 
Ejemplo n.º 10
0
        private void _logonButton_Click(object sender, EventArgs e)
        {
            var logonResult = LogonDialog.Show(this, "Logon", "Logon to Cranewatch", Authenticator);

            _outputTextWriter.WriteLine("LogonResult = {0}, UserObject = {1}", logonResult.ResultCode, logonResult.UserObject ?? "(None)");
        }