public static Window generateWindow(Window baseWindow) { Window sendKrateWindow = new Window(new Rect(0, 0, baseWindow.Frame.Width - 2, baseWindow.Frame.Height - 2), "Send Krates"); var payToLabel = new Label("Pay to: ") { X = 1, Y = 1 }; var LabelLabel = new Label("Label: ") { X = Pos.Left(payToLabel), Y = Pos.Bottom(payToLabel) + 1 }; var AmountLabel = new Label("Amount: ") { X = Pos.Left(LabelLabel), Y = Pos.Bottom(LabelLabel) + 1 }; var payToText = new TextField("") { X = Pos.Right(LabelLabel), Y = Pos.Top(payToLabel), Width = 40 }; var LabelText = new TextField("") { X = Pos.Left(payToText), Y = Pos.Top(LabelLabel), Width = Dim.Width(payToText) }; var AmountText = new TextField("") { X = Pos.Left(LabelText), Y = Pos.Top(AmountLabel), Width = Dim.Width(LabelText) }; var subtractFreeCheckbox = new CheckBox("Subtract fee from account?", true) { X = Pos.Left(AmountLabel), Y = Pos.Bottom(AmountLabel) + 1 }; var sendKratesButton = new Button("Send") { X = Pos.Left(AmountText), Y = 10, IsDefault = true, Clicked = () => { var resp = Utility.Post("URL"); } }; var clearButton = new Button("Clear") { X = Pos.Right(sendKratesButton) + 15, Y = 10, IsDefault = true, Clicked = () => { var subView = baseWindow.Subviews[0]; subView.RemoveAll(); var sendView = SendView.generateWindow(baseWindow); baseWindow.Add(sendView); sendView.FocusFirst(); sendView.LayoutSubviews(); } }; sendKrateWindow.Add(payToLabel, LabelLabel, AmountLabel, payToText, LabelText, AmountText, subtractFreeCheckbox, sendKratesButton, clearButton); return(sendKrateWindow); }
public static Window generateTransactionsWindow(Window baseWindow) { Window transWindow = new Window(new Rect(0, 7, 65, 10), "Recent Transactions"); var transactionsRecord = (JArray)Utility.Get("http://localhost:37220/api/Wallet/spendable-transactions?WalletName=string4&AccountName=account%200")["transactions"]; var numTransactions = transactionsRecord.Count; for (int i = 0; i < numTransactions; i += 2) { var transactionAmount = new TextView(new Rect(1, i == 0 ? i : i + 1, 40, 1)) { Text = "-5.0000 KRATE(S)", ReadOnly = true }; transWindow.Add(transactionAmount); var transactionRecipient = new TextView(new Rect(1, i == 0 ? (i + 1) : i + 1 + 1, 40, 1)) { Text = "To: c652076704f4c1d4ea6dd75adac850ff", ReadOnly = true }; transWindow.Add(transactionRecipient); var transactionDateTime = new Label(new Rect(20, i == 0 ? i : i + 1, 20, 1), "01.20.2019 17:01") { TextAlignment = TextAlignment.Right }; transWindow.Add(transactionDateTime); } if (numTransactions < 1) { var noTransactions = new TextView(new Rect(1, 2, 60, 1)) { Text = "YOU DO NOT HAVE ANY TRANSACTIONS", ReadOnly = true }; transWindow.Add(noTransactions); } var seeAllTransactions = new Button("See All Transactions") { X = 0, Y = 7, Clicked = () => { var subView = baseWindow.Subviews[0]; subView.RemoveAll(); var tView = TransactionsView.generateWindow(baseWindow); baseWindow.Add(tView); tView.FocusFirst(); tView.LayoutSubviews(); } }; var sendKrates = new Button("Send Krates") { X = 25, Y = 7, Clicked = () => { var subView = baseWindow.Subviews[0]; subView.RemoveAll(); var costView = SendView.generateWindow(baseWindow); baseWindow.Add(costView); costView.FocusFirst(); costView.LayoutSubviews(); } }; transWindow.Add(seeAllTransactions, sendKrates); return(transWindow); }