当前位置: 首页>>代码示例>>C#>>正文


C# TimeSpan.ToDescriptiveText方法代码示例

本文整理汇总了C#中System.TimeSpan.ToDescriptiveText方法的典型用法代码示例。如果您正苦于以下问题:C# TimeSpan.ToDescriptiveText方法的具体用法?C# TimeSpan.ToDescriptiveText怎么用?C# TimeSpan.ToDescriptiveText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.TimeSpan的用法示例。


在下文中一共展示了TimeSpan.ToDescriptiveText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AppendCharacterTrainingTime

        /// <summary>
        /// Appends the given training time for the specified character to the provided <see cref="StringBuilder"/>. *
        /// Format is : "1d, 5h, 32m John Doe (Eidetic Memory)"
        /// Used to update the window's title.
        /// </summary>
        /// <param name="character">The character.</param>
        /// <param name="time">The time.</param>
        /// <returns></returns>
        private static string AppendCharacterTrainingTime(Character character, TimeSpan time)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append($"{time.ToDescriptiveText(DescriptiveTextOptions.None)} {character.Name}");

            if (Settings.UI.MainWindow.ShowSkillNameInWindowTitle)
                builder.Append($" ({character.CurrentlyTrainingSkill.SkillName})");

            return builder.ToString();
        }
开发者ID:RapidFiring,项目名称:evemon,代码行数:19,代码来源:MainWindow.cs

示例2: UpdateDisplay

        /// <summary>
        /// Updates control contents.
        /// </summary>
        private void UpdateDisplay()
        {
            trainTime = TimeSpan.Zero;

            // Default all known flag to true. Will be set to false in UpdateNode() if a requirement is not met
            bool allCertsKnown = true;

            // Default unplanned certificates flag to false. Will be set to true in UpdateNode() if a requirement is neither met nor planned
            bool certsUnplanned = false;

            // Treeview update
            tvCertList.BeginUpdate();
            try
            {
                tvCertList.Nodes.Clear();
                if (m_object != null && m_plan != null)
                {
                    // Recursively create nodes
                    foreach (var cert in StaticCertificates.AllCertificates.Where(x=> x.Recommendations.Contains(m_object)))
                    {
                        tvCertList.Nodes.Add(GetCertNode(cert));
                    }
                }

                // Update the nodes
                foreach (TreeNode node in tvCertList.Nodes)
                {
                    UpdateNode(node, ref allCertsKnown, ref certsUnplanned);
                }
            }
            finally
            {
                tvCertList.EndUpdate();
            }

            // Set training time required label
            if (allCertsKnown)
            {
                lblTimeRequired.Text = "No training required";
            }
            else
            {
                lblTimeRequired.Text = trainTime.ToDescriptiveText(DescriptiveTextOptions.IncludeCommas);
            }

            // Set minimun control size
            Size timeRequiredTextSize = TextRenderer.MeasureText(lblTimeRequired.Text, Font);
            Size newMinimumSize = new Size(timeRequiredTextSize.Width + btnAddCerts.Width, 0);
            if (this.MinimumSize.Width < newMinimumSize.Width)
                this.MinimumSize = newMinimumSize;

            // Enable / disable button
            btnAddCerts.Enabled = certsUnplanned;
        }
开发者ID:wow4all,项目名称:evemu_server,代码行数:57,代码来源:RecommendedCertificatesControl.cs

示例3: UpdateTimeStatusLabel

 internal void UpdateTimeStatusLabel(bool selected, int skillCount, TimeSpan totalTime)
 {
     TimeStatusLabel.AutoToolTip = false;
     TimeStatusLabel.Text = String.Format(CultureConstants.DefaultCulture, "{0} to train {1}",
         totalTime.ToDescriptiveText(DescriptiveTextOptions.IncludeCommas),
         selected ?
         String.Format("selected skill{0}", skillCount == 1 ? String.Empty : "s")
         : "whole plan");
 }
开发者ID:wow4all,项目名称:evemu_server,代码行数:9,代码来源:PlanWindow.cs

示例4: TimeSpanToText

 /// <summary>
 /// Transpose the timespan to text.
 /// </summary>
 /// <param name="time"></param>
 /// <param name="includeSeconds"></param>
 /// <returns></returns>
 private string TimeSpanToText(TimeSpan time, bool includeSeconds)
 {
     return time.ToDescriptiveText(
         DescriptiveTextOptions.FirstLetterUppercase
         | DescriptiveTextOptions.SpaceText
         | DescriptiveTextOptions.FullText
         | DescriptiveTextOptions.IncludeCommas,
         includeSeconds);
 }
开发者ID:wow4all,项目名称:evemu_server,代码行数:15,代码来源:BlueprintBrowserControl.cs

示例5: TimeSpanToText

 /// <summary>
 /// Transpose the timespan to text.
 /// </summary>
 /// <param name="time"></param>
 /// <param name="includeSeconds"></param>
 /// <returns></returns>
 private static string TimeSpanToText(TimeSpan time, bool includeSeconds)
     => time.ToDescriptiveText(DescriptiveTextOptions.IncludeCommas, includeSeconds);
开发者ID:RapidFiring,项目名称:evemon,代码行数:8,代码来源:BlueprintBrowserControl.cs

示例6: AppendCharacterTrainingTime

        /// <summary>
        /// Appends the given training time for the specified character to the provided <see cref="StringBuilder"/>. *
        /// Format is : "1d, 5h, 32m John Doe (Eidetic Memory)"
        /// Used to update the window's title.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="character"></param>
        /// <param name="time"></param>
        private static string AppendCharacterTrainingTime(CCPCharacter character, TimeSpan time)
        {
            StringBuilder builder = new StringBuilder();

            string skillDescriptionText = time.ToDescriptiveText(DescriptiveTextOptions.Default);
            builder.AppendFormat(CultureConstants.DefaultCulture,"{0} {1}", skillDescriptionText, character.Name);

            if (Settings.UI.MainWindow.ShowSkillNameInWindowTitle)
                builder.AppendFormat(CultureConstants.DefaultCulture, " ({0})", character.CurrentlyTrainingSkill.SkillName);

            return builder.ToString();
        }
开发者ID:wow4all,项目名称:evemu_server,代码行数:20,代码来源:MainWindow.cs


注:本文中的System.TimeSpan.ToDescriptiveText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。