private async Task UpdateRolesLabelAsync()
        {
            if (_updatingRolesLabel)
            {
                return;
            }

            _updatingRolesLabel = true;

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            try
            {
                if (_textView.Roles.Any())
                {
                    System.Collections.Generic.IEnumerable <string> roles = _textView.Roles.Select(r => r);
                    var content = string.Join(Environment.NewLine, roles);

                    _lblRoles.SetTooltip(content);
                    _lblRoles.Value = roles.Last();
                }
                else
                {
                    _lblRoles.Value   = "n/a";
                    _lblRoles.ToolTip = null;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.Fail(ex.ToString());
            }

            _updatingRolesLabel = false;
        }
Example #2
0
 /// <summary>Unicode表における一つ前のcodeを返す</summary>
 /// <param name="hand">対象の手</param>
 /// <returns>前の手</returns>
 public Hands.Unicode Previous(Hands.Unicode hand)
 {
     System.Collections.Generic.IEnumerable <Hands.Unicode> hands = Enum.GetValues(typeof(Hands.Unicode)).Cast <Hands.Unicode>();
     if (hand == Enum.GetValues(typeof(Hands.Unicode)).Cast <Hands.Unicode>().First())
     {
         return(hands.Last());
     }
     return(hands.Where(e => (int)e < (int)hand).OrderBy(e => e).Last());
 }
Example #3
0
 static void Test(System.Collections.Generic.IEnumerable <int> seq) =>
 Assert.Equal(seq.Last(), Assert.IsType <double>(Evaluation.Predict(seq.Select(x => (double)x).SkipLast(1).ToArray())), 12);