Beispiel #1
0
        public FormCloseChannel(ChannelTableContent channel)
        {
            InitializeComponent();

            this.通道名称textBox.Text = channel.channel;
            this.对端账户textBox.Text = channel.peer;
            this.本段余额textBox.Text = new Fixed8(channel.balance).ToString();
            this.对端余额textBox.Text = new Fixed8(channel.peerBalance).ToString();

            channelName = channel.channel;
            founderUri  = channel.uri;
            peerUri     = channel.peer;
            asset       = channel.asset;
        }
        private void SettleChannelButton_Click(object sender, EventArgs e)
        {
            if (this.ChannelListListView.SelectedItems.Count > 0)
            {
                try
                {
                    ListView.SelectedListViewItemCollection channelInfo = this.ChannelListListView.SelectedItems;
                    ChannelTableContent deleteChannel = new ChannelTableContent();
                    foreach (ListViewItem item in channelInfo)
                    {
                        deleteChannel.channel = item.SubItems[0].Text;
                        deleteChannel.uri     = FormStartTrinity.getChannelUri();
                        deleteChannel.peer    = item.SubItems[3].Text;
                        deleteChannel.asset   = item.SubItems[4].Text;

                        deleteChannel.balance     = Fixed8.Parse(item.SubItems[1].Text).GetData();
                        deleteChannel.peerBalance = Fixed8.Parse(item.SubItems[2].Text).GetData();
                    }

                    using (FormCloseChannel formClose = new FormCloseChannel(deleteChannel))
                    {
                        if (formClose.ShowDialog() == DialogResult.OK)
                        {
                            getChannelList();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show(Strings.choiceDeleteChannel);
            }
        }