コード例 #1
0
ファイル: Program.cs プロジェクト: rms1000watt/aiserver
        static void ResponseHandler(object iSource, AAsyncEventArgs iArgs)
        {
            Console.WriteLine("iArgs.RequestId = " + iArgs.RequestId);
            Console.WriteLine("iArgs.RequestType = " + globals.RequestNames[(int)iArgs.RequestType]);
            Console.WriteLine("iArgs.ReturnValue = " + iArgs.ReturnValue);
            if (iArgs.Status == 0)
            {
                Console.WriteLine("iArgs.Status = OK");
            }
            else
            {
                Console.WriteLine("Error: " + iArgs.Error);
            }

            if (iArgs.Out.Length > 0)
            {
                Console.WriteLine("Out: " + iArgs.Out);
            }

            if (iArgs.Display.Length > 0)
            {
                Console.WriteLine("Display: " + iArgs.Display);
            }
            Console.Write("> ");
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: rms1000watt/aiserver
        static void ResponseHandler(object iSource, AAsyncEventArgs iEventArgs)
        {
            Console.WriteLine("Response");
            Console.WriteLine("====================");

            Console.WriteLine("Request Id: {0}", iEventArgs.RequestId);
            Console.WriteLine("Connection Id: {0}", iEventArgs.ConnectionId);
            Console.WriteLine("Out: {0}", iEventArgs.Out);
            Console.WriteLine("Status: {0}", iEventArgs.Status);
            Console.WriteLine("Display: {0}", iEventArgs.Display);
        }
コード例 #3
0
        /// <summary>
        /// Wraps the AppClient.OpenConnection method.
        /// </summary>
        /// <param name="iHost">Hostname or IP address.</param>
        /// <param name="iPort">Port number.</param>
        /// <returns>Request Id.</returns>
        public int OpenConnection(string iHost, int iPort)
        {
            if (_AppClient == null)
            {
                _DefaultReceiver            = new AAsyncEventArgs();
                _DefaultReceiver.Completed += new System.EventHandler <AAsyncEventArgs>(ResponseHandler);

                _AppClient = new AAppClient(iHost, (ushort)iPort, _DefaultReceiver, "Excel AppClient");

                if (_TraceFile != null)
                {
                    _AppClient.SetTraceFile(_TraceFile, _TraceAppend);
                }
            }
            return(_AppClient.OpenConnection(_DefaultReceiver));
        }
コード例 #4
0
ファイル: ThisAddIn.cs プロジェクト: rms1000watt/aiserver
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            #region VSTO generated code

            this.Application = (Excel.Application)Microsoft.Office.Tools.Excel.ExcelLocale1033Proxy.Wrap(typeof(Excel.Application), this.Application);

            #endregion
            // This code adds a custom toolbar to the user's Excel spreadsheet.
            AddToolbar();
            // Retrieve the current excel application and pass it to the GSM Demo form.
            // The form needs the reference to update the worksheet.
            cWaitForm            = new upWaitForm();
            cConnectForm         = new ConnectForm();
            cReceiver            = new AAsyncEventArgs();
            cReceiver.Completed += new System.EventHandler <AAsyncEventArgs>(defaultResponseHandler);
            cAppClient           = new AAppClient("", 0, cReceiver, "GSMDemo");
            cCLIForm             = new CLIForm();
            cGsmDemoForm         = new GSMDemo();
            cWelcomeForm         = new WelcomeForm();
        }
コード例 #5
0
        /// <summary>
        /// Initialize add-in objects.
        /// </summary>
        private void InitObjects()
        {
            _DefaultReceiver            = new AAsyncEventArgs();
            _DefaultReceiver.Completed += new EventHandler <AAsyncEventArgs>(DefaultResponseHandler);
            _AppClient = new AAppClient("", 0, _DefaultReceiver, "Excel");

            _SecondaryReceiver            = new AAsyncEventArgs();
            _SecondaryReceiver.Completed += new EventHandler <AAsyncEventArgs>(SecondaryResponseHandler);

            // default close mode is soft
            uCloseModeCombo.SelectedIndex = 2;
            uPrefixText.Text = "(debug  traceoff: erroroff: checkoff: jiton:)";

            SetConnectionState(false);
            StatusInfo("Ready");

            _ConsoleContextMenu = new ContextMenu();
            _ConsoleContextMenu.MenuItems.Add("Run Selection", uRunSelection_Click);
            uConsoleText.ContextMenu = _ConsoleContextMenu;

            uLogonButton.Click           += new EventHandler(uLogonButton_Click);
            uLogoffButton.Click          += new EventHandler(uLogoffButton_Click);
            uRefreshContextsButton.Click += new EventHandler(uRefreshContextsButton_Click);
            uAvailContextsList.Click     += new EventHandler(uAvailContextsList_Click);
            uRefreshSessionsButton.Click += new EventHandler(uRefreshSessionsButton_Click);
            uNewSessionButton.Click      += new EventHandler(uNewSessionButton_Click);
            uConnectSessionButton.Click  += new EventHandler(uConnectSessionButton_Click);
            uEnterButton.Click           += new EventHandler(uEnterButton_Click);
            uCommandCombo.KeyDown        += new KeyEventHandler(uCommandCombo_KeyDown);
            uRefreshCabinetsButton.Click += new EventHandler(uRefreshCabinetsButton_Click);
            uCabinetsList.DoubleClick    += new EventHandler(uCabinetsList_DoubleClick);

            uActiveSessionList.ColumnClick += new ColumnClickEventHandler(uActiveSessionList_ColumnClick);
            uNodesList.ColumnClick         += new ColumnClickEventHandler(uNodesList_ColumnClick);

            _ActiveSessionListSorter = new ListViewColumnSorter();
            _ActiveNodesListSorter   = new ListViewColumnSorter();

            uActiveSessionList.ListViewItemSorter = _ActiveSessionListSorter;
            uNodesList.ListViewItemSorter         = _ActiveNodesListSorter;
        }
コード例 #6
0
 /// <summary>
 /// Default response handler. Issues an event notification.
 /// </summary>
 /// <param name="iSource"></param>
 /// <param name="iEvent"></param>
 private void ResponseHandler(object iSource, AAsyncEventArgs iEvent)
 {
     ReturnOutput(iEvent.RequestId, (int)iEvent.RequestType, iEvent.Status, iEvent.ReturnValue,
                  iEvent.Out, iEvent.Display, iEvent.Error, iEvent.ClientData);
 }
コード例 #7
0
ファイル: ThisAddIn.cs プロジェクト: rms1000watt/aiserver
        private void displayGenerateDataResults(AAsyncEventArgs iArgs)
        {
            Excel.Workbook  aWorkbook;
            Excel.Sheets    aCurrentSheets;
            Excel.Worksheet aWorksheet;
            try
            {   // Check if there is an existing workbook
                aWorkbook = Globals.ThisAddIn.Application.Workbooks.get_Item(1);
            }
            catch (Exception)
            {   // There was an error retrieving the current workbook,
                // Create a new one
                aWorkbook = Globals.ThisAddIn.Application.Workbooks.Add(Type.Missing);
            }
            aCurrentSheets = aWorkbook.Sheets as Excel.Sheets;
            string aOutText = iArgs.Out.Replace("***DisplayGenerateData***", "");

            // There are quotations from the generated data when they are strings, removing them before displaying.
            aOutText = aOutText.Replace("\"", "");
            // Parse the results, delimited by "***Marker***" as sent in the Run Command
            // of Generate Data form.
            string[] aOutArray = aOutText.Split(new string[] { "***Marker***" }, StringSplitOptions.None);
            string   aTestName = "";

            if (aOutArray.Length > 0)
            {
                aTestName = aOutArray[0];
            }
            if (aOutArray.Length > 1)
            {
                string aParameterString = aOutArray[1];
                // Process the Test case's Parameters.txt file
                // Check if the TestDir parameter exists, if not add TestDir with default value
                if (aParameterString.IndexOf("TestDir") < 0)
                {
                    string aTestDir = Directory.GetCurrentDirectory();
                    aParameterString += "\nTestDir\t" + aTestDir + "\\";
                }
                // Check if the ParametersFile parameter exists, if not add the parameter string with default value
                if (aParameterString.IndexOf("ParametersFile") < 0)
                {
                    aParameterString += "\nParametersFile\tMyTest.Parameters.ini";
                }
                // Check if the TrainingFile parameter exists, if not add the parameter string with default value
                if (aParameterString.IndexOf("TrainingFile") < 0)
                {
                    string aDir = Directory.GetCurrentDirectory();
                    aParameterString += "\nTrainingFile\tMyTest.Training.txt";
                }
                // Check if the TestingFile parameter exists, if not add the parameter string with default value
                if (aParameterString.IndexOf("TestingFile") < 0)
                {
                    aParameterString += "\nTestingFile\tMyTest.Testing.txt";
                }
                // Check if the ResultsFile parameter exists, if not add the parameter string with default value
                if (aParameterString.IndexOf("ResultsFile") < 0)
                {
                    aParameterString += "\nResultsFile\tMyTest.Results.txt";
                }
                // Check if the StatisticsFile parameter exists, if not add the parameter string with default value
                if (aParameterString.IndexOf("StatisticsFile") < 0)
                {
                    aParameterString += "\nStatisticsFile\tMyTest.Statistics.txt";
                }
                // Check if the EstimatesFile parameter exists, if not add the parameter string with default value
                if (aParameterString.IndexOf("EstimatesFile") < 0)
                {
                    aParameterString += "\nEstimatesFile\tMyTest.Estimates.txt";
                }
                stringToWorksheet("Parameters", aParameterString, 1, 1, "\n", "\t");
                //addDropDownOptions("Parameters");
                addParameterComments("Parameters");
            }
            if (aOutArray.Length > 2)
            {   // Process the Test case's Training.txt file
                try
                { aWorksheet = aCurrentSheets.get_Item("Training") as Excel.Worksheet; }
                catch (Exception)
                {  // Worksheet does not exist, create a new one
                    aWorksheet      = (Excel.Worksheet)aCurrentSheets.Add(aCurrentSheets[1], Type.Missing, Type.Missing, Type.Missing);
                    aWorksheet.Name = "Training";
                }
                displayWorkSheet(aWorksheet, aOutArray[2], 1, 1, "\n", "\t");
            }
            if (aOutArray.Length > 3)
            {   // Process the Test case's Testing.txt file
                try
                { aWorksheet = aCurrentSheets.get_Item("Testing") as Excel.Worksheet; }
                catch (Exception)
                {   // Worksheet does not exist, create a new one
                    aWorksheet      = (Excel.Worksheet)aCurrentSheets.Add(aCurrentSheets[1], Type.Missing, Type.Missing, Type.Missing);
                    aWorksheet.Name = "Testing";
                }
                displayWorkSheet(aWorksheet, aOutArray[3], 1, 1, "\n", "\t");
            }
            if (iArgs.Display != "")
            {
                string aTextToDisplay = iArgs.Display.Replace("\n", Environment.NewLine);
                displayText(aTextToDisplay);
            }
            // Focus on the Parameters worksheet
            aWorksheet = aCurrentSheets.get_Item("Parameters") as Excel.Worksheet;
            //aWorksheet.Activate();
        }
コード例 #8
0
ファイル: ThisAddIn.cs プロジェクト: rms1000watt/aiserver
        // Handler for Async Events
        private void defaultResponseHandler(object iSrc, AAsyncEventArgs iArgs)
        {
            if (iArgs.Status == 0)
            {
                switch (iArgs.RequestType)
                {
                case ARequestType.OpenConnection:
                    // Successfully connected, try logging on.
                    if (cAppClient.IsConnected)
                    {
                        cAppClient.Logon(cReceiver, cUsername, cPassword);
                    }
                    break;

                case ARequestType.CloseConnection:
                    cConnectForm.setConnected(false);
                    cConnectForm.setConnected(false);
                    cConnectForm.enableServerIPText(true);
                    cConnectForm.enableServerPortText(true);
                    cConnectForm.enableUserNameText(true);
                    cConnectForm.enablePasswordText(true);
                    Globals.ThisAddIn.cCLIForm.enableSubmitButton(false);
                    Globals.ThisAddIn.cCLIForm.enableCommandText(false);
                    cGsmDemoForm.displayStatusBar("Disonnected");
                    cGsmDemoForm.setStatusBarImg(global::AisExcel2003.Properties.Resources.disconnected);
                    break;

                case ARequestType.Logon:
                    if (iArgs.Status == 0)
                    {
                        cConnectForm.setConnected(true);
                        cConnectForm.enableServerIPText(false);
                        cConnectForm.enableServerPortText(false);
                        cConnectForm.enableUserNameText(false);
                        cConnectForm.enablePasswordText(false);
                        Globals.ThisAddIn.cCLIForm.enableSubmitButton(true);
                        Globals.ThisAddIn.cCLIForm.enableCommandText(true);
                        cAppClient.OpenSession(cReceiver, "GSMDemo");
                    }
                    else
                    {
                        //There was an error on logon
                        displayText("Logon Error: " + iArgs.Error + Environment.NewLine);
                    }
                    break;

                case ARequestType.OpenSession:
                    cSessionId = iArgs.ReturnValue;
                    displayText("Logged on successful" + Environment.NewLine);
                    cGsmDemoForm.displayStatusBar("Connected");
                    cGsmDemoForm.setStatusBarImg(global::AisExcel2003.Properties.Resources.connected);
                    break;

                case ARequestType.Display:
                case ARequestType.Eval:
                    if (iArgs.Out.StartsWith("***DisplayGenerateData***"))
                    {
                        displayGenerateDataResults(iArgs);
                    }
                    else
                    if (iArgs.Out.StartsWith("***DisplayWorkSheet***"))
                    {
                        Excel.Workbook  aWorkbook      = Globals.ThisAddIn.Application.Workbooks.get_Item(1);
                        Excel.Sheets    aCurrentSheets = aWorkbook.Sheets as Excel.Sheets;
                        Excel.Worksheet aWorkSheet;
                        string          aOutText = iArgs.Out.Replace("***DisplayWorkSheet***", "");
                        // Parse the results, delimited by "***Marker***" as sent in the Run Command
                        // of Generate Data form.
                        string[] aOutArray = aOutText.Split(new string[] { "***Marker***" }, StringSplitOptions.None);
                        string   aTestName = "";
                        if (aOutArray.Length > 0)
                        {
                            aTestName = aOutArray[0];
                        }
                        if (aOutArray.Length > 1)
                        {               // Process the Test case's Results.txt file
                            try
                            { aWorkSheet = aCurrentSheets.get_Item("Results") as Excel.Worksheet; }
                            catch (Exception)
                            {           // Worksheet does not exist, create a new one
                                aWorkSheet      = (Excel.Worksheet)aCurrentSheets.Add(aCurrentSheets[1], Type.Missing, Type.Missing, Type.Missing);
                                aWorkSheet.Name = "Results";
                            }
                            displayWorkSheet(aWorkSheet, aOutArray[1], 1, 1, "\n", "\t");
                        }
                        if (aOutArray.Length > 2)
                        {               // Process the Test case's Estimates.txt file
                            try
                            { aWorkSheet = aCurrentSheets.get_Item("Estimates") as Excel.Worksheet; }
                            catch (Exception)
                            {           // Worksheet does not exist, create a new one
                                aWorkSheet      = (Excel.Worksheet)aCurrentSheets.Add(aCurrentSheets[1], Type.Missing, Type.Missing, Type.Missing);
                                aWorkSheet.Name = "Estimates";
                            }
                            displayWorkSheet(aWorkSheet, aOutArray[2], 1, 1, "\n", "\t");
                        }
                        if (aOutArray.Length > 3)
                        {               // Process the Test case's Statistics.txt file
                            try
                            { aWorkSheet = aCurrentSheets.get_Item("Statistics") as Excel.Worksheet; }
                            catch (Exception)
                            {           // Worksheet does not exist, create a new one
                                aWorkSheet      = (Excel.Worksheet)aCurrentSheets.Add(aCurrentSheets[1], Type.Missing, Type.Missing, Type.Missing);
                                aWorkSheet.Name = "Statistics";
                            }
                            displayWorkSheet(aWorkSheet, aOutArray[3], 1, 1, "\n", "\t");
                        }
                        if (iArgs.Display != "")
                        {
                            string aTextToDisplay = iArgs.Display.Replace("\n", Environment.NewLine);
                            displayText(aTextToDisplay);
                        }
                        Globals.ThisAddIn.cWaitForm.setVisible(false);
                        MessageBox.Show("GSM Test finished", "Information");
                    }
                    else
                    {
                        string aTextToDisplay = iArgs.Display.Replace("\n", Environment.NewLine);
                        displayText(aTextToDisplay);
                        if (iArgs.Out != "")
                        {
                            displayText(iArgs.Out);
                        }
                    }
                    break;

                case ARequestType.LogStatus:
                    displayText("Log: " + iArgs.Out);
                    break;

                default:
                    displayText("Default: " + iArgs.Out);
                    break;
                }
            }
            else
            {
                if (iArgs.Error.Length == 0)
                {
                    if (AGlobals.GetSingleton().ErrorMessages.ContainsKey(iArgs.Status))
                    {
                        iArgs.Error = AGlobals.GetSingleton().ErrorMessages[iArgs.Status];
                    }
                    else
                    {
                        iArgs.Error = AGlobals.GetSingleton().ErrorMessages[(int)AErrorCodes.Generic];
                    }
                }
                switch (iArgs.RequestType)
                {
                case ARequestType.OpenConnection:
                    displayText("Open Connection Error: " + iArgs.Error);
                    break;

                case ARequestType.CloseConnection:
                    displayText("Close Connection Error: " + iArgs.Error);
                    cConnectForm.setConnected(false);
                    cConnectForm.enableServerIPText(true);
                    cConnectForm.enableServerPortText(true);
                    cConnectForm.enableUserNameText(true);
                    cConnectForm.enablePasswordText(true);
                    Globals.ThisAddIn.cCLIForm.enableSubmitButton(false);
                    Globals.ThisAddIn.cCLIForm.enableCommandText(false);
                    cGsmDemoForm.displayStatusBar("Disonnected");
                    cGsmDemoForm.setStatusBarImg(global::AisExcel2003.Properties.Resources.disconnected);
                    break;

                case ARequestType.Logon:
                    displayText("Logon Error" + iArgs.Error);
                    break;

                case ARequestType.OpenSession:
                    displayText("Open Session Error" + iArgs.Error);
                    break;

                default:
                    break;
                }
            }
        }
コード例 #9
0
        private void ResponseHandler(object iSource, AAsyncEventArgs iArgs)
        {
            AppendToConsole(string.Format("Request Id: {0}", iArgs.RequestId), true);
            AppendToConsole(string.Format("Request Type: {0}", iArgs.RequestType.ToString()), true);
            AppendToConsole(string.Format("Status: {0}", iArgs.Status), true);
            AppendToConsole(string.Format("Return Value: {0}", iArgs.ReturnValue), true);
            AppendToConsole(string.Format("Display: {0}", iArgs.Display), true);
            AppendToConsole(string.Format("Error: {0}", iArgs.Error), true);
            AppendToConsole(string.Format("Out: {0}", iArgs.Out), true);

            uStatusError.Text = "Err: " + iArgs.Error;

            if (iArgs.Status == 0)
            {
                switch (iArgs.RequestType)
                {
                case ARequestType.OpenConnection:
                    uStatusConnection.Text = "Connected.";
                    break;

                case ARequestType.CloseConnection:
                    uStatusConnection.Text = "Disconnected.";
                    _UserId = 0;
                    break;

                case ARequestType.Logon:
                    uStatusConnection.Text = "Logged On.";
                    _UserId = iArgs.ReturnValue;
                    break;

                case ARequestType.Logoff:
                    uStatusConnection.Text = "Logged Off.";
                    _UserId = 0;
                    break;

                case ARequestType.GetCurrentContexts:
                    AppendToOutput("Get Current Contexts", true);
                    string[] aContexts = iArgs.Out.Split("\n".ToCharArray());
                    foreach (string aContext in aContexts)
                    {
                        string[] aEntry = aContext.Split("\t".ToCharArray());
                        AppendToOutput(aEntry[0], false);
                        if (aEntry.Length > 1)
                        {
                            AppendToOutput(": " + aEntry[1], true);
                        }
                    }
                    AppendToOutput("", true);
                    break;

                case ARequestType.GetSessions:
                    AppendToOutput("Get Sessions", true);
                    string[] aSessions = iArgs.Out.Split("\n".ToCharArray());
                    foreach (string aSession in aSessions)
                    {
                        AppendToOutput(aSession, true);
                    }

                    AppendToOutput("", true);
                    break;

                case ARequestType.Eval:
                case ARequestType.Display:
                    if (iArgs.Display.Length > 0)
                    {
                        string[] aDisplayLines = iArgs.Display.Split("\n".ToCharArray());
                        foreach (string aLine in aDisplayLines)
                        {
                            if (aLine.Length > 0)
                            {
                                AppendToOutput(aLine, true);
                            }
                        }
                    }
                    if (iArgs.Out.Length > 0)
                    {
                        AppendToOutput(iArgs.Out, true);
                    }
                    break;

                case ARequestType.OpenSession:
                    AppendToOutput("Open Session", true);
                    AppendToOutput(iArgs.Out, true);
                    _SessionId = iArgs.ReturnValue;
                    break;

                case ARequestType.CloseSession:
                    AppendToOutput("Close Session", true);
                    AppendToOutput(iArgs.Out, true);
                    _SessionId = 0;
                    break;

                case ARequestType.GetUsers:
                    AppendToOutput("Get Users", true);
                    string[] aUsers = iArgs.Out.Split("\n".ToCharArray());
                    foreach (string aUser in aUsers)
                    {
                        AppendToOutput(aUser, true);
                    }
                    break;

                case ARequestType.GetExtentNames:
                    AppendToOutput("Get Extent Names", true);
                    string[] aExtentNames = iArgs.Out.Split("\t".ToCharArray());
                    foreach (string aExtentName in aExtentNames)
                    {
                        AppendToOutput(aExtentName, true);
                    }
                    break;

                case ARequestType.GetExtentTypes:
                    AppendToOutput("Get Extent Types", true);
                    string[] aExtentTypes = iArgs.Out.Split("\n".ToCharArray());
                    foreach (string aExtentType in aExtentTypes)
                    {
                        AppendToOutput(aExtentType, true);
                    }
                    break;

                case ARequestType.GetNextLevel:
                    AppendToOutput("Get Next Level", true);
                    string[] aNodes = iArgs.Out.Split("\n".ToCharArray());
                    foreach (string aNode in aNodes)
                    {
                        AppendToOutput(aNode, true);
                    }
                    break;

                case ARequestType.GetDirInfo:
                    AppendToOutput("Get Dir Info", true);
                    string[] aDirItems = iArgs.Out.Split("\n".ToCharArray());
                    foreach (string aItem in aDirItems)
                    {
                        AppendToOutput(aItem, true);
                    }
                    break;

                case ARequestType.GetRequestStats:
                    AppendToOutput("Get Request Stats", true);
                    string[] aReqItems = iArgs.Out.Split("\n".ToCharArray());
                    foreach (string aItem in aReqItems)
                    {
                        AppendToOutput(aItem, true);
                    }
                    break;

                case ARequestType.GetSessionStats:
                    AppendToOutput("Get Session Stats", true);
                    string[] aSessItems = iArgs.Out.Split("\n".ToCharArray());
                    foreach (string aItem in aSessItems)
                    {
                        AppendToOutput(aItem, true);
                    }
                    break;

                case ARequestType.GetWorkspaceStatistics:
                    AppendToOutput("Get Workspace Stats", true);
                    string[] aWorkItems = iArgs.Out.Split("\n".ToCharArray());
                    foreach (string aItem in aWorkItems)
                    {
                        AppendToOutput(aItem, true);
                    }
                    break;

                case ARequestType.GetContextParams:
                    AppendToOutput("Get Context Params", true);
                    string[] aParams = iArgs.Out.Split("\x7F".ToCharArray());
                    foreach (string aParam in aParams)
                    {
                        AppendToOutput(aParam, true);
                    }
                    break;

                default:
                    AppendToOutput(iArgs.RequestType.ToString(), true);
                    AppendToOutput(iArgs.Out, true);

                    break;
                }
            }
            else
            {
                uStatusError.Text = string.Format("{0}: {1}", iArgs.RequestType.ToString(), iArgs.Error);
            }
        }
コード例 #10
0
        /// <summary>
        /// Secondary response handler.
        /// </summary>
        /// <param name="iSrc"></param>
        /// <param name="iArgs"></param>
        private void SecondaryResponseHandler(object iSrc, AAsyncEventArgs iArgs)
        {
            if (iArgs.Status == 0)
            {
                StatusInfo("Ready");

                switch (iArgs.RequestType)
                {
                case ARequestType.GetCurrentContexts:
                    SetAvailableContexts(iArgs.Out);
                    break;

                case ARequestType.GetSessions:
                    SetActiveSessions(iArgs.Out);
                    break;

                case ARequestType.GetExtentNames:
                    SetActiveExtents(iArgs.Out);
                    break;

                case ARequestType.GetExtentTypes:
                    DoGetNextLevel();
                    break;

                case ARequestType.GetNextLevel:
                    SetActiveNodes(null);
                    break;

                case ARequestType.OpenSession:
                    SetCurrentSession(iArgs.ReturnValue.ToString());
                    DoRefreshSessions();
                    DoSetLogLevel();
                    break;

                case ARequestType.SetLogLvl:
                    _AppClient.SetExtentTypeOptions(".Memory", "#(1 1 1)");
                    break;

                case ARequestType.ConnectSession:
                    SetCurrentSession(iArgs.ReturnValue.ToString());
                    DoRefreshSessions();
                    break;

                default:
                    AppendToLog("Request Id: " + iArgs.RequestId);
                    AppendToLog("Request Type: " + iArgs.RequestType.ToString());
                    AppendToLog("Status: " + iArgs.Status);
                    AppendToLog("Return: " + iArgs.ReturnValue);
                    AppendToLog("Error: " + iArgs.Error);
                    AppendToLog("Display: " + iArgs.Display);
                    AppendToLog("Out: " + iArgs.Out);
                    AppendToLog("-----");
                    break;
                }
            }
            else
            {
                if (iArgs.Error.Length == 0)
                {
                    if (AGlobals.GetSingleton().ErrorMessages.ContainsKey(iArgs.Status))
                    {
                        iArgs.Error = AGlobals.GetSingleton().ErrorMessages[iArgs.Status];
                    }
                    else
                    {
                        iArgs.Error = AGlobals.GetSingleton().ErrorMessages[(int)AErrorCodes.Generic];
                    }
                }
                StatusError(iArgs.Error);
            }
        }
コード例 #11
0
        /// <summary>
        /// Default response handler.
        /// </summary>
        /// <param name="iSrc"></param>
        /// <param name="iArgs"></param>
        private void DefaultResponseHandler(object iSrc, AAsyncEventArgs iArgs)
        {
            if (iArgs.Status == 0)
            {
                StatusInfo("Ready");

                switch (iArgs.RequestType)
                {
                case ARequestType.OpenConnection:
                    InitLogon();
                    break;

                case ARequestType.CloseConnection:
                    SetConnectionState(false);
                    if (_Reconnect == true)
                    {
                        InitConnection();
                        _Reconnect = false;
                    }
                    _LoggedOn = false;
                    break;

                case ARequestType.Logon:
                    SetConnectionState(true);
                    _LoggedOn = true;
                    break;

                case ARequestType.Display:
                case ARequestType.Eval:
                    if (iArgs.Display.Length > 0)
                    {
                        AppendToConsole(iArgs.Display);
                    }
                    if (iArgs.Out.Length > 0)
                    {
                        AppendToConsole(iArgs.Out);
                    }
                    break;

                case ARequestType.LogStatus:
                    if (iArgs.Out.StartsWith("_icon"))
                    {
                        bool iEnable = iArgs.Out.EndsWith("off");
                        SetEngineIdle(iEnable);
                    }
                    else
                    {
                        StatusInfo(iArgs.Out);
                    }
                    break;

                default:
                    AppendToLog("Request Id: " + iArgs.RequestId);
                    AppendToLog("Request Type: " + iArgs.RequestType.ToString());
                    AppendToLog("Status: " + iArgs.Status);
                    AppendToLog("Return: " + iArgs.ReturnValue);
                    AppendToLog("Error: " + iArgs.Error);
                    AppendToLog("Display: " + iArgs.Display);
                    AppendToLog("Out: " + iArgs.Out);
                    AppendToLog("-----");
                    break;
                }
            }
            else
            {
                if (iArgs.Error.Length == 0)
                {
                    if (AGlobals.GetSingleton().ErrorMessages.ContainsKey(iArgs.Status))
                    {
                        iArgs.Error = AGlobals.GetSingleton().ErrorMessages[iArgs.Status];
                    }
                    else
                    {
                        iArgs.Error = AGlobals.GetSingleton().ErrorMessages[(int)AErrorCodes.Generic];
                    }
                }
                StatusError(iArgs.Error);
                SetEnable(true);
            }

            if (iArgs.RequestType == ARequestType.Eval)
            {
                SetEnable(true);
            }
        }
コード例 #12
0
ファイル: GSMDemo.cs プロジェクト: rms1000watt/aiserver
        public GSMDemo()
        {
            InitializeComponent();
            cReceiver                    = new AAsyncEventArgs();
            cConnectForm                 = Globals.ThisAddIn.cConnectForm;
            upConnectButton.Enabled      = true;
            upGenerateDataButton.Enabled = false;
            upLoadButton.Enabled         = true;
            upSplitButton.Enabled        = true;
            upRunButton.Enabled          = false;
            upSaveButton.Enabled         = true;
            upCloseButton.Enabled        = true;

            BalloonAlignment ba = BalloonAlignment.RightMiddle;

            cConnectHelp.Parent    = upConnectButton;
            cConnectHelp.Title     = "Connect to AIS";
            cConnectHelp.TitleIcon = TooltipIcon.Info;
            cConnectHelp.Text      = "You must connect to an Analytic Information Server(AIS) running the GSM Demo server application" +
                                     "to enable the Generate Test button and the Run GSM Test button.";
            cConnectHelp.Align                  = ba;
            cConnectHelp.CenterStem             = false;
            cConnectHelp.UseAbsolutePositioning = false;
            cRunHelp.Parent    = upRunButton;
            cRunHelp.Title     = "Run GSM Test";
            cRunHelp.TitleIcon = TooltipIcon.Info;
            cRunHelp.Text      = "After the above worksheets have been filled and modified as necessary, select Run GSM Test to" +
                                 " conduct a regression.  This test may take a very long time for large data sets.";
            cRunHelp.Align                  = ba;
            cRunHelp.CenterStem             = false;
            cRunHelp.UseAbsolutePositioning = false;
            cGenerateHelp.Parent            = upGenerateDataButton;
            cGenerateHelp.Title             = "Generate Test Set";
            cGenerateHelp.TitleIcon         = TooltipIcon.Info;
            cGenerateHelp.Text              = "GSM requires data obtained by generating data or loading data from a local  file.  Click" +
                                              " on Generate Test to select one of 26 sets of test data.  Three worksheets are addedto your workboolk, " +
                                              " Parameters, Testing Data, Training Data.  Be sure to add the corresponding file names for each of these" +
                                              " worksheets to the parameters worksheet if you wish to export these sheets to files.";
            cGenerateHelp.Align                  = ba;
            cGenerateHelp.CenterStem             = false;
            cGenerateHelp.UseAbsolutePositioning = false;
            cLoadHelp.Parent    = upLoadButton;
            cLoadHelp.Title     = "Load Test Set";
            cLoadHelp.TitleIcon = TooltipIcon.Info;
            cLoadHelp.Text      = "If you have previously saved a test set consisting of these three files on your local file" +
                                  " system, you can select Load Test button as an alternate way to obtain a test set.";
            cLoadHelp.Align                  = ba;
            cLoadHelp.CenterStem             = false;
            cLoadHelp.UseAbsolutePositioning = false;
            cSplitHelp.Parent                = upSplitButton;
            cSplitHelp.Title                 = "Split Test Data";
            cSplitHelp.TitleIcon             = TooltipIcon.Info;
            cSplitHelp.Text                  = "Split divides a data set into a Training set and a Testing set. Import these sets into a" +
                                               " Training worksheet and a Testing worksheet.";
            cSplitHelp.Align                    = ba;
            cSplitHelp.CenterStem               = false;
            cSplitHelp.UseAbsolutePositioning   = false;
            cWelcomeHelp.Parent                 = upShowWelcomeText;
            cWelcomeHelp.Title                  = "Toggle Welcome Text Pane";
            cWelcomeHelp.TitleIcon              = TooltipIcon.Info;
            cWelcomeHelp.Text                   = "Expand/collapse the Welcome Text Pane. Expand to view the Welcome Text. Collapse to save space.";
            cWelcomeHelp.Align                  = ba;
            cWelcomeHelp.CenterStem             = false;
            cWelcomeHelp.UseAbsolutePositioning = false;
            cAisMsgHelp.Parent                  = upShowAISMessages;
            cAisMsgHelp.Title                   = "Toggle AIS Messages Pane";
            cAisMsgHelp.TitleIcon               = TooltipIcon.Info;
            cAisMsgHelp.Text                    = "Expand/collapse the Ais Messages Pane. Expand to view Ais Messages & to enter AIS commands. Collapse" +
                                                  " to save space.";
            cAisMsgHelp.Align                  = ba;
            cAisMsgHelp.CenterStem             = false;
            cAisMsgHelp.UseAbsolutePositioning = false;
            cSaveHelp.Parent    = upSaveButton;
            cSaveHelp.Title     = "Save Test Set";
            cSaveHelp.TitleIcon = TooltipIcon.Info;
            cSaveHelp.Text      = "Select Save Test to save these three worksheets as a test set (three files) in your local file" +
                                  " system.  The TestDir parameter selects the folder in your file system where the test set is saved. ";
            cSaveHelp.Align                  = ba;
            cSaveHelp.CenterStem             = false;
            cSaveHelp.UseAbsolutePositioning = false;
            cCloseHelp.Parent                = upCloseButton;
            cCloseHelp.Title                 = "Close";
            cCloseHelp.TitleIcon             = TooltipIcon.Info;
            cCloseHelp.Text                  = "Select Close to dismiss this dialog.  Close does \r\nnot disconnect you from the se" +
                                               "rver or terminate \r\nan ongoing test.  You can reopen this dialog from \r\nthe Smil" +
                                               "ey Face icon in the custom toolbar.";
            cCloseHelp.Align                  = ba;
            cCloseHelp.CenterStem             = false;
            cCloseHelp.UseAbsolutePositioning = false;

            cHelpHelp.Parent    = upHelpButton;
            cHelpHelp.Title     = "Help on Help";
            cHelpHelp.TitleIcon = TooltipIcon.Info;
            cHelpHelp.Text      = "Click on Help to send an email usiing your local email client, if any.  " +
                                  "Please include a very detailed description of the exact steps required " +
                                  "to reproduce the problem.  If an email client is not available, just " +
                                  "send email to [email protected].  Thanks!";
            cHelpHelp.Align                  = ba;
            cHelpHelp.CenterStem             = false;
            cHelpHelp.UseAbsolutePositioning = false;
        }