Example #1
0
 private void ItmAuthenticateGrant_Click(object sender, EventArgs e)
 {
     try
     {
         //test authentication
         var testLogin = ArcLogin.TestLogin();
         if (testLogin)
         {
             UiMessages.Warning(@"Authentication failed: user is already authenticated");
         }
         else if (Global.InitToken == null)
         {
             var loginSuccess = LoginForm.ShowLogin();
             if (loginSuccess)
             {
                 UpdateUIAuthenticate(true);
                 UiMessages.Info(@"Successfully authenticated user");
             }
             else
             {
                 UiMessages.Warning(@"Authentication failed: login was unsuccessful");
             }
         }
         else
         {
             UiMessages.Warning(@"Authentication failed: login data already initialised");
         }
     }
     catch (Exception ex)
     {
         UiMessages.Error(ex.ToString());
     }
 }
Example #2
0
 private void ItmAuthenticateRevoke_Click(object sender, EventArgs e)
 {
     try
     {
         //test authentication
         var testLogin = ArcLogin.TestLogin();
         if (!testLogin)
         {
             UiMessages.Warning(@"Revocation failed: login not yet initiated");
         }
         else if (Global.InitToken != null)
         {
             var logoutSuccess = Global.InitToken.Revoke();
             if (logoutSuccess)
             {
                 UpdateUIAuthenticate();
                 Global.InitToken = null;
                 UiMessages.Info(@"Successfully logged user out");
             }
             else
             {
                 UiMessages.Warning(@"Revocation failed: logout was unsuccessful");
             }
         }
         else
         {
             UiMessages.Warning(@"Revocation failed: login data not yet initiated");
         }
     }
     catch (Exception ex)
     {
         UiMessages.Error(ex.ToString());
     }
 }
Example #3
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txtPassword.Text) && !string.IsNullOrWhiteSpace(txtUsername.Text))
            {
                if (ArcLogin.DoLogin(new ArcCredential(txtUsername.Text, txtPassword.Text)))
                {
                    Success = true;

                    /*MessageBox.Show(@"Success!", @"Message",
                     *  MessageBoxButtons.OK, MessageBoxIcon.Information); */
                    DialogResult = DialogResult.OK;
                    Close();
                }
                else
                {
                    MessageBox.Show(@"Login failed; check values and try again.", @"Login Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show(@"Please correctly enter all required values", @"Validation Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
        private void ItmFetchFromModem_Click(object sender, EventArgs e)
        {
            try
            {
                //test authentication
                var success = ArcLogin.IsAuthenticated();

                if (success)
                {
                    var cfg  = new CgiConfigFile();
                    var file = cfg.GrabFile();

                    if (file != null)
                    {
                        if (file.Length > 0)
                        {
                            ArcArchive.ProcessConfigArchive(file);

                            //update UI
                            LoadTreeView(ArcArchive.ExtractDir);
                        }
                        else
                        {
                            UiMessages.Warning(@"Configuration file from modem returned 0 bytes; operation failed.",
                                               @"Data Error");
                        }
                    }
                    else
                    {
                        UiMessages.Warning(@"Configuration file from modem returned null bytes; operation failed.",
                                           @"Data Error");
                    }
                }
                else
                {
                    UiMessages.Warning(@"Authentication required; please authenticate first.");
                }
            }
            catch (Exception ex)
            {
                UiMessages.Error(ex.ToString());
            }
        }
Example #5
0
        private void ItmConnectedDevicesList_Click(object sender, EventArgs e)
        {
            try
            {
                //test authentication
                var success = ArcLogin.IsAuthenticated();

                if (success)
                {
                    var init = new CgiStations();
                    var dt   = init.GrabTable();

                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            ConnectedDevices.ShowConnectedDevices(dt);
                        }
                        else
                        {
                            UiMessages.Warning(
                                @"Topology info from modem returned 0 devices connected; operation failed.",
                                @"Data Error");
                        }
                    }
                    else
                    {
                        UiMessages.Warning("Topology info from modem returned nothing useful. " +
                                           "Please note that this is rate-limited, and the modem will reject too many requests within an undefined time-frame.",
                                           @"Data Error");
                    }
                }
                else
                {
                    UiMessages.Warning(@"Authentication required; please authenticate first.");
                }
            }
            catch (Exception ex)
            {
                UiMessages.Error(ex.ToString());
            }
        }
Example #6
0
 private void UIAuthUpdate()
 {
     try
     {
         //test authentication
         var testLogin = ArcLogin.TestLogin();
         if (testLogin)
         {
             UpdateUIAuthenticate(true);
         }
         else
         {
             UpdateUIAuthenticate();
         }
     }
     catch (Exception)
     {
         //ignore all errors
     }
 }
Example #7
0
        private void ItmJsonScript_Click(object sender, EventArgs e)
        {
            try
            {
                //test authentication
                var success = ArcLogin.IsAuthenticated();

                if (success)
                {
                    ScriptExecute.ShowScriptExecute();
                }
                else
                {
                    UiMessages.Warning(@"Authentication required; please authenticate first.");
                }
            }
            catch (Exception ex)
            {
                UiMessages.Error(ex.ToString());
            }
        }
Example #8
0
        private void ItmFirmwareVersion_Click(object sender, EventArgs e)
        {
            try
            {
                //test authentication
                var success = ArcLogin.IsAuthenticated();

                if (success)
                {
                    FirmwareVersion.ShowVersionInfo();
                }
                else
                {
                    UiMessages.Warning(@"Authentication required; please authenticate first.");
                }
            }
            catch (Exception ex)
            {
                UiMessages.Error(ex.ToString());
            }
        }
Example #9
0
        private void ItmFetchSystemLogs_Click(object sender, EventArgs e)
        {
            try
            {
                //test authentication
                var success = ArcLogin.IsAuthenticated();

                if (success)
                {
                    SystemLogs.ShowSystemLogViewer();
                }
                else
                {
                    UiMessages.Warning(@"Authentication required; please authenticate first.");
                }
            }
            catch (Exception ex)
            {
                UiMessages.Error(ex.ToString());
            }
        }
Example #10
0
        private void ItmCallLog_Click(object sender, EventArgs e)
        {
            try
            {
                //test authentication
                var success = ArcLogin.IsAuthenticated();

                if (success)
                {
                    var log   = new CgiCallLog();
                    var table = log.GrabTable();

                    if (table != null)
                    {
                        if (table.Rows.Count > 0)
                        {
                            PhoneLog.LoadLog(table);
                        }
                        else
                        {
                            UiMessages.Warning(@"Call log from modem returned 0 rows; operation failed.", @"Data Error");
                        }
                    }
                    else
                    {
                        UiMessages.Warning(@"Call log from modem returned null bytes; operation failed.", @"Data Error");
                    }
                }
                else
                {
                    UiMessages.Warning(@"Authentication required; please authenticate first.");
                }
            }
            catch (Exception ex)
            {
                UiMessages.Error(ex.ToString());
            }
        }
Example #11
0
        private void ItmTryDefault_Click(object sender, EventArgs e)
        {
            try
            {
                //test authentication
                var testLogin = ArcLogin.TestLogin();
                if (testLogin)
                {
                    UiMessages.Warning(@"Authentication failed: user is already authenticated");
                }
                else if (Global.InitToken == null)
                {
                    //LH1000 default is admin:Telstra
                    var defaultLogin = new ArcCredential(@"admin", @"Telstra");

                    //login with default credentials
                    var loginSuccess = ArcLogin.DoLogin(defaultLogin);
                    if (loginSuccess)
                    {
                        UpdateUIAuthenticate(true);
                        UiMessages.Info(@"Successfully authenticated user");
                    }
                    else
                    {
                        UiMessages.Warning(@"Authentication failed: login was unsuccessful");
                    }
                }
                else
                {
                    UiMessages.Warning(@"Authentication failed: login data already initialised");
                }
            }
            catch (Exception ex)
            {
                UiMessages.Error(ex.ToString());
            }
        }