private void CreatePackage() { try { if (currentConnectionInfo != null) { SessionCache sessionCache = new SessionCache(); ConnectionSession connectionSession = sessionCache[currentConnectionInfo]; DataBus dataBus = connectionSession.GetDataBus(); if (needCreateAuditlog) { //Generate audit log file. AuditLogInfo auditInfo = GetAuditInfo(dataBus, releaseManagerName); auditInfo.Author = currentConnectionInfo.UserName; auditInfo.Title = auditFileTitle; GenerateAuditLog(auditInfo, auditFileName); } //Create unload record if (needCreateUnloadRecord) { CreateUnloadFile(dataBus, releaseManagerName, unloadName); } //Generate move instruction doc. if (needCreateMoveInstruction) { dataBus = connectionSession.GetDataBus(); //Generate unload script file UnloadScriptFile unloadScriptFile = new UnloadScriptFile(); unloadScriptFile.FileLocation = fileDir; unloadScriptFile.UnloadScriptName = unloadName; unloadScriptFile.GenerateUnloadScript(dataBus); //Create move instruction. MoveInstructionInfo moveInstructionInfo = new MoveInstructionInfo(); moveInstructionInfo.UnloadFileLocation = unloadScriptFile.FileLocation; moveInstructionInfo.Title = textBoxMoveInstructionLocation.Text.Trim(); moveInstructionInfo.Author = currentConnectionInfo.UserName; moveInstructionInfo.Entity = GetUnloadEntity(connectionSession.GetDataBus(), unloadScriptFile.UnloadScriptName); GenerateMoveInstructions(moveInstructionInfo, moveInstructionFileLocation); } } Invoke(new UpdateUI(delegate() { MessageBox.Show("Package Created"); EnableControls(); })); } catch { Invoke(new UpdateUI(delegate() { MessageBox.Show("Create Package Failed, please try again"); EnableControls(); })); } }
private void buttonGetFieldValues_Click(object sender, EventArgs e) { string fileName = textBoxFileName.Text.Trim(); string queryString = textBoxQueryString.Text.Trim().Replace("\"", "\\\""); string eventMapName = textBoxEventMapName.Text.Trim(); SessionCache sessionCache = new SessionCache(); ConnectionInfo currentConnectionInfo = comboBoxServer.SelectedItem as ConnectionInfo; ConnectionSession connectionSession = sessionCache[currentConnectionInfo]; fieldValues = GetEventValues(connectionSession.GetDataBus(), fileName, queryString, eventMapName); BindDataToGridView(fieldValues); }
/// <summary> /// Get Data bus by session id and authorization string. /// </summary> /// <returns></returns> private DataBus GetDataBus() { //Reset the data from shared memory firstly ResetConnectionInfo(); string sessionId = textBoxCookieId.Text.Trim(); string authorizationString = textBoxAuthorization.Text.Trim(); ConnectionInfo currentConnectionInfo = new ConnectionInfo(); currentConnectionInfo.Domain = textBoxIP.Text.Trim(); currentConnectionInfo.Port = Convert.ToInt32(textBoxPort.Text.Trim()); currentConnectionInfo.Name = Guid.NewGuid().ToString(); SessionCache sessionCache = new SessionCache(); ConnectionSession connectionSession = sessionCache[currentConnectionInfo]; DataBus dataBus = connectionSession.GetDataBus(sessionId, authorizationString); return(dataBus); }
private Format GetFormatInfo(string formatName, string language) { string sessionId = textBoxCookieId.Text.Trim(); string authorizationString = textBoxAuthorization.Text.Trim(); ConnectionInfo currentConnectionInfo = comboBoxServer.SelectedItem as ConnectionInfo; SessionCache sessionCache = new SessionCache(); ConnectionSession connectionSession = sessionCache[currentConnectionInfo]; DataBus dataBus = connectionSession.GetDataBus(sessionId, authorizationString); JSCodeRunner codeRunner = new JSCodeRunner(); codeRunner.Include("JSCode\\JsonEncode.js"); codeRunner.Include("JSCode\\GetFormatInfo.js"); string codeToRun = " return GetFormatInfo(\"" + formatName + "\",\"" + language + "\");"; Format format = codeRunner.Run <Format>(dataBus, codeToRun); return(format); }
private RADPanel GetRADPanel(string radName, string panel) { string sessionId = textBoxCookieId.Text.Trim(); string authorizationString = textBoxAuthorization.Text.Trim(); ConnectionInfo currentConnectionInfo = comboBoxServer.SelectedItem as ConnectionInfo; SessionCache sessionCache = new SessionCache(); ConnectionSession connectionSession = sessionCache[currentConnectionInfo]; DataBus dataBus = connectionSession.GetDataBus(sessionId, authorizationString); JSCodeRunner codeRunner = new JSCodeRunner(); codeRunner.Include("JSCode\\JsonEncode.js"); codeRunner.Include("JSCode\\GetRADInfo.js"); string codeToRun = " return GetRADInfo(\"" + radName + "\",\"" + panel + "\");"; RADPanel radPanel = codeRunner.Run <RADPanel>(dataBus, codeToRun); return(radPanel); }
private void buttonStartTrace_Click(object sender, EventArgs e) { string sessionId = textBoxCookieId.Text.Trim(); string authorizationString = textBoxAuthorization.Text.Trim(); ConnectionInfo currentConnectionInfo = comboBoxServer.SelectedItem as ConnectionInfo; SessionCache sessionCache = new SessionCache(); ConnectionSession connectionSession = sessionCache[currentConnectionInfo]; DataBus dataBus = connectionSession.GetDataBus(sessionId, authorizationString); debugEntity = new DebugEntity(); debugEntity.OnTraceChanged += new TraceChangedHandler(DoTraceChanged); debugEntity.InitStack(dataBus); treeViewTraces.Nodes.Clear(); treeViewTraces.Nodes.Add(new TreeNode()); ShowTrace(debugEntity.TopRAD, treeViewTraces.Nodes[0]); currentRADNode = treeViewTraces.Nodes[0]; while (currentRADNode.Nodes.Count > 0) { currentRADNode = currentRADNode.Nodes[0]; } treeViewTraces.SelectedNode = currentRADNode; }
private void button1_Click(object sender, EventArgs e) { string sessionId = textBoxCookieId.Text.Trim(); string authorizationString = textBoxAuthorization.Text.Trim(); ConnectionInfo currentConnectionInfo = comboBoxServer.SelectedItem as ConnectionInfo; SessionCache sessionCache = new SessionCache(); ConnectionSession connectionSession = sessionCache[currentConnectionInfo]; DataBus dataBus = connectionSession.GetDataBus(sessionId, authorizationString); DebugAction debugAction = new DebugAction(dataBus); debugAction.CommandLine = textBoxDebug.Text.Trim(); HttpResponseMessage response = debugAction.DoAction(); Execute excuteObject = debugAction.ResponseData as Execute; ActionUtil.StoreMessages(excuteObject.ClientRequestEntity); debugEntity.AddTrace(excuteObject); if (excuteObject.ClientRequestEntity == null) { try { SyncBackData(response.CopiedStream, response.ChunkIndexes[1]); //semaphoreEmpty.Release(); if (dataSyncThread.ThreadState == ThreadState.Suspended) { dataSyncThread.Resume(); } } catch { } return; } else if (!excuteObject.ClientRequestEntity.Messages.Rearm) { return; } else { //return; } while (true) { DebugResponseAction debugResponse = new DebugResponseAction(dataBus); response = debugResponse.DoAction(); excuteObject = debugResponse.ResponseData as Execute; ActionUtil.StoreMessages(excuteObject.ClientRequestEntity); debugEntity.AddTrace(excuteObject); if (excuteObject.ClientRequestEntity == null) { SyncBackData(response.CopiedStream, response.ChunkIndexes[1]); //semaphoreEmpty.Release(); if (dataSyncThread.ThreadState == ThreadState.Suspended) { dataSyncThread.Resume(); } break; } else if (excuteObject.ClientRequestEntity.Messages.Rearm == false) { //semaphoreEmpty.Release(); //if (dataSyncThread.ThreadState == ThreadState.Suspended) //{ // dataSyncThread.Resume(); //} //break; } else { //Nothing to do. } } }