/// <summary> /// 照片拍摄完成,获取拍摄的照片,调用Custom Vision API,对图片进行分析 /// </summary> /// <param name="result">拍照的结果</param> /// <param name="photoCaptureFrame">拍摄的图片</param> private void OnCapturedPhotoToMemory(PhotoCapture.PhotoCaptureResult result, PhotoCaptureFrame photoCaptureFrame) { if (result.success) { audioSource.Stop(); audioSource.clip = captureAudioClip; audioSource.Play(); ModelManager.Instance.SetPhotoImageActive(true); ModelManager.Instance.SetTipText("editing..."); ToolManager.Instance.ShowMenu(); currentStatus = CurrentStatus.EdittingPhoto; photoCaptureFrame.CopyRawImageDataIntoBuffer(imageBufferList); imageBufferList = FlipVertical(imageBufferList, cameraParameters.cameraResolutionWidth, cameraParameters.cameraResolutionHeight, 4); Texture2D targetTexture = CreateTexture(imageBufferList, cameraParameters.cameraResolutionWidth, cameraParameters.cameraResolutionHeight); Sprite sprite = Sprite.Create(targetTexture, new Rect(0, 0, targetTexture.width, targetTexture.height), new Vector2(0.5f, 0.5f)); ModelManager.Instance.SetPhotoImage(sprite); } else { audioSource.Stop(); audioSource.clip = failedAudioClip; audioSource.Play(); currentStatus = CurrentStatus.Ready; ModelManager.Instance.SetTipText("air tap to take a photo"); } photoCaptureObject.StopPhotoModeAsync(OnStoppedPhotoMode); }
// ONLY access localTableCopy and not the localTable, to prevent races, as this method may be called outside the turn. internal SiloStatus GetApproximateSiloStatus(SiloAddress siloAddress) { var status = SiloStatus.None; if (siloAddress.Equals(MyAddress)) { status = CurrentStatus; } else { if (!localTableCopy.TryGetValue(siloAddress, out status)) { if (CurrentStatus.Equals(SiloStatus.Active)) { if (logger.IsVerbose) { logger.Verbose(ErrorCode.Runtime_Error_100209, "-The given siloAddress {0} is not registered in this MembershipOracle.", siloAddress.ToLongString()); } } status = SiloStatus.None; } } if (logger.IsVerbose3) { logger.Verbose3("-GetApproximateSiloStatus returned {0} for silo: {1}", status, siloAddress.ToLongString()); } return(status); }
protected CurrentStatus GetCurrentStatusToModify() { CurrentStatus cs_new = new CurrentStatus(); Container.CurrentStatus.AssignToCurrentStatus(cs_new); return(cs_new); }
protected virtual void AssignToCurrentStatus(CurrentStatus t) { t.Workflow = this.Workflow; t.WorkflowStep = this.WorkflowStep; t.Factory = this.Factory; t.Spec = this.WorkflowStep.FirstSpecStep.Spec; }
protected override async void ReadContacts() { Log.Logger.Debug("Started reading..."); IAsyncEntityBatchEnumerator <Contact> cursor = await Client.CreateContactEnumerator(GetExpandOptions(), Config.BatchSize); while (CurrentStatus.IsReading()) { if (CurrentStatus.ContactsQueued < Configuration.MaxQueueSize) { if (await cursor.MoveNext()) { foreach (Contact contact in cursor.Current) { CurrentStatus.QueueContact(contact); } CurrentStatus.ReadCounterAdd(1); Log.Logger.Debug($"Read {CurrentStatus.ReadCounter} batches"); } else { CurrentStatus.ReadingIsDone(); } } else { // Writers are running behind, give them some time Thread.Sleep(100); } } Log.Logger.Debug("Done reading..."); }
internal static List <CurrentStatus> GetCurrentStatus(dynamic jsonObject) { List <CurrentStatus> currentStatusList = new List <CurrentStatus>(); if (jsonObject["code"] != null && jsonObject["code"] == "0") { foreach (var map in jsonObject.data["monitors"]) { CurrentStatus currentStatus = new CurrentStatus(); currentStatus.MonitorId = map["monitor_id"]; currentStatus.Status = map["status"]; currentStatus.MonitorName = map["name"]; currentStatus.DownReason = map["down_reason"]; DateTime dt = DateTime.MinValue; if (map["last_polled_time"] != null) { DateTime.TryParse(map["last_polled_time"].ToString(), out dt); } currentStatus.LastPolledTime = dt; currentStatusList.Add(currentStatus); } } return(currentStatusList); }
public void ClearAll() { current = CurrentStatus.ClearAll; playerManager.ClearAll(); cleanseContainer.SetActive(true); StartCoroutine(ResetStatus(current)); }
public void SetStatus(CurrentStatus newStatus) { switch (newStatus) { case CurrentStatus.NO_ITEM_SELECTED: //CancelInvoke("CheckOrderStatus"); LoadWindow.SetActive(false); break; case CurrentStatus.STARTING_ORDER: LoadWindow.SetActive(true); break; case CurrentStatus.READY: LoadWindow.SetActive(false); CancelInvoke("CheckOrderStatus"); break; case CurrentStatus.WAITING: InfoWindow.inst.info.SetActive(true); LoadWindow.SetActive(true); break; case CurrentStatus.COMPLETE: LoadWindow.SetActive(false); CancelInvoke("CheckOrderStatus"); InfoWindow.inst.OrderSuccess(); InfoWindow.inst.ShowWindow(); break; } currentStatus = newStatus; }
// To protect from overposting attacks, enable the specific properties you want to bind to. // For more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Order.UpdatedAt = DateTime.Now; HttpClient client = _api.Initial(); HttpResponseMessage res = await client.PutAsync("api/Orders/" + Order.ID, new StringContent( JsonConvert.SerializeObject(Order), Encoding.UTF8, MediaTypeNames.Application.Json)); if (res.IsSuccessStatusCode) { if (!CurrentStatus.Equals(Order.Status)) { _orderLogger.Info("Payment ID : {payment_id}, Order status has been changed from {current_status} >> {new_status}.", Order.PaymentID, CurrentStatus, Order.Status); } _logger.LogInformation("{user} has edited this order [ID: {order_id}].", HttpContext.User.Identity.Name, Order.ID); return(RedirectToPage("./Index")); } ViewData["Error"] = "Failed to edit record"; return(Page()); }
public async Task <IActionResult> Edit(int id, [Bind("CurrentStatusID,ApprovalStatus,RentalsID,RowVersion")] CurrentStatus currentStatus) { if (id != currentStatus.CurrentStatusID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(currentStatus); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CurrentStatusExists(currentStatus.CurrentStatusID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DevicesID"] = new SelectList(_context.Devices, "DevicesID", "Assignee", currentStatus.RentalsID); return(View(currentStatus)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,StatusName")] CurrentStatus currentStatus) { if (id != currentStatus.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(currentStatus); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CurrentStatusExists(currentStatus.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(currentStatus)); }
/// <summary> /// The stop server. /// </summary> /// <returns> /// The <see cref="bool" />. /// </returns> public bool StopServer() { try { this.Enabled = false; if (this.listener != null) { if (this.listener.Status != ProxyController.ControllerStatus.None) { this.listener.Stop(); } this.Status = CurrentStatus.Disconnected; this.ReConfig(false); } this.SaveSettings(); Program.Notify.Text = @"Z A Я A - Stopped"; this.RefreshStatus(); return(true); } catch (Exception ex) { this.ShowDialog("Error: " + ex.Message, "Can't stop server", MessageBoxButtons.OK, MessageBoxIcon.Error); this.RefreshStatus(); } return(false); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (ContactInformation == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ContactInformation"); } if (ShippingAddress == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ShippingAddress"); } if (ContactInformation != null) { ContactInformation.Validate(); } if (ShippingAddress != null) { ShippingAddress.Validate(); } if (CurrentStatus != null) { CurrentStatus.Validate(); } if (OrderHistory != null) { foreach (var element in OrderHistory) { if (element != null) { element.Validate(); } } } }
private void LoadStatus(string sampleDataPath, TimeSpan offset) { var files = System.IO.Directory.GetFiles(sampleDataPath, "status-*.json"); foreach (var f in files) { var name = System.IO.Path.GetFileNameWithoutExtension(f).Replace("status-", ""); var statusJson = System.IO.File.ReadAllText(f); var curSt = (BlackMaple.MachineWatchInterface.CurrentStatus)JsonConvert.DeserializeObject( statusJson, typeof(BlackMaple.MachineWatchInterface.CurrentStatus), _jsonSettings ); curSt.TimeOfCurrentStatusUTC = curSt.TimeOfCurrentStatusUTC.Add(offset); foreach (var uniq in curSt.Jobs.Keys) { MockServerBackend.OffsetJob(curSt.Jobs[uniq], offset); } Statuses.Add(name, curSt); } string statusFromEnv = System.Environment.GetEnvironmentVariable("BMS_CURRENT_STATUS"); if (string.IsNullOrEmpty(statusFromEnv) || !Statuses.ContainsKey(statusFromEnv)) { CurrentStatus = Statuses.OrderBy(st => st.Key).First().Value; } else { CurrentStatus = Statuses[statusFromEnv]; } }
protected override bool ModifyEntity() { bool success = true; CurrentStatus cs_temp = new CurrentStatus(); AssignToCurrentStatus(cs_temp); CurrentStatus cs = ResolveCurrentStatus(cs_temp); if (cs == null) { ObjScope.Add(cs_temp); cs = cs_temp; } foreach (StartDetail sd in Details) { Container co = new Container(); co.CurrentStatus = cs; AssignToContainer(co); AssignStartDetailsToContainer(sd, co); ObjScope.Add(co); if (null != MfgOrder) { MfgOrder.ReleasedQty += co.Qty; } } return(success); }
protected override void ProcessContact(Contact contact) { Log.Logger.Debug($"Started processing contact {contact.Id}"); ContactIdentifier identifier = contact.Identifiers.FirstOrDefault(i => i.Source == _config.IdentifierSource); if (identifier != null || contact.Interactions.Any(i => i.EndDateTime > DateTime.UtcNow.AddYears(-1))) { Contact existingContact = SearchContact(contact); if (existingContact != null) { Log.Logger.Debug($"Found a contact for {contact.Id}, updating"); UpdateContact(existingContact, contact); } else { Log.Logger.Debug($"Contact {contact.Id} is new, adding"); AddContact(contact); } } else { Log.Logger.Information($"Contact {contact.Id} was skipped"); CurrentStatus.SkippedCounterAdd(1); } }
internal static bool RegisterClientAsPlayer(int fromClient) { if (_connectedPlayersCount == 0) { var player = new Player() { PlayerId = 1 }; Players.Add(fromClient, player); InitializeGameBoard(); Status = CurrentStatus.WaitingOtherPlayerToConnect; ServerSend.RegisteredAsPlayer(fromClient); ServerSend.SendStatusForAll(); _connectedPlayersCount++; return(true); } else if (_connectedPlayersCount == 1) { var player = new Player() { PlayerId = 2 }; Players.Add(fromClient, player); ServerSend.RegisteredAsPlayer(fromClient); StartGame(); ServerSend.SendStatusForAll(); _connectedPlayersCount++; return(true); } ServerSend.RegisterAsPlayerError(fromClient); return(false); }
private void MenuOperate(string data, long chatid) { int ID = 1; int NAME = 2; string[] alldata = data.Split('|'); if (alldata.Length == 3) { if (alldata[NAME].Equals("<< Back to Device List")) { SetStatus(new CurrentStatus { ChatID = chatid, Data = "-", Name = "-", StatusID = MAIN_MENU }); MainMenuShow(chatid); return; } switch (alldata[ID]) { case MENU_RENAME: { CurrentStatus status = GetStatus(new CurrentStatus { ChatID = chatid, Name = string.Empty, Data = string.Empty, StatusID = 0 }); SetStatus(new CurrentStatus { ChatID = chatid, Data = status.Data, Name = status.Name, StatusID = RENAME_SLAVE }); SendMessage(chatid, string.Format("Enter new NAME for device '{0}' or /CANCEL", status.Name)); break; } case MENU_DELETE: { CurrentStatus status = GetStatus(new CurrentStatus { ChatID = chatid, Name = string.Empty, Data = string.Empty, StatusID = 0 }); SetStatus(new CurrentStatus { ChatID = chatid, Data = status.Data, Name = status.Name, StatusID = DELETE_SLAVE }); SendMessage(chatid, "Enter Device NAME for DELETE or /CANCEL"); break; } //case MENU_STATUS: // { // ShowDeviceStatus(chatid); // break; // } default: { SendCommand(chatid, alldata[ID]); break; } } //TODO DEVICE MENU!!!!!!!!!!!!!! //SetStatus(new CurrentStatus { ChatID = chatid, Data = alldata[ID], Name = alldata[NAME], StatusID = SELECTED_SLAVE }); // SendMessage(chatid, string.Format("id {0}. name {1}", alldata[ID], alldata[NAME])); //DeviceMenuShow(chatid, alldata[ID]); } }
public void StopPlaying() { currentStatus = CurrentStatus.waiting; nicoCommentController.stopComment(); videoPlayer.Stop(); audioSource.Stop(); audioSource.GetComponent <RawImage>().enabled = false; }
public void SkipMovie() { if (IsNextMovieExists()) { currentStatus = CurrentStatus.waiting; StopPlaying(); } }
/// <summary> /// Получение из XML объекта /// </summary> /// <param name="arg"></param> /// <returns></returns> public static DbCurrentStatus Get(CurrentStatus arg) { return(new DbCurrentStatus() { CurentstId = arg.CurentstId, Name = arg.Name }); }
/// <summary> /// The constructor for the ServiceRequest entity. This will create a transient ServiceRequest entity. /// </summary> /// <param name="buildingCode"></param> /// <param name="description"></param> /// <param name="createdBy"></param> /// <param name="currentStatus"></param> public ServiceRequest(string buildingCode, string description, string createdBy, CurrentStatus currentStatus = CurrentStatus.Created) { _buildingCode = buildingCode; _description = description; CurrentStatus = currentStatus; _createdBy = createdBy; _createdDate = DateTime.UtcNow; }
/// <summary> /// 开始拍照流程 /// </summary> public void TakingPhoto() { if (currentStatus == CurrentStatus.WaitingTakingPhoto) { currentStatus = CurrentStatus.TakingPhoto; ModelManager.Instance.SetTipText(""); ModelManager.Instance.SetPrepareCanvas(true); } }
private void SetCurrentStatus(string status) { CurrentStatus.Text = status; CurrentStatus.Invalidate(); CurrentStatus.Update(); CurrentStatus.Refresh(); Refresh(); Application.DoEvents(); }
public void Healed(int healDmg, int healDuration, float healTick) { current = CurrentStatus.Heal; playerManager.HealOverTime(healDmg, healDuration, healTick); healContainer.SetActive(true); Debug.Log("Healing"); StartCoroutine(ResetStatus(current)); }
// Use this for initialization private void Awake() { currentReady = 0; isStart = false; if (!instance) { instance = this; } }
public void WriteXmlTest() { CurrentStatus target = new CurrentStatus { Status = Constants.NetworkStatus }; string actual = LinkedIn.Tests.Utility.WriteXml(target); Assert.AreEqual(currentStatusRequest, actual); }
private void AddContact(Contact contact) { Contact newContact = CopyContact(contact); foreach (Interaction interaction in contact.Interactions) { CopyInteraction(interaction, newContact); } CurrentStatus.AddCounterAdd(1); }
/// <summary> /// 调用Custom Vision API,对图像数据进行识别 /// </summary> /// <param name="texture">texture</param> /// <returns></returns> private IEnumerator <object> PostToCustomVisionAPI(Texture2D texture) { yield return(null); ModelManager.Instance.PlayAnimation("ResultAnimation"); byte[] imageData = texture.EncodeToPNG(); currentStatus = CurrentStatus.AnalyzingPhoto; ModelManager.Instance.SetTipText("正在分析中…"); string predictionUrl = string.Format(hostUrl, ConfigurationManager.Instance.GetProjectId()); string predictionKey = ConfigurationManager.Instance.GetPredictionKey(); string contentType = @"application/octet-stream"; var headers = new Dictionary <string, string>() { { "Prediction-Key", predictionKey }, { "Content-Type", contentType } }; string tagName = "对不起,无法识别"; WWW www = new WWW(predictionUrl, imageData, headers); yield return(www); string responseString = www.text; JSONObject jsonObject = new JSONObject(responseString); JSONObject prediction = jsonObject.GetField("Predictions"); float probability = 0; if (prediction != null && prediction.type == JSONObject.Type.ARRAY) { tagName = prediction[0].GetField("Tag").str; probability = prediction[0].GetField("Probability").n; if (probability < probabilityThreshold) { tagName = "对不起,无法识别"; } } if (tagName == "对不起,无法识别") { ModelManager.Instance.SetTipText("识别结果:" + tagName + ((probability >= probabilityThreshold) ? "\r\n可能性:" + Math.Round(probability, 3) * 100 + "%" : "")); currentStatus = CurrentStatus.Ready; } else { ModelManager.Instance.SetTipText(""); ModelManager.Instance.SetResult("识别结果:" + tagName + ((probability >= probabilityThreshold) ? "\r\n可能性:" + Math.Round(probability, 3) * 100 + "%" : "") + "\r\n该画家相关作品:"); ModelManager.Instance.SetWaitingSearch(true); currentStatus = CurrentStatus.Searching; StartCoroutine(ImageCollectionManager.Instance.SearchImages(ParseTagName(tagName))); } }
public async Task <IActionResult> Create([Bind("Id,StatusName")] CurrentStatus currentStatus) { if (ModelState.IsValid) { _context.Add(currentStatus); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(currentStatus)); }
protected override bool ModifyEntity() { bool success = base.ModifyEntity(); CurrentStatus cs = GetCurrentStatusToModify(); cs.InProcess = true; ReplaceCurrentStatus(cs); return(success); }
public void Insert(string Field1,byte[] Ts) { CurrentStatus item = new CurrentStatus(); item.Field1 = Field1; item.Ts = Ts; item.Save(UserName); }
public void StartUpdating() { _currentStatus = CurrentStatus.UpdatingWebresources; SetActivityToProgressRing(UpdateProgressRing, true); SetUiElementEnabled(UpdateLabel, true); }
public void StartPublishing() { _currentStatus = CurrentStatus.Publishing; SetActivityToProgressRing(PublishProgressRing, true); SetUiElementEnabled(PublishLabel, true); }
public void StartGettingWebresources() { _currentStatus = CurrentStatus.GettingWebresources; SetActivityToProgressRing(GettingWebresourcesProgressRing, true); SetUiElementEnabled(GettingWebresourcesLabel, true); }
public static IList<Auto> GetAutos(Guid modelID, string carColor, int creationYear, CurrentStatus status) { IList<Auto> autos = new List<Auto>(); using (CarsEntity autorentEntityContext = new CarsEntity()) { try { var queryAutosJoin = from a in autorentEntityContext.Autoes join photo in autorentEntityContext.AutoPhotos on a.Number equals photo.AutoNumber where a.ModelId == modelID && a.ColorGroup == carColor && a.Year == creationYear && a.Status == (short)status select new { Autos = a, photo.PhotoFileName }; foreach (var item in queryAutosJoin) { Auto auto = new Auto(); auto.Advance = item.Autos.Advance; auto.BodyType = (e_BodyType)item.Autos.BodyType; auto.CarColor = item.Autos.ColorGroup; auto.CarNumber = item.Autos.Number; auto.CreationYear = item.Autos.Year; auto.CurrentMilage = item.Autos.Mileage; auto.Status = (CurrentStatus)item.Autos.Status; auto.KmRate = item.Autos.KmRate; auto.DayRate = item.Autos.DayRate; auto.Engine = item.Autos.Engine; auto.ModelID = item.Autos.ModelId; auto.PhotoFileName = item.PhotoFileName.FirstOrDefault().ToString(); autos.Add(auto); } } catch (InvalidOperationException ex) { throw ex; } } return autos; }
public void Update(int Id,string Field1,byte[] Ts) { CurrentStatus item = new CurrentStatus(); item.MarkOld(); item.IsLoaded = true; item.Id = Id; item.Field1 = Field1; item.Ts = Ts; item.Save(UserName); }
private IAsyncResult ShowReport() { if (InvokeRequired) { return BeginInvoke(new ShowReportDelegate(ShowReport)); } else { m_reportCtl.Visible = true; m_reportCtl.BringToFront(); m_progessCtl.Visible = false; btnClean.Enabled = true; btnClean.Text = Properties.Resources.FINISH; btnCancel.Enabled = false; m_currentStatus = CurrentStatus.Report; return null; } }
private IAsyncResult DoCompletion() { if (InvokeRequired) { return BeginInvoke(new DoCompletionDelegate(DoCompletion)); } else { btnClean.Enabled = false; m_currentStatus = CurrentStatus.FinishingProcessing; return null; } }
private void UpdateCurrentStatus(CurrentStatus newStatus, string additionalInformation = "", int progressBarCurrent = 0, int progressBarMax = 0) { _currentStatus = newStatus; // Do the following stuff // 1. Update the status label // 2. Update the progress bar string appendedStatus = additionalInformation.Length == 0 ? "" : " (" + additionalInformation + ")"; switch (_currentStatus) { case CurrentStatus.Ready: UpdateStatusLabel("Ready", appendedStatus); UpdateProgressBar(0, 100); break; case CurrentStatus.Scanning: UpdateStatusLabel("Scanning", appendedStatus); UpdateProgressBar(progressBarCurrent, progressBarMax); break; case CurrentStatus.Completed_Scanning: UpdateStatusLabel("Scan Completed", appendedStatus); UpdateProgressBar(0, 100); break; case CurrentStatus.Removing: UpdateStatusLabel("Removing", appendedStatus); UpdateProgressBar(progressBarCurrent, progressBarMax); break; case CurrentStatus.Completed_Removing: UpdateStatusLabel("Removed", appendedStatus); UpdateProgressBar(0, 100); break; default: UpdateStatusLabel("Undefined", appendedStatus); UpdateProgressBar(0, 100); break; } }
public void StartCreating() { _currentStatus = CurrentStatus.CreatingWebresources; SetActivityToProgressRing(CreateProgressRing, true); SetEnabledToUiElemet(CreateLabel, true); }
private IAsyncResult DoProcessing() { if (InvokeRequired) { return BeginInvoke(new DoProcessingDelegate(DoProcessing)); } else { m_progessCtl.Visible = true; m_progessCtl.BringToFront(); m_optionCtl.Visible = false; btnClean.Text = Properties.Resources.HIDE; m_currentStatus = CurrentStatus.Cleaning; m_controller.ProcessAsync(); return null; } }