public void UpdateElapseTime(float time) { if (timeText != null) { TimeFormatHelper TFH = new TimeFormatHelper(); timeText.text = TFH.GetTimeFormat(time); } }
private void UpdateViewText() { var start = TimeFormatHelper.GetFormattedSeconds(BassTrack.SamplesToSeconds(ZoomStart)); var end = TimeFormatHelper.GetFormattedSeconds(BassTrack.SamplesToSeconds(ZoomEnd)); var length = TimeFormatHelper.GetFormattedSeconds(BassTrack.SamplesToSeconds(ZoomLength)); var position = TimeFormatHelper.GetFormattedSeconds(BassTrack.SamplesToSeconds(CurrentPosition)); lblViewDetails.Text = $"View: {start} to {end} ({length}) Cursor: {position}"; }
private void SetToolStripLabel() { if (ToolStripLabel == null) { return; } var text = $"{TrackModels.Count} tracks in playlist ({TimeFormatHelper.GetFormattedHours(TrackModels.Sum(t => t.Length))})"; ToolStripLabel.Text = text; }
private string GetSampleFolder(Sample sample) { var sampleFolder = Path.Combine(SampleLibraryFolder, FileSystemHelper.StripInvalidFileNameChars(sample.TrackArtist)); var titleFolder = $"{sample.TrackTitle} ({TimeFormatHelper.GetFormattedSeconds(sample.TrackLength)})"; titleFolder = FileSystemHelper.StripInvalidFileNameChars(titleFolder); sampleFolder = Path.Combine(sampleFolder, titleFolder); return(sampleFolder); }
/// <summary> /// Gets the selected track FX. /// </summary> /// <returns>The selected track FX.</returns> private TrackFXTrigger GetSelectedTrackFx() { if (cmbTrackFX.Items.Count == 0 || cmbTrackFX.SelectedIndex < 0) { return(null); } var selectedText = cmbTrackFX.SelectedItem.ToString(); return(AutomationAttributes .TrackFXTriggers .OrderBy(t => t.Start) .FirstOrDefault(trackFx => selectedText == TimeFormatHelper.GetFormattedSeconds(trackFx.Start))); }
/// <summary> /// Populates the track FX combo box. /// </summary> private void PopulateTrackFxComboBox() { cmbTrackFX.Items.Clear(); foreach (var trigger in AutomationAttributes.TrackFXTriggers.OrderBy(t => t.Start).ToList()) { cmbTrackFX.Items.Add(TimeFormatHelper.GetFormattedSeconds(trigger.Start)); } if (cmbTrackFX.Items.Count > 0) { cmbTrackFX.SelectedIndex = 0; } }
public SampleModel(Sample sample) { Description = (sample.TrackTitle == sample.Description) ? sample.TrackArtist + " - " + sample.Description : sample.TrackArtist + " - " + sample.TrackTitle + " - " + sample.Description; Tags = string.Join(", ", sample.Tags.ToArray()); LengthFormatted = TimeFormatHelper.GetFormattedHours(Convert.ToDecimal(sample.Length)); Length = Convert.ToDecimal(sample.Length); Bpm = sample.Bpm; Sample = sample; Key = sample.IsAtonal ? "Atonal" : KeyHelper.GetDisplayKey(sample.Key); }
private void Ps_NewMessageEvent(string Message) { AnalysisDataHelper analysisDataHelper = new AnalysisDataHelper(); var model = analysisDataHelper.AnalysisData(Message); TimeFormatHelper timeHelper = new TimeFormatHelper(); Dispatcher.Invoke(new Action(delegate { var model2 = HuiZhongModels.Where(m => m.SIM == model.Data0).FirstOrDefault(); int index = HuiZhongModels.IndexOf(model2); HuiZhongModels[index].CollectTime = timeHelper.HexTimeToDecTime(model.Data3); HuiZhongModels[index].FlowRate = model.Data1; HuiZhongModels[index].AccumulateFlow = model.Data2; })); //--- 分页 ShowData(TreeViewSelectedDisplayName); }
public void OnFailPanel(float clearTime, int numOfScript) { isPausePanel = false; TimeFormatHelper TFH = new TimeFormatHelper(); Text timeText = FailPanel.Find("Time/Text").GetComponent <Text>(); timeText.text = TFH.GetTimeFormat(clearTime); Text numOfScrptText = FailPanel.Find("ScriptCount/Text").GetComponent <Text>(); var SB = new StringBuilder(numOfScript.ToString()); SB.Append("개"); // Localization numOfScrptText.text = SB.ToString(); FailPanel.gameObject.SetActive(true); BlackCurtain.gameObject.SetActive(true); }
public AnalysisDataModel AnalysisData(string Data) { AnalysisDataModel model = new AnalysisDataModel(); TimeFormatHelper timeHelper = new TimeFormatHelper(); string data1 = Data.Substring(0, 55); string crc = Data.Substring(55, 4); if (CRC.ToModbusCRC16(data1) == crc) { model.Data0 = data1.Substring(0, 11); //电话号码 model.Data1 = MathHelper.HexToDouble(data1.Substring(11, 16)); //瞬时流量 model.Data2 = MathHelper.HexToDouble(data1.Substring(27, 16)); model.Data3 = data1.Substring(43, 12); model.Result = AnalysisDataModel.AnalysisResult.OK; } else { model.Result = AnalysisDataModel.AnalysisResult.ERR; } return(model); }
/// <summary> /// Formats the seconds as a string in a HH:MM:SS format. /// </summary> /// <param name="seconds">The seconds.</param> /// <returns>A formatted string</returns> public string FormatSeconds(double seconds) { return(TimeFormatHelper.GetFormattedHours(seconds)); //return Utils.FixTimespan(seconds, seconds > 3600 ? "HMMSS" : "MMSS"); }
/* * IEnumerator HistoryButtonHide() * { * RectTransform panelPos = HistoryPanel.GetComponent<RectTransform>(); * * int deg = 0; * int startX = (int)panelPos.anchoredPosition.x; * int endX = startX - maxX; * int x = 0; * * while (deg <= UISLIDINGDEG) * { * * * panelPos.anchoredPosition = new Vector2(x, panelPos.anchoredPosition.y); * * deg += 8; * * yield return null; * } * } * * IEnumerator HistoryButtonShow() * { * * }*/ public void OnClearPanel(int count, float clearTime, int numOfScript) { buttonEvent.StopAllCoroutines(); if (clearCallback != null) { clearCallback(); } isPausePanel = false; ClearPanel.gameObject.SetActive(true); BlackCurtain.gameObject.SetActive(true); /* UI가 stage scene별로 있으므로 10스테이지의 다시하기 버튼만 UI에서 제거해줌 * // 10번째 스테이지인 경우 다음 스테이지 버튼을 꺼준다 * var curStageName = SceneManager.GetActiveScene().name; * if(curStageName[curStageName.Length - 1] == '0') * { * var nextBtn = ClearPanel.FindChild("NextButton"); * if (nextBtn != null) * nextBtn.GetComponent<UnityEngine.UI.Button>().interactable = false; * } */ TimeFormatHelper TFH = new TimeFormatHelper(); Text timeText = ClearPanel.Find("Time/Text").GetComponent <Text>(); timeText.text = TFH.GetTimeFormat(clearTime); Text numOfScrptText = ClearPanel.Find("ScriptCount/Text").GetComponent <Text>(); var SB = new StringBuilder(numOfScript.ToString()); SB.Append("개"); // Localization numOfScrptText.text = SB.ToString(); star1 = ClearPanel.Find("ParentStar1").Find("Star1"); star2 = ClearPanel.Find("ParentStar2").Find("Star2"); star3 = ClearPanel.Find("ParentStar3").Find("Star3"); if (count == 1) { star1.gameObject.SetActive(true); } if (count == 2) { star1.gameObject.SetActive(true); star2.gameObject.SetActive(true); } if (count == 3) { star1.gameObject.SetActive(true); star2.gameObject.SetActive(true); star3.gameObject.SetActive(true); } DataManager.Instance.AddDataStageClear(SceneManager.GetActiveScene().name, count); /* 스테이지 클리어 업적 달성 */ if (Social.localUser.authenticated) // 로그인이 되어 있는지 확인 { if (SceneManager.GetActiveScene().name == "Chapter1Stage_8") { // unlock achievement (achievement_1) Social.ReportProgress("CgkI0Njd1fQSEAIQBg", 100.0f, (bool success) => { // handle success or failure }); } else if (SceneManager.GetActiveScene().name == "Chapter2Stage_8") { // unlock achievement (achievement_2) Social.ReportProgress("CgkI0Njd1fQSEAIQBw", 100.0f, (bool success) => { // handle success or failure }); } else if (SceneManager.GetActiveScene().name == "Chapter3Stage_8") { // unlock achievement (achievement_3) Social.ReportProgress("CgkI0Njd1fQSEAIQCA", 100.0f, (bool success) => { // handle success or failure }); } else if (SceneManager.GetActiveScene().name == "Chapter4Stage_8") { // unlock achievement (achievement_4) Social.ReportProgress("CgkI0Njd1fQSEAIQCQ", 100.0f, (bool success) => { // handle success or failure }); } } }
protected override void OnPaint(PaintEventArgs e) { //e.Graphics.FillRectangle(Brushes.Red, ClientRectangle); //e.Graphics.DrawString(Magnet.FileName, Font, new SolidBrush(ForeColor), ClientRectangle.X + 5, ClientRectangle.Y + 5); // background if (_hover) { e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(240, 240, 240)), ClientRectangle); } if (Progress > 0 && Progress < 1) { var color = _hover ? Color.FromArgb(144, 255, 162) : Color.FromArgb(211, 255, 218); var rect = ClientRectangle; rect.Width = (int)(rect.Width * Progress); e.Graphics.FillRectangle(new SolidBrush(color), rect); } if (Icon != null) { var iconRect = new Rectangle(5, 5, 32, 32); e.Graphics.DrawImage(Icon, iconRect); } var fileNameRect = ClientRectangle; fileNameRect.X += 45; fileNameRect.Y += 5; fileNameRect.Width -= fileNameRect.X; fileNameRect.Height = 20; //e.Graphics.FillRectangle(Brushes.LightCoral, fileNameRect); e.Graphics.DrawString(FitFileName(e.Graphics, Magnet.FileName, fileNameRect), Font, Brushes.Black, fileNameRect); var infoRect = ClientRectangle; infoRect.X += 45; infoRect.Y += 22; infoRect.Width -= infoRect.X; infoRect.Height = 20; string infoText; if (DownloadSpeed == 0) { infoText = string.Format("добавлен {0}{1}", TimeFormatHelper.Format(CreateDate), Progress == 1f ? "" : ", не загружен"); } else { infoText = string.Format("{0}% {1} {2}/c", (int)(Progress * 100), Utils.FormatBytes(Magnet.Size), Utils.FormatBytes(DownloadSpeed)); } e.Graphics.DrawString(infoText, Font, Brushes.Gray, infoRect); base.OnPaint(e); }
private void Button_Click(object sender, RoutedEventArgs e) { TimeFormatHelper timeFormatHelper = new TimeFormatHelper(); Debug.WriteLine(timeFormatHelper.HexTimeToDecTime("12091108201B")); }