Пример #1
0
 /* ----------------------------------------------------------------- */
 ///
 /// NewItem
 ///
 /// <summary>
 /// Creates a new instance of the ImageItem class with the specified
 /// arguments.
 /// </summary>
 ///
 /// <param name="src">Source collection.</param>
 /// <param name="index">Index to be created.</param>
 /// <param name="item">Page information.</param>
 ///
 /// <returns>ImageItem object.</returns>
 ///
 /* ----------------------------------------------------------------- */
 public static ImageItem NewItem(this ImageCollection src, int index, Page item) =>
 new ImageItem(src.Convert, src.Selection, src.Preferences)
 {
     Index     = index,
     RawObject = item,
 };
Пример #2
0
 /* ----------------------------------------------------------------- */
 ///
 /// GetCopiedIndices
 ///
 /// <summary>
 /// Gets the copied collection that represents the selected
 /// indices.
 /// </summary>
 ///
 /* ----------------------------------------------------------------- */
 private static IList <int> GetCopiedIndices(ImageCollection src) =>
 src.Selection.Indices.Where(i => i >= 0 && i < src.Count).ToList();
Пример #3
0
 /* ----------------------------------------------------------------- */
 ///
 /// Remove
 ///
 /// <summary>
 /// Removes the selected images.
 /// </summary>
 ///
 /// <param name="src">Source collection.</param>
 ///
 /// <returns>
 /// History item to execute undo and redo actions.
 /// </returns>
 ///
 /* ----------------------------------------------------------------- */
 public static HistoryItem Remove(this ImageCollection src) =>
 src.RemoveAt(GetCopiedIndices(src));
Пример #4
0
 /* ----------------------------------------------------------------- */
 ///
 /// GetPair
 ///
 /// <summary>
 /// Gets the collection each element is a pair of index and Page
 /// object.
 /// </summary>
 ///
 /* ----------------------------------------------------------------- */
 private static IList <KeyValuePair <int, Page> > GetPair(ImageCollection src,
                                                          IEnumerable <int> indices) =>
 indices.Select(i => KeyValuePair.Create(i, src[i].RawObject)).ToList();
Пример #5
0
 /* ----------------------------------------------------------------- */
 ///
 /// Insert
 ///
 /// <summary>
 /// Inserts the specified items behind the selected index.
 /// </summary>
 ///
 /// <param name="src">Source collection.</param>
 /// <param name="items">Insertion items.</param>
 ///
 /// <returns>
 /// History item to execute undo and redo actions.
 /// </returns>
 ///
 /* ----------------------------------------------------------------- */
 public static HistoryItem Insert(this ImageCollection src, IEnumerable <Page> items) =>
 src.InsertAt(src.Selection.Last + 1, items);