private static void OnRetreivedServerVersion(object sender, DownloadStringCompletedEventArgs e) { if (e.Error == null && !e.Cancelled) { queryStatus = QueryStatus.Completed; fetchedVersionString = e.Result; fetchedVersion = VersionStringToInt(fetchedVersionString); int installedVersion = VersionStringToInt(SCPE.INSTALLED_VERSION); //Success IS_UPDATED = (installedVersion >= fetchedVersion) ? true : false; #if SCPE_DEV Debug.Log("<b>PackageVersionCheck</b> Up-to-date = " + IS_UPDATED + " (Installed:" + SCPE.INSTALLED_VERSION + ") (Remote:" + fetchedVersionString + ")"); #endif } else { Debug.LogWarning("[" + SCPE.ASSET_NAME + "] Contacting update server failed: " + e.Error.Message); queryStatus = QueryStatus.Failed; //When failed, assume installation is up-to-date IS_UPDATED = true; } }
/// <summary> /// Occurs when a new result has been queried. /// </summary> /// <param name="result">The downloaded result</param> protected void OnQueried(APIResult <T> result) { m_isUpdating = false; m_status = QueryStatus.Pending; // Do we need to retry the force update ? m_forceUpdate = (m_retryOnForceUpdateError ? result.HasError : false); // Was it canceled ? if (m_isCanceled) { return; } // Updates the stored data m_retryOnForceUpdateError = false; m_lastUpdate = DateTime.UtcNow; m_lastResult = result; // Notify subscribers if (Updated != null) { Updated(result); } }
/// <summary> /// Creates a new QueryException. /// </summary> /// <param name="message">Error message.</param> /// <param name="status"><see cref="QueryStatus"/> returned from Couchbase.</param> /// <param name="errors">List of errors returned from Couchbase.</param> /// <param name="innerException">Exception included in the response from Couchbase.</param> public QueryException(string message, QueryStatus status, IList <Error> errors, Exception innerException) : base(message, innerException) { Status = status; Errors = new ReadOnlyCollection <Error>(errors ?? new Error[] {}); }
internal void Deserialize(IBinaryReader reader) { // read query status _status = (QueryStatus)reader.ReadInt32(); switch (_status) { case QueryStatus.Warning: _warning = reader.ReadString(); break; case QueryStatus.Error: string errorMessage = reader.ReadString(); throw new QueryErrorException(String.Format(Messages.Exception_QueryError, errorMessage)); } // read fields _fields.Deserialize(reader); // read matches _matches.Deserialize(reader); // read search statistics _count = reader.ReadInt32(); _totalFound = reader.ReadInt32(); _elapsedTime = TimeSpan.FromMilliseconds(reader.ReadInt32()); _words.Deserialize(reader); }
public void Update(bool in_isActive, Google2uExportOptions in_options) { if (!_Initialized) { return; } if ((DateTime.Now - LastUpdateTime).TotalSeconds > 15) { LastUpdateTime = DateTime.Now; _QueryThread = null; if (WorksheetQueryStatus == QueryStatus.Uninitialized) { if (_NewQueryThread == null || _NewQueryThread.IsAlive == false) { _NewQueryThread = new Thread(QueryCells); _QueryThread = _NewQueryThread; } } else if (IsDataValid && in_isActive && DoUpdateQuery && WorksheetQueryStatus == QueryStatus.Idle) { if (_UpdateQueryThread == null || _UpdateQueryThread.IsAlive == false) { DoUpdateQuery = false; _UpdateQueryThread = new Thread(UpdateQuery); _QueryThread = _UpdateQueryThread; } } if (_QueryThread == null) { return; } WorksheetQueryStatus = QueryStatus.Querying; _QueryThread.Start(this); } else if (Rows != null && WorksheetQueryStatus == QueryStatus.Idle && UpdateCellTypes) { if (_UpdateCellTypesThread == null || _UpdateCellTypesThread.IsAlive == false) { UpdateCellTypes = false; _UpdateCellTypesThread = new Thread(DoUpdateCellTypes); _UpdateCellTypesThread.Start(this); } } if (Rows != null && UpdateValidation) { if (_ValidationThread == null || _ValidationThread.IsAlive == false) { UpdateValidation = false; _ValidationThread = new Thread(DoDataValidation); _ValidationThread.Start(new DataValidationParams(this, in_options)); } } }
internal CouchbaseN1QlQueryException(QueryStatus status, IList<Error> errors) : base(errors != null && errors.Count == 1 ? errors.First().Message : "N1QL query error, see Status and Errors properties for details.") { _status = status; _errors = errors; }
public void StatusUpdateReceiver(QueryStatus status) { //Nothing to do here if (status.CurrentStatus == QueryStatusValue.Playing && status.PreviousStatus != QueryStatusValue.Paused) { _doneNowPlaying = false; } }
/// <summary> /// Updates on every second. /// </summary> internal void UpdateOnOneSecondTick() { // Are we already updating ? if (m_isUpdating) { return; } m_isCanceled = false; // Is it enabled ? if (!m_enabled) { m_status = QueryStatus.Disabled; return; } // Do we have a network ? if (!NetworkMonitor.IsNetworkAvailable) { m_status = QueryStatus.NoNetwork; return; } // Check for an account if (!CheckAccount()) { m_status = QueryStatus.NoAccount; return; } // Check for a full key if (m_isFullKeyNeeded && !HasFullKey()) { m_status = QueryStatus.NoFullKey; return; } // Is it an auto-update test ? if (!m_forceUpdate) { // If not due time yet, quits var nextUpdate = NextUpdate; if (nextUpdate > DateTime.UtcNow) { m_status = QueryStatus.Pending; return; } } // Starts the update m_isUpdating = true; m_status = QueryStatus.Updating; QueryAsyncCore(EveClient.APIProviders.CurrentProvider, OnQueried); }
public DataService() { this.userBugs = new MultiThreadingObservableCollection<Bug>(); this.teamBugs = new MultiThreadingObservableCollection<Bug>(); this.refreshTime = DateTime.Now; this.userBugsQueryState = QueryStatus.QureyPause; this.userBugsProgressValue = 0; this.teamBugsQueryState = QueryStatus.QureyPause; this.teamBugsProgressValue = 0; this.initializeStatus = InitializeStatus.Initializing; }
public static void CheckForUpdate() { queryStatus = QueryStatus.Fetching; using (WebClient webClient = new WebClient()) { webClient.DownloadStringCompleted += new System.Net.DownloadStringCompletedEventHandler(OnRetreivedServerVersion); webClient.DownloadStringAsync(new System.Uri(SCPE.VERSION_FETCH_URL), fetchedVersionString); } }
public DataService() { this.userBugs = new MultiThreadingObservableCollection <Bug>(); this.teamBugs = new MultiThreadingObservableCollection <Bug>(); this.refreshTime = DateTime.Now; this.userBugsQueryState = QueryStatus.QureyPause; this.userBugsProgressValue = 0; this.teamBugsQueryState = QueryStatus.QureyPause; this.teamBugsProgressValue = 0; this.initializeStatus = InitializeStatus.Initializing; }
//public IEnumerable<DocumentModel> SimplePassthroughQueryDocumentWithPath(string filename, string subject) //{ // List<DocumentModel> documentModels = new List<DocumentModel>(); // QueryResult queryResult; // try // { // string queryString = "select dm_document.r_object_id, dm_document.subject, dm_document.a_content_type,dm_document.object_name,dm_format.dos_extension from dm_document,dm_format where dm_document.a_content_type = dm_format.name"; // if ((!String.IsNullOrEmpty(filename)) && (!String.IsNullOrEmpty(subject))) // { // queryString = queryString + " and upper(object_name) like '%" + filename.ToUpper() + "%' and upper(subject) like '%" + subject.ToUpper() + "%'"; // } // if ((!String.IsNullOrEmpty(filename)) && (String.IsNullOrEmpty(subject))) // { // queryString = queryString + " and upper(object_name) like '%" + filename.ToUpper() + "%'"; // } // if ((String.IsNullOrEmpty(filename)) && (!String.IsNullOrEmpty(subject))) // { // queryString = queryString + " and upper(subject) like '%" + subject.ToUpper() + "%'"; // } // int startingIndex = 0; // int maxResults = 60; // int maxResultsPerSource = 20; // PassthroughQuery q = new PassthroughQuery(); // q.QueryString = queryString; // q.AddRepository(DefaultRepository); // QueryExecution queryExec = new QueryExecution(startingIndex, // maxResults, // maxResultsPerSource); // queryExec.CacheStrategyType = CacheStrategyType.NO_CACHE_STRATEGY; // queryResult = searchService.Execute(q, queryExec, null); // QueryStatus queryStatus = queryResult.QueryStatus; // RepositoryStatusInfo repStatusInfo = queryStatus.RepositoryStatusInfos[0]; // if (repStatusInfo.Status == Status.FAILURE) // { // // Console.WriteLine(repStatusInfo.ErrorTrace); // documentModels.Add(new DocumentModel() { ObjectId = "0", ObjectName = repStatusInfo.ErrorMessage, Subject = repStatusInfo.ErrorTrace }); // } // //Console.WriteLine("Query returned result successfully."); // DataPackage dp = queryResult.DataPackage; // //Console.WriteLine("DataPackage contains " + dp.DataObjects.Count + " objects."); // foreach (DataObject dObj in dp.DataObjects) // { // PropertySet docProperties = dObj.Properties; // String objectId = dObj.Identity.GetValueAsString(); // String docName = docProperties.Get("object_name").GetValueAsString(); // String Extension = docProperties.Get("dos_extension").GetValueAsString(); // string repName = dObj.Identity.RepositoryName; // string docsubject = docProperties.Get("subject").GetValueAsString(); // //Console.WriteLine("RepositoryName: " + repName + " ,Document: " + objectId + " ,Name:" + docName + " ,Subject:" + docsubject); // documentModels.Add(new DocumentModel() { ObjectId = objectId, ObjectName = docName+"."+Extension , Subject = docsubject }); // } // } // catch (Exception ex) // { // documentModels.Add(new DocumentModel() { ObjectId = "1", ObjectName = "SampleFile.txt", Subject = "This is a Sample" }); // } // return documentModels; //} public void SimpleStructuredQuery(String docName) { String repoName = DefaultRepository; Console.WriteLine("Called SimpleStructuredQuery - " + DefaultRepository); PropertyProfile propertyProfile = new PropertyProfile(); propertyProfile.FilterMode = PropertyFilterMode.IMPLIED; OperationOptions operationOptions = new OperationOptions(); operationOptions.Profiles.Add(propertyProfile); // Create query StructuredQuery q = new StructuredQuery(); q.AddRepository(repoName); q.ObjectType = "dm_document"; q.IsIncludeHidden = true; q.IsDatabaseSearch = true; ExpressionSet expressionSet = new ExpressionSet(); expressionSet.AddExpression(new PropertyExpression("object_name", Condition.CONTAINS, docName)); q.RootExpressionSet = expressionSet; // Execute Query int startingIndex = 0; int maxResults = 60; int maxResultsPerSource = 20; QueryExecution queryExec = new QueryExecution(startingIndex, maxResults, maxResultsPerSource); QueryResult queryResult = searchService.Execute(q, queryExec, operationOptions); QueryStatus queryStatus = queryResult.QueryStatus; RepositoryStatusInfo repStatusInfo = queryStatus.RepositoryStatusInfos[0]; if (repStatusInfo.Status == Status.FAILURE) { Console.WriteLine(repStatusInfo.ErrorTrace); throw new Exception("Query failed to return result."); } Console.WriteLine("Query returned result successfully."); // print results Console.WriteLine("DataPackage contains " + queryResult.DataObjects.Count + " objects."); foreach (DataObject dataObject in queryResult.DataObjects) { Console.WriteLine(dataObject.Identity.GetValueAsString()); } }
private void InitializeEventDispatcher() { eventDispatcher = new EventDispatcher(() => { if (Query != null && Query.CanExecute(QueryParameter)) { Query.Execute(QueryParameter); QueryStatus = QueryStatus.Finished; } QueryStatus = QueryStatus.Pending; }, 300); }
public ExtendedQueryTagStoreJoinEntry( int key, string path, string vr, string privateCreator, QueryTagLevel level, ExtendedQueryTagStatus status, QueryStatus queryStatus, int errorCount, Guid?operationId = null) : base(key, path, vr, privateCreator, level, status, queryStatus, errorCount) { OperationId = operationId; }
public void Should_return_true_for_retryable_error_code(int errorCode, QueryStatus status) { var result = new AnalyticsResult <dynamic> { Status = QueryStatus.Fatal, Errors = new List <Error> { new Error { Code = errorCode } } }; Assert.IsTrue(result.ShouldRetry()); }
public async Task <IActionResult> GetStatus( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "submission/{submissionId:guid}")] HttpRequest httpRequest, Guid submissionId, [SignalR(HubName = "SubmissionHub")] IAsyncCollector <SignalRMessage> signalRMessages) { if (submissionId == default) { throw new ArgumentException("Cannot be null, empty, or default.", nameof(submissionId)); } var query = new QueryStatus(submissionId); var status = await mediator.Send(query); return(new OkObjectResult(status.ToString())); }
public QueryResult SimplePassthroughQueryDocument() { QueryResult queryResult; string queryString = "select r_object_id, object_name from eifx_deliverable_doc"; int startingIndex = 0; int maxResults = 60; int maxResultsPerSource = 30; PassthroughQuery q = new PassthroughQuery(); q.QueryString = queryString; q.AddRepository(DefaultRepository); QueryExecution queryExec = new QueryExecution(startingIndex, maxResults, maxResultsPerSource); queryExec.CacheStrategyType = CacheStrategyType.NO_CACHE_STRATEGY; queryResult = searchService.Execute(q, queryExec, null); QueryStatus queryStatus = queryResult.QueryStatus; RepositoryStatusInfo repStatusInfo = queryStatus.RepositoryStatusInfos[0]; if (repStatusInfo.Status == Status.FAILURE) { Console.WriteLine(repStatusInfo.ErrorTrace); throw new Exception("Query failed to return result."); } Console.WriteLine("Query returned result successfully."); DataPackage dp = queryResult.DataPackage; Console.WriteLine("DataPackage contains " + dp.DataObjects.Count + " objects."); foreach (DataObject dObj in dp.DataObjects) { //Console.WriteLine(dObj.Identity.GetValueAsString()); // PropertySet docProperties = dObj.Properties; String objectId = dObj.Identity.GetValueAsString(); String docName = docProperties.Get("object_name").GetValueAsString(); Console.WriteLine("Document " + objectId + " name is " + docName); // result = result + Environment.NewLine + "Document " + objectId + " name is " + docName; //lstCabinets.Add(new CabinetModel() { ObjectId = objectId, ObjectName = docName }); // } return(queryResult); }
public void When_Status_Is_Fatal_And_Code_Is_Retriable_Return_True(int code, QueryStatus status) { var response = new QueryResult <dynamic> { Status = status, Errors = new List <Error> { new Error { Code = code } } }; Assert.IsTrue(response.IsQueryPlanStale()); }
private void AssertTag( int key, AddExtendedQueryTagEntry expected, ExtendedQueryTagStoreJoinEntry actual, ExtendedQueryTagStatus status = ExtendedQueryTagStatus.Ready, QueryStatus queryStatus = QueryStatus.Enabled, Guid?operationId = null) { Assert.Equal(key, actual.Key); Assert.Equal(expected.Path, actual.Path); Assert.Equal(expected.PrivateCreator, actual.PrivateCreator); Assert.Equal(expected.VR, actual.VR); Assert.Equal(expected.Level, actual.Level); Assert.Equal(status, actual.Status); // Typically we'll set the status to Adding Assert.Equal(queryStatus, actual.QueryStatus); Assert.Equal(operationId, actual.OperationId); }
public static CommandProcessor GetCommandProcessor(string request, System.Net.Sockets.TcpClient connection) { CommandProcessor result = null; switch (getCommand(request)) { case "LOGON": result = new Logon(); break; case "LOGOFF": result = new Logoff(); break; case "SAVECARRIER": result = new SaveCarrier(); break; case "SAVESTATUS": result = new SaveStatus(); break; case "QUERYCARRIER": result = new QueryCarrier(); break; case "QUERYSTATUS": result = new QueryStatus(); break; case "QUERYALLCARRIERS": result = new QueryAllCarriers(); break; case "QUERYALLSTATUS": result = new QueryAllStatus(); break; } if (result != null) { result.Command = getCommand(request); result.Request = getRequestContent(request); result.Connection = connection; } return(result); }
public string PageQuery(string strSvr, string strURL, byte[] qry_bytes, Encoding enc) { upCall.DebugLog(strSvr + "/" + strURL); if (this.webClient == null) { this.webClient = new MyWebClient(strSvr, null); } webClient.strSvrURL = strSvr; if (this.QrySta != QueryStatus.NotLogined) { this.QrySta = QueryStatus.QueryReady; } string strEx = ""; string result; // 直到访问网页有返回时结束 while (true) { result = webClient.HttpQuery(strURL, qry_bytes, enc, out strEx); if (strEx != "") { upCall.DebugLog("访问:[" + strURL + "]时发生异常,接着重试"); upCall.DebugLog(strEx.Substring(0, strEx.IndexOfAny(new char [] { '\r', '\n' }))); } else { break; } } if (bIsLogined) { this.QrySta = QueryStatus.QueryFinish; } else { this.QrySta = QueryStatus.NotLogined; } return(result); }
public async Task InitializeAsync_NoResults_HasErrors(string filename, QueryStatus expectedStatus) { // Arrange using var stream = ResourceHelper.ReadResourceAsStream(filename); using var streamingResult = new StreamingQueryResult <dynamic>(stream, new DefaultSerializer(), ErrorContextFactory); // Act await streamingResult.InitializeAsync(); // Assert Assert.False(streamingResult.Success); Assert.Equal(expectedStatus, streamingResult.MetaData.Status); Assert.NotEmpty(streamingResult.Errors); }
private static void OnRetreivedServerVersion(object sender, DownloadStringCompletedEventArgs e) { if (e.Error == null && !e.Cancelled) { fetchedVersionString = e.Result; fetchedVersion = new System.Version(fetchedVersionString); System.Version installedVersion = new System.Version(INSTALLED_VERSION); //Success IS_UPDATED = (installedVersion >= fetchedVersion) ? true : false; #if SWS_DEV Debug.Log("<b>PackageVersionCheck</b> Up-to-date = " + IS_UPDATED + " (Installed:" + INSTALLED_VERSION + ") (Remote:" + fetchedVersionString + ")"); #endif queryStatus = QueryStatus.Completed; if (VersionChecking.showPopup) { if (!IS_UPDATED) { if (EditorUtility.DisplayDialog(ASSET_NAME + ", version " + INSTALLED_VERSION, "A new version is available: " + fetchedVersionString, "Open store page", "Close")) { OpenStorePage(); } } else { if (EditorUtility.DisplayDialog(ASSET_NAME + ", version " + INSTALLED_VERSION, "Your current version is up-to-date!", "Close")) { } } } } else { Debug.LogWarning("[" + ASSET_NAME + "] Contacting update server failed: " + e.Error.Message); queryStatus = QueryStatus.Failed; //When failed, assume installation is up-to-date IS_UPDATED = true; } }
/// <summary> /// 库存查询单选按钮,选择查询本人或实验室的库存器件 /// </summary> private void radioButtonQuery_Checked(object sender, RoutedEventArgs e) { setButtonEnabled(false, false, true, false); if (RadioButtonQueryLab.IsChecked == true) { _queryStatus = QueryStatus.LABORARY; } else if (RadioButtonQueryOwn.IsChecked == true) { _queryStatus = QueryStatus.ONESELF; } else if (RadioButtonQueryAll.IsChecked == true) { _queryStatus = QueryStatus.WHOLE; } else { throw new Exception("单选按钮(库存查询选择)改变事件异常"); } }
private void ParseQueryResult(QueryResponse response) { List <ColumnInfo> columnInfo = response.ColumnInfo; var options = new JsonSerializerOptions { IgnoreNullValues = true }; List <String> columnInfoStrings = columnInfo.ConvertAll(x => JsonSerializer.Serialize(x, options)); List <Row> rows = response.Rows; QueryStatus queryStatus = response.QueryStatus; Console.WriteLine("Current Query status:" + JsonSerializer.Serialize(queryStatus, options)); Console.WriteLine("Metadata:" + string.Join(",", columnInfoStrings)); Console.WriteLine("Data:"); foreach (Row row in rows) { Console.WriteLine(ParseRow(columnInfo, row)); } }
public QueryResult SimplePassthroughQuery() { QueryResult queryResult; string queryString = "select distinct r_object_id from dm_document order by r_object_id "; int startingIndex = 0; int maxResults = 60; int maxResultsPerSource = 20; PassthroughQuery q = new PassthroughQuery(); q.QueryString = queryString; q.AddRepository(DefaultRepository); QueryExecution queryExec = new QueryExecution(startingIndex, maxResults, maxResultsPerSource); queryExec.CacheStrategyType = CacheStrategyType.NO_CACHE_STRATEGY; queryResult = searchService.Execute(q, queryExec, null); QueryStatus queryStatus = queryResult.QueryStatus; RepositoryStatusInfo repStatusInfo = queryStatus.RepositoryStatusInfos[0]; if (repStatusInfo.Status == Status.FAILURE) { Console.WriteLine(repStatusInfo.ErrorTrace); throw new Exception("Query failed to return result."); } Console.WriteLine("Query returned result successfully."); DataPackage dp = queryResult.DataPackage; Console.WriteLine("DataPackage contains " + dp.DataObjects.Count + " objects."); foreach (DataObject dataObject in dp.DataObjects) { Console.WriteLine(dataObject.Identity.GetValueAsString()); } return(queryResult); }
public QueryRequestException(string message, QueryStatus queryStatus) : base(message) { QueryStatus = queryStatus; }
public void DrawGUIFull(EditorGUILayoutEx in_layout) { if (!_Initialized) { _Initialized = true; UseTypeRow = Google2uGUIUtil.GetBool(Prefix + "UseTypeRow", UseTypeRow); WorksheetExportType = Google2uGUIUtil.GetEnum(Prefix + "ExportType", WorksheetExportType); } if (WorksheetQueryStatus != QueryStatus.QueryComplete && WorksheetQueryStatus != QueryStatus.Idle && RowsDisplay.Length == 0) { EditorGUILayout.LabelField( Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_CELLS) + Google2u.Ellipses); } else if (RowsDisplay.Length == 0) { if (WorksheetQueryStatus == QueryStatus.QueryComplete || WorksheetQueryStatus == QueryStatus.Idle) { EditorGUILayout.LabelField( Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_EMPTY_WORKSHEET)); } } else { if (DoInitialSizeCheck) { DoInitialSizeCheck = false; for (var i = 0; i < ColOptions.Count; ++i) { CalculateColumnWidth(i, this); } } if ((DateTime.Now - LastUpdateTime).TotalSeconds > 15) { DoUpdateQuery = true; } if (ActiveCell != null) { if (!ActiveCell.SkipValidation && !string.IsNullOrEmpty(ActiveCell.Tooltip)) { EditorGUILayoutEx.SetColor(Color.red); GUILayout.Label(ActiveCell.Tooltip); EditorGUILayoutEx.ResetColor(); } if (ActiveCell.DrawCellValue(in_layout)) { WorksheetQueryStatus = QueryStatus.Idle; LastUpdateTime = DateTime.MinValue; DoUpdateQuery = true; UpdateValidation = true; } } else { var old = GUI.enabled; GUI.enabled = false; EditorGUILayout.TextField(string.Empty); GUI.enabled = old; } // Calculate the total width and height of the scroll area var totalHeight = Math.Max(120, 22 + (24 * RowsDisplay.Length)); var totalWidth = 40 + ColOptions.Sum(in_colOption => in_colOption.Width); EditorGUILayout.Separator(); if (Event.current.type == EventType.Repaint) { _LastRect = GUILayoutUtility.GetLastRect(); } var scrollHeight = Screen.height - _LastRect.y - 30; var screenRect = new Rect(0f, _LastRect.y, Screen.width, scrollHeight); var viewRect = new Rect(0f, 0f, totalWidth, totalHeight); _MyScrollPos = GUI.BeginScrollView(screenRect, _MyScrollPos, viewRect); var curRect = new Rect(0.0f, 0.0f, 40.0f, 22.0f); // Blank GUI.Label(curRect, string.Empty, in_layout.CellHeader); // Column Letters (Resizable Columns) for (var i = 0; i < RowsDisplay[0].Count; i++) { var label = GetColumnName(i + 1); curRect.x += curRect.width; curRect.width = ColOptions[i].Width; GUI.Label(curRect, label, in_layout.CellHeader); ColOptions[i].ColumnRect = curRect; ColOptions[i].ColumnRect.width = ColOptions[i].Width; if (ColOptions[i].ColumnRect.Contains(Event.current.mousePosition)) { ColOptions[i].HasMouse = true; } if (!ColOptions[i].HasMouse) { continue; } if ((Event.current.type == EventType.MouseDown) && (Event.current.clickCount >= 2)) { // Doubleclick CalculateColumnWidth(i, this); } if (Event.current.type == EventType.MouseDrag) { ColOptions[i].CurPos = Event.current.mousePosition; if (!ColOptions[i].Dragging) { ColOptions[i].Dragging = true; ColOptions[i].StartPos = ColOptions[i].CurPos; } } if (Event.current.type == EventType.MouseUp) { ColOptions[i].Dragging = false; ColOptions[i].HasMouse = false; } if (!ColOptions[i].Dragging) { continue; } if (Event.current.isMouse) { Event.current.Use(); } ColOptions[i].Width += Convert.ToInt32((ColOptions[i].CurPos.x - ColOptions[i].StartPos.x)); ColOptions[i].StartPos = ColOptions[i].CurPos; ColOptions[i].Width = Math.Max(26, ColOptions[i].Width); } curRect = new Rect(0.0f, 22.0f, 40.0f, 24.0f); // The rest of the rows for (var i = 0; i < RowsDisplay.Length; i++) { if (i == 1) { // Could be type row if (GUI.Button(curRect, UseTypeRow ? "Type" : "2", in_layout.CellTypeButton)) { if (UseTypeRow == false) { if (EditorUtility.DisplayDialog(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TYPEROWBOX_HEADER), Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TYPEROWBOX_MESSAGE), "OK", "Cancel")) { UseTypeRow = !UseTypeRow; UpdateCellTypes = true; } } else { UseTypeRow = !UseTypeRow; UpdateCellTypes = true; } } } else { // Row Number GUI.Label(curRect, Convert.ToString(i + 1), in_layout.CellHeader); } // Cell Values if (i == 1 && UseTypeRow) { for (var j = 0; j < RowsDisplay[i].Count; j++) { curRect.x += curRect.width; curRect.width = ColOptions[j].Width; var myCell = RowsDisplay[i][j]; if (myCell.MyType == SupportedType.Unrecognized) { myCell.SetTypeFromValue(); } var cellType = myCell.MyType; var curSelected = 0; foreach (var guiContent in _ComboBoxList) { if (guiContent.text.Equals(Convert.ToString(cellType))) { break; } curSelected++; } if (curSelected >= _ComboBoxList.Length) { curSelected = 0; } Google2uGUIUtil.ComboBox comboBoxControl; if (!_ComboBoxes.ContainsKey(j)) { comboBoxControl = new Google2uGUIUtil.ComboBox(curRect, _ComboBoxList[curSelected], _ComboBoxList, in_layout.CellTypeButton, in_layout.OuterBox, in_layout.CellHeader); _ComboBoxes.Add(j, comboBoxControl); } else { comboBoxControl = _ComboBoxes[j]; } comboBoxControl.width = curRect.width; comboBoxControl.height = curRect.height; comboBoxControl.x = curRect.x; comboBoxControl.y = curRect.y; var newSelected = comboBoxControl.Show(); if (newSelected != curSelected) { var newType = (SupportedType) Enum.Parse(typeof(SupportedType), _ComboBoxList[newSelected].text, true); myCell.MyType = newType; myCell.SetValueFromType(); UpdateCellTypes = true; UpdateValidation = true; } } } else { for (var j = 0; j < RowsDisplay[i].Count; j++) { curRect.x += curRect.width; curRect.width = ColOptions[j].Width; if (curRect.x + curRect.width > _MyScrollPos.x && curRect.x < _MyScrollPos.x + Screen.width && curRect.y + curRect.height > _MyScrollPos.y && curRect.y < _MyScrollPos.y + scrollHeight) { if (i < 2 || i > 5 || !_ComboBoxes.ContainsKey(j) || _ComboBoxes[j].IsShown == false) { var newCell = RowsDisplay[i][j].DrawGUI(in_layout, curRect, ActiveCell); if (newCell != null) { GUI.FocusControl("Blank"); ActiveCell = newCell; } } } } } curRect.x = 0.0f; curRect.width = 40.0f; curRect.y += curRect.height; } GUI.EndScrollView(); } }
public string PageQuery(string strSvr, string strURL, byte[] qry_bytes, Encoding enc) { upCall.DebugLog(strSvr + "/" + strURL); if (this.webClient == null) { this.webClient = new MyWebClient(strSvr, null); } webClient.strSvrURL = strSvr; if (this.QrySta != QueryStatus.NotLogined) { this.QrySta = QueryStatus.QueryReady; } string strEx = ""; string result; // 直到访问网页有返回时结束 while (true) { result = webClient.HttpQuery(strURL, qry_bytes, enc, out strEx); if (strEx != "") { upCall.DebugLog("访问:[" + strURL + "]时发生异常,接着重试"); upCall.DebugLog(strEx.Substring(0, strEx.IndexOfAny(new char [] {'\r', '\n'}))); } else { break; } } if (bIsLogined) { this.QrySta = QueryStatus.QueryFinish; } else { this.QrySta = QueryStatus.NotLogined; } return result; }
public QueryServiceException(string message, QueryStatus status, IList <Error> errors, Exception innerException) : base(message, status, errors, innerException) { }
///<inheritdoc/> public virtual Task <ExtendedQueryTagStoreJoinEntry> UpdateQueryStatusAsync(string tagPath, QueryStatus queryStatus, CancellationToken cancellationToken) { throw new BadRequestException(DicomSqlServerResource.SchemaVersionNeedsToBeUpgraded); }
public void DrawGUIFull(EditorGUILayoutEx in_layout) { if (!_Initialized) { _Initialized = true; UseTypeRow = Google2uGUIUtil.GetBool(Prefix + "UseTypeRow", UseTypeRow); WorksheetExportType = Google2uGUIUtil.GetEnum(Prefix + "ExportType", WorksheetExportType); } if (WorksheetQueryStatus != QueryStatus.QueryComplete && WorksheetQueryStatus != QueryStatus.Idle && RowsDisplay.Length == 0) { EditorGUILayout.LabelField( Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_CELLS) + Google2u.Ellipses); } else if (RowsDisplay.Length == 0) { if (WorksheetQueryStatus == QueryStatus.QueryComplete || WorksheetQueryStatus == QueryStatus.Idle) EditorGUILayout.LabelField( Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_EMPTY_WORKSHEET)); } else { if (DoInitialSizeCheck) { DoInitialSizeCheck = false; for (var i = 0; i < ColOptions.Count; ++i) { CalculateColumnWidth(i, this); } } if ((DateTime.Now - LastUpdateTime).TotalSeconds > 15) { DoUpdateQuery = true; } if (ActiveCell != null) { if (!ActiveCell.SkipValidation && !string.IsNullOrEmpty(ActiveCell.Tooltip)) { EditorGUILayoutEx.SetColor(Color.red); GUILayout.Label(ActiveCell.Tooltip); EditorGUILayoutEx.ResetColor(); } if (ActiveCell.DrawCellValue(in_layout)) { WorksheetQueryStatus = QueryStatus.Idle; LastUpdateTime = DateTime.MinValue; DoUpdateQuery = true; UpdateValidation = true; } } else { var old = GUI.enabled; GUI.enabled = false; EditorGUILayout.TextField(string.Empty); GUI.enabled = old; } // Calculate the total width and height of the scroll area var totalHeight = Math.Max(120, 22 + (24*RowsDisplay.Length)); var totalWidth = 40 + ColOptions.Sum(in_colOption => in_colOption.Width); EditorGUILayout.Separator(); if (Event.current.type == EventType.Repaint) _LastRect = GUILayoutUtility.GetLastRect(); var scrollHeight = Screen.height - _LastRect.y - 30; var screenRect = new Rect(0f, _LastRect.y, Screen.width, scrollHeight); var viewRect = new Rect(0f, 0f, totalWidth, totalHeight); _MyScrollPos = GUI.BeginScrollView(screenRect, _MyScrollPos, viewRect); var curRect = new Rect(0.0f, 0.0f, 40.0f, 22.0f); // Blank GUI.Label(curRect, string.Empty, in_layout.CellHeader); // Column Letters (Resizable Columns) for (var i = 0; i < RowsDisplay[0].Count; i++) { var label = GetColumnName(i + 1); curRect.x += curRect.width; curRect.width = ColOptions[i].Width; GUI.Label(curRect, label, in_layout.CellHeader); ColOptions[i].ColumnRect = curRect; ColOptions[i].ColumnRect.width = ColOptions[i].Width; if (ColOptions[i].ColumnRect.Contains(Event.current.mousePosition)) ColOptions[i].HasMouse = true; if (!ColOptions[i].HasMouse) continue; if ((Event.current.type == EventType.mouseDown) && (Event.current.clickCount >= 2)) { // Doubleclick CalculateColumnWidth(i, this); } if (Event.current.type == EventType.mouseDrag) { ColOptions[i].CurPos = Event.current.mousePosition; if (!ColOptions[i].Dragging) { ColOptions[i].Dragging = true; ColOptions[i].StartPos = ColOptions[i].CurPos; } } if (Event.current.type == EventType.mouseUp) { ColOptions[i].Dragging = false; ColOptions[i].HasMouse = false; } if (!ColOptions[i].Dragging) continue; if (Event.current.isMouse) Event.current.Use(); ColOptions[i].Width += Convert.ToInt32((ColOptions[i].CurPos.x - ColOptions[i].StartPos.x)); ColOptions[i].StartPos = ColOptions[i].CurPos; ColOptions[i].Width = Math.Max(26, ColOptions[i].Width); } curRect = new Rect(0.0f, 22.0f, 40.0f, 24.0f); // The rest of the rows for (var i = 0; i < RowsDisplay.Length; i++) { if (i == 1) { // Could be type row if (GUI.Button(curRect, UseTypeRow ? "Type" : "2", in_layout.CellTypeButton)) { if (UseTypeRow == false) { if (EditorUtility.DisplayDialog(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TYPEROWBOX_HEADER), Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TYPEROWBOX_MESSAGE), "OK", "Cancel")) { UseTypeRow = !UseTypeRow; UpdateCellTypes = true; } } else { UseTypeRow = !UseTypeRow; UpdateCellTypes = true; } } } else { // Row Number GUI.Label(curRect, Convert.ToString(i + 1), in_layout.CellHeader); } // Cell Values if (i == 1 && UseTypeRow) { for (var j = 0; j < RowsDisplay[i].Count; j++) { curRect.x += curRect.width; curRect.width = ColOptions[j].Width; var myCell = RowsDisplay[i][j]; if (myCell.MyType == SupportedType.Unrecognized) { myCell.SetTypeFromValue(); } var cellType = myCell.MyType; var curSelected = 0; foreach (var guiContent in _ComboBoxList) { if (guiContent.text.Equals(Convert.ToString(cellType))) break; curSelected++; } if (curSelected >= _ComboBoxList.Length) curSelected = 0; Google2uGUIUtil.ComboBox comboBoxControl; if (!_ComboBoxes.ContainsKey(j)) { comboBoxControl = new Google2uGUIUtil.ComboBox(curRect, _ComboBoxList[curSelected], _ComboBoxList, in_layout.CellTypeButton, in_layout.OuterBox, in_layout.CellHeader); _ComboBoxes.Add(j, comboBoxControl); } else { comboBoxControl = _ComboBoxes[j]; } comboBoxControl.width = curRect.width; comboBoxControl.height = curRect.height; comboBoxControl.x = curRect.x; comboBoxControl.y = curRect.y; var newSelected = comboBoxControl.Show(); if (newSelected != curSelected) { var newType = (SupportedType) Enum.Parse(typeof (SupportedType), _ComboBoxList[newSelected].text, true); myCell.MyType = newType; myCell.SetValueFromType(); UpdateCellTypes = true; UpdateValidation = true; } } } else { for (var j = 0; j < RowsDisplay[i].Count; j++) { curRect.x += curRect.width; curRect.width = ColOptions[j].Width; if (curRect.x + curRect.width > _MyScrollPos.x && curRect.x < _MyScrollPos.x + Screen.width && curRect.y + curRect.height > _MyScrollPos.y && curRect.y < _MyScrollPos.y + scrollHeight) { if (i < 2 || i > 5 || !_ComboBoxes.ContainsKey(j) || _ComboBoxes[j].IsShown == false) { var newCell = RowsDisplay[i][j].DrawGUI(in_layout, curRect, ActiveCell); if (newCell != null) { GUI.FocusControl("Blank"); ActiveCell = newCell; } } } } } curRect.x = 0.0f; curRect.width = 40.0f; curRect.y += curRect.height; } GUI.EndScrollView(); } }
/// <summary> /// Creates a new QueryException. /// </summary> /// <param name="message">Error message.</param> /// <param name="status"><see cref="QueryStatus"/> returned from Couchbase.</param> /// <param name="errors">List of errors returned from Couchbase.</param> public QueryException(string message, QueryStatus status, IList <Error> errors) : this(message, status, errors, null) { }
protected override void Execute(Component component) { LocateJoystick(); if (!isEnabled || destinationAddress == null) return; // request control and update the GUI to denote this if (!hasControl) { RequestControl requestControl = new RequestControl(); requestControl.SetDestination(destinationAddress); requestControl.SetSource(component.JausAddress); Transport.SendMessage(requestControl); // update the connection icon for the correct component to orange if (destinationAddress.getComponent() == 1) connectionDetails.direct = ConnectionOption.REQUESTING_CONTROL; if (destinationAddress.getComponent() == 2) connectionDetails.remote = ConnectionOption.REQUESTING_CONTROL; if (destinationAddress.getComponent() == 3) connectionDetails.ai = ConnectionOption.REQUESTING_CONTROL; _eventAggregator.GetEvent<ConnectionDetailsEvent>().Publish(connectionDetails); return; } // shut down all components, then resume the one that should be active (i.e. jank hax) if (!isReady) { // shut down all active components Shutdown shutdown = new Shutdown(); int subsys = CurrentDestinationAddress.SubsystemID; int node = CurrentDestinationAddress.getNode(); JausAddress newAddress = new JausAddress(subsys, node, 1); QueryStatus queryStatus = new QueryStatus(); if (componentOneActive) { shutdown.SetDestination(newAddress); Transport.SendMessage(shutdown); queryStatus.SetDestination(newAddress); queryStatus.SetSource(component.JausAddress); Transport.SendMessage(queryStatus); } if (componentTwoActive) { newAddress.setComponent(2); shutdown.SetDestination(newAddress); Transport.SendMessage(shutdown); queryStatus.SetDestination(newAddress); queryStatus.SetSource(component.JausAddress); Transport.SendMessage(queryStatus); } if (componentThreeActive) { newAddress.setComponent(3); shutdown.SetDestination(newAddress); Transport.SendMessage(shutdown); queryStatus = new QueryStatus(); queryStatus.SetDestination(newAddress); queryStatus.SetSource(component.JausAddress); Transport.SendMessage(queryStatus); } // force component to boot Resume resume = new Resume(); resume.SetDestination(destinationAddress); resume.SetSource(component.JausAddress); Transport.SendMessage(resume); // see if the component is ready queryStatus = new QueryStatus(); queryStatus.SetDestination(destinationAddress); queryStatus.SetSource(component.JausAddress); Transport.SendMessage(queryStatus); return; } // send a drive message SetLocalVector msg = new SetLocalVector(); msg.SetDestination(destinationAddress); msg.SetSource(component.JausAddress); // convert joystick degrees into radians // TODO: THIS IS INCORRECT msg.SetHeading(joystickQueryThread.XVelocity * (Math.PI / 180)); //adding 100 to fit into defined setLocalVector MAX_SPEED & MIN_SPEED msg.SetSpeed(joystickQueryThread.YVelocity + 100); Transport.SendMessage(msg); }
public void NotifyQueryStatus(int userId) { var response = new QueryStatus(); _packetHandlerManager.SendPacket(userId, response, Channel.CHL_S2C); }
public void Update(bool in_isActive, Google2uExportOptions in_options) { if (!_Initialized) return; if ((DateTime.Now - LastUpdateTime).TotalSeconds > 15) { LastUpdateTime = DateTime.Now; _QueryThread = null; if (WorksheetQueryStatus == QueryStatus.Uninitialized) { if (_NewQueryThread == null || _NewQueryThread.IsAlive == false) { _NewQueryThread = new Thread(QueryCells); _QueryThread = _NewQueryThread; } } else if (IsDataValid && in_isActive && DoUpdateQuery && WorksheetQueryStatus == QueryStatus.Idle) { if (_UpdateQueryThread == null || _UpdateQueryThread.IsAlive == false) { DoUpdateQuery = false; _UpdateQueryThread = new Thread(UpdateQuery); _QueryThread = _UpdateQueryThread; } } if (_QueryThread == null) return; WorksheetQueryStatus = QueryStatus.Querying; _QueryThread.Start(this); } else if (Rows != null && WorksheetQueryStatus == QueryStatus.Idle && UpdateCellTypes) { if (_UpdateCellTypesThread == null || _UpdateCellTypesThread.IsAlive == false) { UpdateCellTypes = false; _UpdateCellTypesThread = new Thread(DoUpdateCellTypes); _UpdateCellTypesThread.Start(this); } } if (Rows != null && UpdateValidation) { if (_ValidationThread == null || _ValidationThread.IsAlive == false) { UpdateValidation = false; _ValidationThread = new Thread(DoDataValidation); _ValidationThread.Start(new DataValidationParams(this, in_options)); } } }