{"id":280085,"date":"2016-10-28T14:10:02","date_gmt":"2016-10-28T10:10:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=280085"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=280085","title":{"rendered":"\u041f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c"},"content":{"rendered":"<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u0442\u0430\u043a \u0447\u0430\u0441\u0442\u043e, \u0447\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u044b. \u0418 \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u044f\u0437\u044b\u043a\u0430\/\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043d\u0435\u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438, \u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043f\u0438\u0448\u0435\u0442 \u0441\u0432\u043e\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u0432 \u0441\u0438\u043b\u0443 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0435\u0433\u043e \u043b\u044e\u0431\u0438\u043c\u044b\u043c\u0438 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u0430\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043e\u043d \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0440\u0438 \u0441\u043c\u0435\u043d\u0435 \u044f\u0437\u044b\u043a\u0430\/\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u044d\u0442\u043e \u0438\u0449\u0435\u0442 \u043c\u0435\u0441\u0442\u043d\u044b\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438 \u0441\u0432\u043e\u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043b\u0438\u0431\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0445 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0441\u0432\u043e\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0440\u0443\u0442\u0438\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u0441\u043b\u043e\u0436\u0438\u0432\u0448\u0443\u044e\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 C++ Builder \u043d\u0430 C#, WPF.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041f\u0435\u0440\u0432\u0430\u044f \u0442\u0440\u043e\u0439\u043a\u0430<\/h2>\n<p>  <\/p>\n<pre><code>  public static class IComparableExtensions {     public static T Minv&lt;T&gt;(this T value, T maxValue) where T : IComparable&lt;T&gt; {       if (value.CompareTo(maxValue) &gt;= 0) return maxValue;       return value;     }     public static T Maxv&lt;T&gt;(this T value, T minValue) where T : IComparable&lt;T&gt; {       if (value.CompareTo(minValue) &lt;= 0) return minValue;       return value;     }     public static T Limit&lt;T&gt;(this T value, T minValue, T maxValue) where T : IComparable&lt;T&gt; {       if (value.CompareTo(minValue) &lt;= 0) return minValue;       if (value.CompareTo(maxValue) &gt;= 0) return maxValue;       return value;     }   } <\/code><\/pre>\n<p>  \u0427\u0435\u043c \u0436\u0435 \u043c\u043d\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u044b\u043c\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 <b>Math.Min<\/b> \u0438 <b>Math.Max<\/b>?<\/p>\n<p>  <b>1.<\/b> \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 <b>Math<\/b> \u043f\u0435\u0440\u0435\u0434 <b>Min<\/b> \u0438 <b>Max<\/b>. \u042d\u0442\u043e \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u043b\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043a\u043e\u0434\u043e\u043c, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0447\u0442\u043e \u044f \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u043b \u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<p>  <b>2.<\/b> \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 <b>Math<\/b> \u043f\u0435\u0440\u0435\u0434 <b>Min<\/b> \u0438 <b>Max<\/b> \u0438 \u043d\u0435\u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e\u043c \u0438\u0437-\u0437\u0430 \u043a\u043e\u0446\u0435\u043f\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u044d\u0442\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u043d\u0435 \u043c\u0435\u0441\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435. \u041a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0434\u0440\u0443\u0433\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>Math<\/b> \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043c\u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0435\u0439, \u0430 \u0432\u043e\u0442 <b>Min<\/b> \u0438 <b>Max<\/b> &mdash; \u044d\u0442\u043e \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0438 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u044d\u0442\u043e \u043d\u0430\u0448\u0435 \u0432\u0441\u0451! \u0418 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432\u044b\u0448\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442.<\/p>\n<p>  <b>3.<\/b> \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u043d\u043e\u0442\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <b>Min<\/b> \u0438 <b>Max<\/b> \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043c\u043d\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0439. \u042f \u0431\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0435\u043b \u0438\u043c\u0435\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b <b>min<\/b> \u0438 <b>max<\/b>. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u0435\u043c \u043a \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u043c\u0443.<\/p>\n<p>  \u0418 \u0432 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043c\u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0438\u043b\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c, \u043a\u0430\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u0435\u0440\u0445\u0443 \u0438\u043b\u0438 \u0441\u043d\u0438\u0437\u0443. \u041c\u0435\u0442\u043e\u0434 <b>Limit<\/b> \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0435\u043d\u044f \u043e\u0442 \u044d\u0442\u0438\u0445 \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u0412 C# 6 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <b>using System.Math;<\/b>, \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0435\u0437 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430. \u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u043d\u043e \u043f\u043e\u0437\u0434\u043d\u043e.<\/p>\n<h2>StringMaker<\/h2>\n<p>  \u0414\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0438\u043b\u0438 \u0432\u044b\u0434\u0430\u0447\u0438 \u0432 \u043b\u043e\u0433 \u0447\u0430\u0441\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b. <br \/>  \u0418 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0432\u0440\u043e\u0434\u0435 <code>void OutDebug(params object[] args)<\/code> \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0432\u043d\u0443\u0442\u0440\u0438. \u041d\u043e \u043a\u043e\u0433\u0434\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0441 \u0442\u0430\u043a\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<pre><code>  public class SM {     StringBuilder Sb;     SM() { Sb = new StringBuilder(); }     SM Add(object value) {       if (value==null) return this;       var objects = value as IEnumerable;       if (objects!=null) {         foreach (var obj in objects) Add(obj);       } else Sb.Append(value.ToString());       return this;      }     public override string ToString() { return Sb.ToString(); }     public static implicit operator string(SM value) {        return value==null ? null : value.ToString();      }     public static SM operator +(SM a, object b) { return a.Add(b); }     public static SM operator -(SM a, object b) { Sb.Append(' '); return Add(b); }     public static SM New { get { return new SM(); } }   }    public static class IEnumerableExtensions {     public static IEnumerable Sep(this IEnumerable objects, object separator) {       bool first = true;       foreach (var obj in objects) {         if (first) first = false;         else yield return separator;         yield return obj;       }       yield break;     }   } <\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c:<\/p>\n<pre><code>  var sm = SM.New+&quot;\u0427\u0438\u0441\u043b\u0430&quot;-1-2-3;   var rr = new int[] { 1, 2, 3 };    sm = sm+&quot; (&quot;+rr.Sep(&quot;, &quot;)+')';   Trace.WriteLine(sm); <\/code><\/pre>\n<p>  \u0412 C# 6 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u043d\u0443\u0442\u0440\u044c \u0441\u0442\u0440\u043e\u043a\u0438. \u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u043d\u043e \u043f\u043e\u0437\u0434\u043d\u043e.<\/p>\n<h2>TimerTask<\/h2>\n<p>  \u0412 \u0441\u0440\u0435\u0434\u0435, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0439 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438, \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430\u043a\u043e\u043f\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041e\u0431\u044b\u0447\u043d\u043e, \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>  \u0412 WPF \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e: <\/p>\n<pre><code>Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { }));<\/code><\/pre>\n<p>  \u0410 \u043c\u043e\u0436\u043d\u043e \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u043a\u043e\u0434, \u043a\u0430\u043a \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440, \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code>  public class TimerTask {     public bool IsPaused, IsCancelled;     DateTimeOffset NextTime;     TimeSpan Interval;     Func&lt;bool&gt; Func;      static DispatcherTimer Timer;     static List&lt;TimerTask&gt; TaskList;      TimerTask (double interval, double delay, Func&lt;bool&gt; func) {       if (TaskList==null) {         TaskList = new List&lt;TimerTask&gt;();         Timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(0.02), IsEnabled = true };         Timer.Tick += Timer_Tick;       }       TaskList.Add(this);       Interval = TimeSpan.FromSeconds(interval);       NextTime = DateTimeOffset.Now+TimeSpan.FromSeconds(delay);       Func = func;     }     static void Timer_Tick(object sender, EventArgs ea) {       int i = 0, cnt = TaskList.Count;       while (i&lt;cnt) {         if (TaskList[i].IsCancelled) { TaskList.RemoveAt(i); cnt--; }          else { TaskList[i].Tick(); i++; }       }     }     void Tick() {       if (IsPaused || DateTimeOffset.Now&lt;NextTime) return;       IsCancelled = !Func();       NextTime = DateTimeOffset.Now+Interval;     }     public static TimerTask DoOnce(Action action, double delay) {       return new TimerTask(0, delay, () =&gt; { action(); return false; });     }     public static TimerTask DoForever(Action action, double interval, double delay) {       return new TimerTask(interval, delay, () =&gt; { action(); return true; });     }     public static TimerTask DoWhile(Func&lt;bool&gt; func, double interval, double delay) {       return new TimerTask(interval, delay, () =&gt; { return func(); });     }     public static TimerTask DoEach(IEnumerable&lt;object&gt; enumerable, double interval, double delay) {       var enumerator = enumerable.GetEnumerator();       return new TimerTask(interval, delay, () =&gt; { return enumerator.MoveNext(); });     }   } <\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c:<\/p>\n<pre><code>  public partial class MainWindow : Window {     public MainWindow() {       InitializeComponent();       TimerTask.DoEach(Start(), 0, 0);     }     IEnumerable&lt;object&gt; Start() {       Title = &quot;Starting 1&quot;;       yield return null;       Starting1();       Title = &quot;Starting 2&quot;;       yield return null;       Starting2();       Title = &quot;Starting 3&quot;;       yield return null;       Starting3();       Title = &quot;Started&quot;;       yield break;     }   } <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441-\u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432.<\/p>\n<p>  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430, \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e <b>ShowDialog<\/b>, \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u0438\u0439, \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u0432\u0441\u0435\u0445 \u0434\u0440\u0443\u0433\u0438\u0445. \u042d\u0442\u043e\u0433\u043e \u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b \u043a\u0430\u0436\u0434\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0438\u043c\u0435\u043b\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <b>DispatcherTimer<\/b>.<\/p>\n<h2>IntRangeNotifyCollection<\/h2>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0440\u0435\u0448\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u043e\u0439, \u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445. \u0415\u0441\u043b\u0438 <b>ListBox<\/b> \u0441 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043b\u0438\u0448\u044c 40 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0432 100 000, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0438 40. \u0422\u0430\u043a\u0436\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445 \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. <\/p>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <b>ItemsSource<\/b> \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e, \u0430 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043b\u0430\u0441\u0441. \u0421\u0430\u043c\u044b\u0439 \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0439, \u043a\u0430\u043a\u043e\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c.<\/p>\n<pre><code>  public class IntRangeEnumerator : IEnumerator {     int _Current, _Last;     public IntRangeEnumerator(int count) : this(0, count) { }     public IntRangeEnumerator(int start, int count) { _Current = start-1; _Last = start+count; }     public object Current { get { return _Current; } }     public bool MoveNext() { _Current++; return _Current&lt;_Last; }     public void Dispose() { }     public void Reset() { }   }    public class IntRange : IList {     int _Start, _Count;     public IntRange(int count) : this(0, count) { }     public IntRange(int start, int count) { _Start = start; _Count = count; }     public int Count { get { return _Count; } }     public IEnumerator GetEnumerator() { return new IntRangeEnumerator(_Start, _Count); }     public object this[int index] { get { return _Start+index; } set { } } <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>    public bool IsSynchronized { get { return true; } }     public object SyncRoot { get { return this; } }     public void CopyTo(Array array, int index) {       for (int i = 0; i&lt;_Count; i++) array.SetValue(_Start+i, index+i);     }     public bool IsFixedSize { get { return true; } }     public bool IsReadOnly { get { return true; } }     public int Add(object value) { return 0; }     public void Clear() { }     public bool Contains(object value) {       if (!(value is int)) return false;       int i = (int)value;       return i&gt;=_Start && i&lt;_Start+_Count;      }     public int IndexOf(object value) {       if (!(value is int)) return -1;       int i = (int)value;       return i&gt;=_Start && i&lt;_Start+_Count ? i-_Start : -1;      }     public void Insert(int index, object value) { }     public void Remove(object value) { }     public void RemoveAt(int index) { } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<pre><code>  }    public class IntRangeNotifyCollection : IEnumerable, INotifyCollectionChanged {     int _Count;     public event NotifyCollectionChangedEventHandler CollectionChanged;     public IntRangeNotifyCollection() { }     public IEnumerator GetEnumerator() { return new IntRangeEnumerator(_Count); }     protected void OnCollectionChanged(NotifyCollectionChangedEventArgs e) {       if (CollectionChanged!=null) CollectionChanged(this, e);     }     public int Count {        get { return _Count; }       set {         if (value==_Count) return;         NotifyCollectionChangedEventArgs e;         if (value==0) {           e = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);         } else         if (value&gt;_Count) {           e = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add,              new IntRange(_Count, value-_Count), _Count);         } else {           e = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove,              new IntRange(value, _Count-value), value);         }         _Count = value;         OnCollectionChanged(e);       }     }   } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0437\u0430\u0442\u0435\u043c \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0441 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438? \u042d\u0442\u043e \u0443\u0436\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p>  \u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435:<br \/>  \u00bb <a href=\"https:\/\/habrahabr.ru\/post\/253857\/\">\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441 Range \u0432 ObservableCollection<\/a><br \/>  \u00bb <a href=\"https:\/\/habrahabr.ru\/post\/208792\/\">\u0412\u0438\u0440\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 WPF<\/a><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/313824\/\"> https:\/\/habrahabr.ru\/post\/313824\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u0442\u0430\u043a \u0447\u0430\u0441\u0442\u043e, \u0447\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u044b. \u0418 \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u044f\u0437\u044b\u043a\u0430\/\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043d\u0435\u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438, \u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043f\u0438\u0448\u0435\u0442 \u0441\u0432\u043e\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u0432 \u0441\u0438\u043b\u0443 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0435\u0433\u043e \u043b\u044e\u0431\u0438\u043c\u044b\u043c\u0438 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u0430\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043e\u043d \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0440\u0438 \u0441\u043c\u0435\u043d\u0435 \u044f\u0437\u044b\u043a\u0430\/\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u044d\u0442\u043e \u0438\u0449\u0435\u0442 \u043c\u0435\u0441\u0442\u043d\u044b\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438 \u0441\u0432\u043e\u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043b\u0438\u0431\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0445 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0441\u0432\u043e\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0440\u0443\u0442\u0438\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u0441\u043b\u043e\u0436\u0438\u0432\u0448\u0443\u044e\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 C++ Builder \u043d\u0430 C#, WPF.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-280085","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/280085","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=280085"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/280085\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=280085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=280085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=280085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}