Пример #1
0
 public VerticalTableSheet(Worksheet ws, AsyncLightningApp lApp, MessageDescriptor messageDescriptor,
                           IReadOnlyCollection <string> excludeList = default(List <string>))
 {
     Ws           = ws;
     LApp         = lApp;
     _fields      = messageDescriptor.Fields.InDeclarationOrder();
     _excludeList = excludeList;
 }
        public MessageForm(Worksheet ws, AsyncLightningApp lApp, Func <TRequestMessage, TResponseMessage> query, MessageDescriptor descriptor, string title, int startRow = 2,
                           int startColumn = 2)
        {
            Ws = ws;
            Ws.Activate();
            _lApp       = lApp;
            _query      = query;
            _fieldToRow = new Dictionary <string, int>();
            Fields      = descriptor.Fields.InDeclarationOrder();
            StartRow    = startRow;
            StartColumn = startColumn;
            EndColumn   = StartColumn + 1;

            var titleCell = ws.Cells[StartRow, StartColumn];

            titleCell.Font.Italic = true;
            titleCell.Value2      = title;

            _dataStartRow = StartRow + 1;
            var endDataRow = startRow + Fields.Count;

            var form = ws.Range[ws.Cells[_dataStartRow, StartColumn], ws.Cells[endDataRow, EndColumn]];

            Formatting.VerticalTable(form);

            var header = ws.Range[ws.Cells[_dataStartRow, StartColumn], ws.Cells[endDataRow, StartColumn]];

            Formatting.VerticalTableHeaderColumn(header);

            var data = ws.Range[ws.Cells[_dataStartRow, EndColumn], ws.Cells[endDataRow, EndColumn]];

            Formatting.VerticalTableDataColumn(data);

            var rowNumber = _dataStartRow;

            foreach (var field in Fields)
            {
                var headerCell = ws.Cells[rowNumber, StartColumn];
                var fieldName  = Utilities.FormatFieldName(field.Name);
                headerCell.Value2 = fieldName;
                var rowRange = ws.Range[ws.Cells[rowNumber, StartColumn], ws.Cells[rowNumber, EndColumn]];
                Formatting.VerticalTableRow(rowRange, rowNumber);
                _fieldToRow.Add(field.Name, rowNumber);
                rowNumber++;
            }

            var    submitButtonRow = rowNumber + 2;
            Button submitButton    = Utilities.CreateButton("submit" + descriptor.Name, ws, ws.Cells[submitButtonRow, StartColumn], "Submit");

            submitButton.Click += SubmitButtonOnClick;
            ErrorData           = ws.Cells[submitButtonRow, StartColumn + 2];
            ErrorData.WrapText  = false;
            ErrorData.RowHeight = 14.3;

            EndRow = submitButtonRow + 1;

            titleCell.Columns.AutoFit();
        }
Пример #3
0
        public PeersSheet(Worksheet ws, AsyncLightningApp lApp)
        {
            LApp = lApp;

            PeersForm  = new MessageForm <ConnectPeerRequest, ConnectPeerResponse>(ws, LApp, LApp.LndClient.ConnectPeer, ConnectPeerRequest.Descriptor, "Connect to a peer");
            PeersTable = new TableSheet <Peer>(ws, LApp, Peer.Descriptor, "pub_key");
            PeersTable.SetupTable("Peers", startRow: PeersForm.EndRow + 2);

            ws.Change += WsOnChange;
        }
        public ConnectSheet(Worksheet ws, AsyncLightningApp lApp)
        {
            Ws         = ws;
            LApp       = lApp;
            _cellCache = new Dictionary <string, string>();
            Ws.Change += WsOnChange;

            GetInfoSheet = new VerticalTableSheet <GetInfoResponse>(Ws, LApp, GetInfoResponse.Descriptor);
            GetInfoSheet.SetupVerticalTable("LND Node Info", 16);

            _errorData = Ws.Cells[12, 3];
        }
        public BalancesSheet(Worksheet ws, AsyncLightningApp lApp)
        {
            Ws   = ws;
            LApp = lApp;

            WalletBalanceSheet = new VerticalTableSheet <WalletBalanceResponse>(Ws, LApp, WalletBalanceResponse.Descriptor);
            WalletBalanceSheet.SetupVerticalTable("Wallet Balance");

            ChannelBalanceSheet = new VerticalTableSheet <ChannelBalanceResponse>(Ws, LApp, ChannelBalanceResponse.Descriptor);
            ChannelBalanceSheet.SetupVerticalTable("Channel Balance", startColumn: 5);

            Ws.Columns.AutoFit();

            //Ws.Names.Add(field.Name, dataCell);
        }
Пример #6
0
        public void SetupWorkbook(Workbook wb)
        {
            Wb   = wb;
            LApp = new AsyncLightningApp(this);

            CreateSheet(SheetNames.Connect);
            ConnectSheet = new ConnectSheet(Wb.Sheets[SheetNames.Connect], LApp);
            ConnectSheet.PopulateConfig();

            CreateSheet(SheetNames.Peers);
            PeersSheet = new PeersSheet(Wb.Sheets[SheetNames.Peers], LApp);

            CreateSheet(SheetNames.Balances);
            BalancesSheet = new BalancesSheet(Wb.Sheets[SheetNames.Balances], LApp);

            CreateSheet(SheetNames.Transactions);
            TransactionsSheet = new TransactionsSheet(Wb.Sheets[SheetNames.Transactions], LApp);

            CreateSheet(SheetNames.Channels);
            ChannelsSheet = new ChannelsSheet(Wb.Sheets[SheetNames.Channels], LApp);

            CreateSheet(SheetNames.Payments);
            PaymentsSheet = new TableSheet <Payment>(Wb.Sheets[SheetNames.Payments], LApp, Payment.Descriptor, "payment_hash");
            PaymentsSheet.SetupTable("Payments");

            CreateSheet(SheetNames.SendPayment);
            SendPaymentSheet = new SendPaymentSheet(Wb.Sheets[SheetNames.SendPayment], LApp);
            SendPaymentSheet.InitializePaymentRequest();

            CreateSheet(SheetNames.NodeLog);
            NodesSheet = new NodeSheet(Wb.Sheets[SheetNames.NodeLog]);

            MarkLndExcelWorkbook();
            ConnectSheet.Ws.Activate();

            Application.SheetActivate += Workbook_SheetActivate;
        }
        public ChannelsSheet(Worksheet ws, AsyncLightningApp lApp)
        {
            LApp            = lApp;
            OpenChannelForm = new MessageForm <OpenChannelRequest, ChannelPoint>(ws, lApp, lApp.LndClient.OpenChannel,
                                                                                 OpenChannelRequest.Descriptor, "Open a new channel");

            PendingOpenChannelsTable = new TableSheet <PendingOpenChannel>(ws, lApp, PendingOpenChannel.Descriptor, "channel_point", true);
            PendingOpenChannelsTable.SetupTable("Pending open", 5, OpenChannelForm.EndRow + 2);

            OpenChannelsTable = new TableSheet <Channel>(ws, lApp, Channel.Descriptor, "chan_id");
            OpenChannelsTable.SetupTable("Open", 10, PendingOpenChannelsTable.EndRow + 2);

            PendingClosingChannelsTable = new TableSheet <ClosedChannel>(ws, lApp, ClosedChannel.Descriptor, "channel_point", true);
            PendingClosingChannelsTable.SetupTable("Pending closing", 5, OpenChannelsTable.EndRow + 2, StartColumn);

            PendingForceClosingChannelsTable = new TableSheet <ForceClosedChannel>(ws, lApp, ForceClosedChannel.Descriptor, "channel_point", true);
            PendingForceClosingChannelsTable.SetupTable("Pending force closing", 5, PendingClosingChannelsTable.EndRow + 2, StartColumn);

            WaitingCloseChannelsTable = new TableSheet <WaitingCloseChannel>(ws, lApp, WaitingCloseChannel.Descriptor, "channel_point", true);
            WaitingCloseChannelsTable.SetupTable("Waiting for closing transaction to confirm", 5, PendingForceClosingChannelsTable.EndRow + 2, StartColumn);

            ClosedChannelsTable = new TableSheet <ChannelCloseSummary>(ws, lApp, ChannelCloseSummary.Descriptor, "chan_id");
            ClosedChannelsTable.SetupTable("Closed", 5, WaitingCloseChannelsTable.EndRow + 2);

            EndRow    = WaitingCloseChannelsTable.EndRow;
            EndColumn = new List <int>
            {
                PendingOpenChannelsTable.EndColumn,
                PendingClosingChannelsTable.EndColumn,
                PendingForceClosingChannelsTable.EndColumn,
                WaitingCloseChannelsTable.EndColumn,
                ClosedChannelsTable.EndColumn,
                OpenChannelsTable.EndColumn
            }.Max();

            ws.Change += WsOnChange;
        }
 public SendPaymentSheet(Worksheet ws, AsyncLightningApp lApp)
 {
     Ws   = ws;
     LApp = lApp;
 }
Пример #9
0
        public TableSheet(Worksheet ws, AsyncLightningApp lApp, MessageDescriptor messageDescriptor, string uniqueKeyName,
                          bool nestedData = false, int limit = 0, string sortColumn = null, bool sortAscending = true)
        {
            _nestedFields  = new List <Tuple <IFieldAccessor, IFieldAccessor> >();
            _uniqueKeyName = uniqueKeyName;
            Ws             = ws;
            LApp           = lApp;
            DisplayData    = new Dictionary <object, TMessageClass>();
            Fields         = messageDescriptor.Fields.InDeclarationOrder()
                             .Where(f => f.FieldType != FieldType.Message || !nestedData).ToList();

            var messageFields = messageDescriptor.Fields.InDeclarationOrder()
                                .Where(f => f.FieldType == FieldType.Message && nestedData && !f.IsRepeated && !f.IsMap).ToList();

            foreach (var parentField in messageFields)
            {
                var childFields = parentField.MessageType.Fields.InDeclarationOrder();
                Fields = Fields.Concat(childFields).ToArray();
                foreach (var childField in childFields)
                {
                    var nf = new Tuple <IFieldAccessor, IFieldAccessor>(parentField.Accessor, childField.Accessor);
                    if (!parentField.IsMap && !parentField.IsRepeated)
                    {
                        _nestedFields.Add(nf);
                    }
                    if (childField.Name != _uniqueKeyName)
                    {
                        continue;
                    }
                    _uniqueKeyField    = childField.Accessor;
                    _uniqueNestedField = parentField.Accessor;
                }
            }

            if (_uniqueKeyField == null)
            {
                foreach (var field in Fields)
                {
                    if (field.Name == _uniqueKeyName)
                    {
                        _uniqueKeyField = field.Accessor;
                    }
                }
            }

            _limit         = limit;
            _sortColumn    = sortColumn;
            _sortAscending = sortAscending;
            _wideColumns   = new List <string>
            {
                "pub_key",
                "remote_pubkey",
                "remote_pub_key",
                "remote_node_pub",
                "channel_point",
                "pending_htlcs",
                "closing_tx_hash",
                "closing_txid",
                "chain_hash",
                "payment_preimage",
                "payment_hash",
                "path",
                "tx_hash",
                "block_hash",
                "dest_addresses"
            };
        }
Пример #10
0
 public TransactionsSheet(Worksheet ws, AsyncLightningApp lApp)
 {
     SendCoinsForm     = new MessageForm <SendCoinsRequest, SendCoinsResponse>(ws, lApp, lApp.LndClient.SendCoins, SendCoinsRequest.Descriptor, "Send on-chain bitcoins");
     TransactionsTable = new TableSheet <Transaction>(ws, lApp, Transaction.Descriptor, "tx_hash");
     TransactionsTable.SetupTable("Transactions", startRow: SendCoinsForm.EndRow + 2);
 }