From b9a177c1528b08e333d4c52f300c09f0146c02a5 Mon Sep 17 00:00:00 2001 From: ZavaruKitsu Date: Sat, 15 Oct 2022 18:28:15 +0300 Subject: [PATCH] fix: merge conflict --- .../Datasources/ButtonFormDataSource.cs | 137 ------------------ 1 file changed, 137 deletions(-) delete mode 100644 TelegramBotBase/Datasources/ButtonFormDataSource.cs diff --git a/TelegramBotBase/Datasources/ButtonFormDataSource.cs b/TelegramBotBase/Datasources/ButtonFormDataSource.cs deleted file mode 100644 index e91668c..0000000 --- a/TelegramBotBase/Datasources/ButtonFormDataSource.cs +++ /dev/null @@ -1,137 +0,0 @@ -using System; -using System.Collections.Generic; -using TelegramBotBase.Controls.Hybrid; -using TelegramBotBase.Form; -using TelegramBotBase.Interfaces; - -namespace TelegramBotBase.DataSources; - -public class ButtonFormDataSource : IDataSource -{ - private ButtonForm _buttonform; - - public ButtonFormDataSource() - { - _buttonform = new ButtonForm(); - } - - public ButtonFormDataSource(ButtonForm bf) - { - _buttonform = bf; - } - - public virtual ButtonForm ButtonForm - { - get => _buttonform; - set => _buttonform = value; - } - - - /// - /// Returns the amount of rows. - /// - public virtual int RowCount => ButtonForm.Rows; - - /// - /// Returns the maximum amount of columns. - /// - public virtual int ColumnCount => ButtonForm.Cols; - - - /// - /// Returns the amount of rows existing. - /// - /// - public virtual int Count => ButtonForm.Count; - - /// - /// Returns the row with the specific index. - /// - /// - /// - public virtual ButtonRow ItemAt(int index) - { - return ButtonForm[index]; - } - - public virtual List ItemRange(int start, int count) - { - return ButtonForm.GetRange(start, count); - } - - public virtual List AllItems() - { - return ButtonForm.ToArray(); - } - - public virtual ButtonForm PickItems(int start, int count, string filter = null) - { - var bf = new ButtonForm(); - ButtonForm dataForm = null; - - if (filter == null) - { - dataForm = ButtonForm.Duplicate(); - } - else - { - dataForm = ButtonForm.FilterDuplicate(filter, true); - } - - for (var i = 0; i < count; i++) - { - var it = start + i; - - if (it > dataForm.Rows - 1) - { - break; - } - - bf.AddButtonRow(dataForm[it]); - } - - return bf; - } - - public virtual ButtonForm PickAllItems(string filter = null) - { - if (filter == null) - { - return ButtonForm.Duplicate(); - } - - - return ButtonForm.FilterDuplicate(filter, true); - } - - public virtual Tuple FindRow(string text, bool useText = true) - { - return ButtonForm.FindRow(text, useText); - } - - /// - /// Returns the maximum items of this data source. - /// - /// - /// - public virtual int CalculateMax(string filter = null) - { - return PickAllItems(filter).Rows; - } - - public virtual ButtonRow Render(object data) - { - return data as ButtonRow; - } - - - public static implicit operator ButtonFormDataSource(ButtonForm bf) - { - return new ButtonFormDataSource(bf); - } - - public static implicit operator ButtonForm(ButtonFormDataSource ds) - { - return ds.ButtonForm; - } -}